Import flatpak_0.10.2.orig.tar.xz
authorSimon McVittie <smcv@debian.org>
Fri, 15 Dec 2017 15:26:30 +0000 (15:26 +0000)
committerSimon McVittie <smcv@debian.org>
Fri, 15 Dec 2017 15:26:30 +0000 (15:26 +0000)
[dgit import orig flatpak_0.10.2.orig.tar.xz]

366 files changed:
ABOUT-NLS [new file with mode: 0644]
COPYING [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
NEWS [new file with mode: 0644]
README.md [new file with mode: 0644]
acinclude.m4 [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
app/Makefile.am.inc [new file with mode: 0644]
app/flatpak-builtins-add-remote.c [new file with mode: 0644]
app/flatpak-builtins-build-bundle.c [new file with mode: 0644]
app/flatpak-builtins-build-commit-from.c [new file with mode: 0644]
app/flatpak-builtins-build-export.c [new file with mode: 0644]
app/flatpak-builtins-build-finish.c [new file with mode: 0644]
app/flatpak-builtins-build-import-bundle.c [new file with mode: 0644]
app/flatpak-builtins-build-init.c [new file with mode: 0644]
app/flatpak-builtins-build-sign.c [new file with mode: 0644]
app/flatpak-builtins-build.c [new file with mode: 0644]
app/flatpak-builtins-config.c [new file with mode: 0644]
app/flatpak-builtins-delete-remote.c [new file with mode: 0644]
app/flatpak-builtins-document-export.c [new file with mode: 0644]
app/flatpak-builtins-document-info.c [new file with mode: 0644]
app/flatpak-builtins-document-list.c [new file with mode: 0644]
app/flatpak-builtins-document-unexport.c [new file with mode: 0644]
app/flatpak-builtins-enter.c [new file with mode: 0644]
app/flatpak-builtins-info-remote.c [new file with mode: 0644]
app/flatpak-builtins-info.c [new file with mode: 0644]
app/flatpak-builtins-install.c [new file with mode: 0644]
app/flatpak-builtins-list-remotes.c [new file with mode: 0644]
app/flatpak-builtins-list.c [new file with mode: 0644]
app/flatpak-builtins-ls-remote.c [new file with mode: 0644]
app/flatpak-builtins-make-current.c [new file with mode: 0644]
app/flatpak-builtins-override.c [new file with mode: 0644]
app/flatpak-builtins-repo-update.c [new file with mode: 0644]
app/flatpak-builtins-repo.c [new file with mode: 0644]
app/flatpak-builtins-run.c [new file with mode: 0644]
app/flatpak-builtins-search.c [new file with mode: 0644]
app/flatpak-builtins-uninstall.c [new file with mode: 0644]
app/flatpak-builtins-update.c [new file with mode: 0644]
app/flatpak-builtins-utils.c [new file with mode: 0644]
app/flatpak-builtins-utils.h [new file with mode: 0644]
app/flatpak-builtins.h [new file with mode: 0644]
app/flatpak-main.c [new file with mode: 0644]
app/flatpak-transaction.c [new file with mode: 0644]
app/flatpak-transaction.h [new file with mode: 0644]
bubblewrap/Makefile-bwrap.am.inc [new file with mode: 0644]
bubblewrap/bind-mount.c [new file with mode: 0644]
bubblewrap/bind-mount.h [new file with mode: 0644]
bubblewrap/bubblewrap.c [new file with mode: 0644]
bubblewrap/network.c [new file with mode: 0644]
bubblewrap/network.h [new file with mode: 0644]
bubblewrap/utils.c [new file with mode: 0644]
bubblewrap/utils.h [new file with mode: 0644]
buildutil/glib-tap.mk [new file with mode: 0644]
buildutil/tap-driver.sh [new file with mode: 0755]
buildutil/tap-test [new file with mode: 0755]
common/Makefile.am.inc [new file with mode: 0644]
common/flatpak-chain-input-stream.c [new file with mode: 0644]
common/flatpak-chain-input-stream.h [new file with mode: 0644]
common/flatpak-common-types.h [new file with mode: 0644]
common/flatpak-db.c [new file with mode: 0644]
common/flatpak-db.h [new file with mode: 0644]
common/flatpak-dir.c [new file with mode: 0644]
common/flatpak-dir.h [new file with mode: 0644]
common/flatpak-json-oci.c [new file with mode: 0644]
common/flatpak-json-oci.h [new file with mode: 0644]
common/flatpak-json.c [new file with mode: 0644]
common/flatpak-json.h [new file with mode: 0644]
common/flatpak-oci-registry.c [new file with mode: 0644]
common/flatpak-oci-registry.h [new file with mode: 0644]
common/flatpak-portal-error.c [new file with mode: 0644]
common/flatpak-portal-error.h [new file with mode: 0644]
common/flatpak-run.c [new file with mode: 0644]
common/flatpak-run.h [new file with mode: 0644]
common/flatpak-table-printer.c [new file with mode: 0644]
common/flatpak-table-printer.h [new file with mode: 0644]
common/flatpak-utils.c [new file with mode: 0644]
common/flatpak-utils.h [new file with mode: 0644]
common/gvdb/gvdb-builder.c [new file with mode: 0644]
common/gvdb/gvdb-builder.h [new file with mode: 0644]
common/gvdb/gvdb-format.h [new file with mode: 0644]
common/gvdb/gvdb-reader.c [new file with mode: 0644]
common/gvdb/gvdb-reader.h [new file with mode: 0644]
compile [new file with mode: 0755]
completion/flatpak [new file with mode: 0755]
config.guess [new file with mode: 0755]
config.h.in [new file with mode: 0644]
config.rpath [new file with mode: 0755]
config.sub [new file with mode: 0755]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
data/Makefile.am.inc [new file with mode: 0644]
data/org.freedesktop.Flatpak.xml [new file with mode: 0644]
data/org.freedesktop.impl.portal.PermissionStore.xml [new file with mode: 0644]
data/org.freedesktop.portal.Documents.xml [new file with mode: 0644]
data/org.freedesktop.systemd1.xml [new file with mode: 0644]
dbus-proxy/Makefile.am.inc [new file with mode: 0644]
dbus-proxy/dbus-proxy.c [new file with mode: 0644]
dbus-proxy/flatpak-proxy.c [new file with mode: 0644]
dbus-proxy/flatpak-proxy.h [new file with mode: 0644]
dbus.service.d/flatpak.conf.in [new file with mode: 0644]
depcomp [new file with mode: 0755]
doc/Makefile.am [new file with mode: 0644]
doc/Makefile.in [new file with mode: 0644]
doc/docbook.css [new file with mode: 0644]
doc/flatpak-build-bundle.xml [new file with mode: 0644]
doc/flatpak-build-commit-from.xml [new file with mode: 0644]
doc/flatpak-build-export.xml [new file with mode: 0644]
doc/flatpak-build-finish.xml [new file with mode: 0644]
doc/flatpak-build-import-bundle.xml [new file with mode: 0644]
doc/flatpak-build-init.xml [new file with mode: 0644]
doc/flatpak-build-sign.xml [new file with mode: 0644]
doc/flatpak-build-update-repo.xml [new file with mode: 0644]
doc/flatpak-build.xml [new file with mode: 0644]
doc/flatpak-config.xml [new file with mode: 0644]
doc/flatpak-docs.xml.in [new file with mode: 0644]
doc/flatpak-document-export.xml [new file with mode: 0644]
doc/flatpak-document-info.xml [new file with mode: 0644]
doc/flatpak-document-list.xml [new file with mode: 0644]
doc/flatpak-document-unexport.xml [new file with mode: 0644]
doc/flatpak-enter.xml [new file with mode: 0644]
doc/flatpak-flatpakref.xml [new file with mode: 0644]
doc/flatpak-flatpakrepo.xml [new file with mode: 0644]
doc/flatpak-info.xml [new file with mode: 0644]
doc/flatpak-install.xml [new file with mode: 0644]
doc/flatpak-installation.xml [new file with mode: 0644]
doc/flatpak-list.xml [new file with mode: 0644]
doc/flatpak-make-current.xml [new file with mode: 0644]
doc/flatpak-metadata.xml [new file with mode: 0644]
doc/flatpak-override.xml [new file with mode: 0644]
doc/flatpak-remote-add.xml [new file with mode: 0644]
doc/flatpak-remote-delete.xml [new file with mode: 0644]
doc/flatpak-remote-info.xml [new file with mode: 0644]
doc/flatpak-remote-ls.xml [new file with mode: 0644]
doc/flatpak-remote-modify.xml [new file with mode: 0644]
doc/flatpak-remote.xml [new file with mode: 0644]
doc/flatpak-remotes.xml [new file with mode: 0644]
doc/flatpak-repo.xml [new file with mode: 0644]
doc/flatpak-run.xml [new file with mode: 0644]
doc/flatpak-search.xml [new file with mode: 0644]
doc/flatpak-uninstall.xml [new file with mode: 0644]
doc/flatpak-update.xml [new file with mode: 0644]
doc/flatpak.xml [new file with mode: 0644]
doc/reference/Makefile.am [new file with mode: 0644]
doc/reference/Makefile.in [new file with mode: 0644]
doc/reference/flatpak-docs.xml [new file with mode: 0644]
doc/reference/flatpak-overrides.txt [new file with mode: 0644]
doc/reference/flatpak-sections.txt [new file with mode: 0644]
doc/reference/flatpak.types [new file with mode: 0644]
doc/reference/html/FlatpakInstallation.html [new file with mode: 0644]
doc/reference/html/FlatpakInstalledRef.html [new file with mode: 0644]
doc/reference/html/FlatpakRef.html [new file with mode: 0644]
doc/reference/html/FlatpakRemote.html [new file with mode: 0644]
doc/reference/html/FlatpakRemoteRef.html [new file with mode: 0644]
doc/reference/html/annotation-glossary.html [new file with mode: 0644]
doc/reference/html/ch01.html [new file with mode: 0644]
doc/reference/html/flatpak-Error-codes.html [new file with mode: 0644]
doc/reference/html/flatpak-Version-information.html [new file with mode: 0644]
doc/reference/html/flatpak-flatpak-bundle-ref.html [new file with mode: 0644]
doc/reference/html/flatpak.devhelp2 [new file with mode: 0644]
doc/reference/html/full-api-index.html [new file with mode: 0644]
doc/reference/html/home.png [new file with mode: 0644]
doc/reference/html/index.html [new file with mode: 0644]
doc/reference/html/left-insensitive.png [new file with mode: 0644]
doc/reference/html/left.png [new file with mode: 0644]
doc/reference/html/object-tree.html [new file with mode: 0644]
doc/reference/html/right-insensitive.png [new file with mode: 0644]
doc/reference/html/right.png [new file with mode: 0644]
doc/reference/html/style.css [new file with mode: 0644]
doc/reference/html/up-insensitive.png [new file with mode: 0644]
doc/reference/html/up.png [new file with mode: 0644]
doc/reference/version.xml.in [new file with mode: 0644]
doc/xmlto-config.xsl [new file with mode: 0644]
document-portal/Makefile.am.inc [new file with mode: 0644]
document-portal/org.freedesktop.portal.Documents.service.in [new file with mode: 0644]
document-portal/xdg-document-portal.service.in [new file with mode: 0644]
document-portal/xdp-enums.h [new file with mode: 0644]
document-portal/xdp-fuse.c [new file with mode: 0644]
document-portal/xdp-fuse.h [new file with mode: 0644]
document-portal/xdp-main.c [new file with mode: 0644]
document-portal/xdp-util.c [new file with mode: 0644]
document-portal/xdp-util.h [new file with mode: 0644]
env.d/flatpak.env.in [new file with mode: 0644]
flatpak.pc.in [new file with mode: 0644]
gtk-doc.make [new file with mode: 0644]
install-sh [new file with mode: 0755]
lib/Makefile.am.inc [new file with mode: 0644]
lib/flatpak-bundle-ref.c [new file with mode: 0644]
lib/flatpak-bundle-ref.h [new file with mode: 0644]
lib/flatpak-enum-types.c.template [new file with mode: 0644]
lib/flatpak-enum-types.h.template [new file with mode: 0644]
lib/flatpak-error.c [new file with mode: 0644]
lib/flatpak-error.h [new file with mode: 0644]
lib/flatpak-installation.c [new file with mode: 0644]
lib/flatpak-installation.h [new file with mode: 0644]
lib/flatpak-installed-ref-private.h [new file with mode: 0644]
lib/flatpak-installed-ref.c [new file with mode: 0644]
lib/flatpak-installed-ref.h [new file with mode: 0644]
lib/flatpak-ref.c [new file with mode: 0644]
lib/flatpak-ref.h [new file with mode: 0644]
lib/flatpak-related-ref-private.h [new file with mode: 0644]
lib/flatpak-related-ref.c [new file with mode: 0644]
lib/flatpak-related-ref.h [new file with mode: 0644]
lib/flatpak-remote-private.h [new file with mode: 0644]
lib/flatpak-remote-ref-private.h [new file with mode: 0644]
lib/flatpak-remote-ref.c [new file with mode: 0644]
lib/flatpak-remote-ref.h [new file with mode: 0644]
lib/flatpak-remote.c [new file with mode: 0644]
lib/flatpak-remote.h [new file with mode: 0644]
lib/flatpak-version-macros.h [new file with mode: 0644]
lib/flatpak-version-macros.h.in [new file with mode: 0644]
lib/flatpak.c [new file with mode: 0644]
lib/flatpak.h [new file with mode: 0644]
lib/test-lib.c [new file with mode: 0644]
libglnx/COPYING [new file with mode: 0644]
libglnx/Makefile-libglnx.am.inc [new file with mode: 0644]
libglnx/README.md [new file with mode: 0644]
libglnx/glnx-backport-autocleanups.h [new file with mode: 0644]
libglnx/glnx-backport-autoptr.h [new file with mode: 0644]
libglnx/glnx-backports.c [new file with mode: 0644]
libglnx/glnx-backports.h [new file with mode: 0644]
libglnx/glnx-console.c [new file with mode: 0644]
libglnx/glnx-console.h [new file with mode: 0644]
libglnx/glnx-dirfd.c [new file with mode: 0644]
libglnx/glnx-dirfd.h [new file with mode: 0644]
libglnx/glnx-errors.c [new file with mode: 0644]
libglnx/glnx-errors.h [new file with mode: 0644]
libglnx/glnx-fdio.c [new file with mode: 0644]
libglnx/glnx-fdio.h [new file with mode: 0644]
libglnx/glnx-local-alloc.c [new file with mode: 0644]
libglnx/glnx-local-alloc.h [new file with mode: 0644]
libglnx/glnx-lockfile.c [new file with mode: 0644]
libglnx/glnx-lockfile.h [new file with mode: 0644]
libglnx/glnx-macros.h [new file with mode: 0644]
libglnx/glnx-missing-syscall.h [new file with mode: 0644]
libglnx/glnx-missing.h [new file with mode: 0644]
libglnx/glnx-shutil.c [new file with mode: 0644]
libglnx/glnx-shutil.h [new file with mode: 0644]
libglnx/glnx-xattrs.c [new file with mode: 0644]
libglnx/glnx-xattrs.h [new file with mode: 0644]
libglnx/libglnx.h [new file with mode: 0644]
libglnx/libglnx.m4 [new file with mode: 0644]
libglnx/tests/libglnx-testlib.h [new file with mode: 0644]
libglnx/tests/test-libglnx-errors.c [new file with mode: 0644]
libglnx/tests/test-libglnx-fdio.c [new file with mode: 0644]
libglnx/tests/test-libglnx-macros.c [new file with mode: 0644]
libglnx/tests/test-libglnx-shutil.c [new file with mode: 0644]
libglnx/tests/test-libglnx-xattrs.c [new file with mode: 0644]
ltmain.sh [new file with mode: 0644]
m4/attributes.m4 [new file with mode: 0644]
m4/gettext.m4 [new file with mode: 0644]
m4/glibtests.m4 [new file with mode: 0644]
m4/gtk-doc.m4 [new file with mode: 0644]
m4/iconv.m4 [new file with mode: 0644]
m4/intlmacosx.m4 [new file with mode: 0644]
m4/lib-ld.m4 [new file with mode: 0644]
m4/lib-link.m4 [new file with mode: 0644]
m4/lib-prefix.m4 [new file with mode: 0644]
m4/libtool.m4 [new file with mode: 0644]
m4/ltoptions.m4 [new file with mode: 0644]
m4/ltsugar.m4 [new file with mode: 0644]
m4/ltversion.m4 [new file with mode: 0644]
m4/lt~obsolete.m4 [new file with mode: 0644]
m4/nls.m4 [new file with mode: 0644]
m4/po.m4 [new file with mode: 0644]
m4/progtest.m4 [new file with mode: 0644]
missing [new file with mode: 0755]
permission-store/Makefile.am.inc [new file with mode: 0644]
permission-store/org.freedesktop.impl.portal.PermissionStore.service.in [new file with mode: 0644]
permission-store/permission-store.c [new file with mode: 0644]
permission-store/xdg-permission-store.c [new file with mode: 0644]
permission-store/xdg-permission-store.h [new file with mode: 0644]
permission-store/xdg-permission-store.service.in [new file with mode: 0644]
po/LINGUAS [new file with mode: 0644]
po/Makefile.in.in [new file with mode: 0644]
po/Makevars [new file with mode: 0644]
po/POTFILES.in [new file with mode: 0644]
po/Rules-quot [new file with mode: 0644]
po/boldquot.sed [new file with mode: 0644]
po/cs.gmo [new file with mode: 0644]
po/cs.po [new file with mode: 0644]
po/de.gmo [new file with mode: 0644]
po/de.po [new file with mode: 0644]
po/en@boldquot.header [new file with mode: 0644]
po/en@quot.header [new file with mode: 0644]
po/es.gmo [new file with mode: 0644]
po/es.po [new file with mode: 0644]
po/flatpak.pot [new file with mode: 0644]
po/gl.gmo [new file with mode: 0644]
po/gl.po [new file with mode: 0644]
po/hu.gmo [new file with mode: 0644]
po/hu.po [new file with mode: 0644]
po/id.gmo [new file with mode: 0644]
po/id.po [new file with mode: 0644]
po/insert-header.sin [new file with mode: 0644]
po/pl.gmo [new file with mode: 0644]
po/pl.po [new file with mode: 0644]
po/pt_BR.gmo [new file with mode: 0644]
po/pt_BR.po [new file with mode: 0644]
po/quot.sed [new file with mode: 0644]
po/remove-potcdate.sin [new file with mode: 0644]
po/ru.gmo [new file with mode: 0644]
po/ru.po [new file with mode: 0644]
po/sk.gmo [new file with mode: 0644]
po/sk.po [new file with mode: 0644]
po/stamp-po [new file with mode: 0644]
po/sv.gmo [new file with mode: 0644]
po/sv.po [new file with mode: 0644]
po/tr.gmo [new file with mode: 0644]
po/tr.po [new file with mode: 0644]
po/uk.gmo [new file with mode: 0644]
po/uk.po [new file with mode: 0644]
profile/flatpak.sh.in [new file with mode: 0644]
scripts/flatpak-bisect [new file with mode: 0755]
session-helper/Makefile.am.inc [new file with mode: 0644]
session-helper/flatpak-session-helper.c [new file with mode: 0644]
session-helper/flatpak-session-helper.service.in [new file with mode: 0644]
session-helper/org.freedesktop.Flatpak.service.in [new file with mode: 0644]
system-helper/Makefile.am.inc [new file with mode: 0644]
system-helper/flatpak-system-helper.c [new file with mode: 0644]
system-helper/flatpak-system-helper.service.in [new file with mode: 0644]
system-helper/org.freedesktop.Flatpak.SystemHelper.conf [new file with mode: 0644]
system-helper/org.freedesktop.Flatpak.SystemHelper.service.in [new file with mode: 0644]
system-helper/org.freedesktop.Flatpak.policy.in [new file with mode: 0644]
system-helper/org.freedesktop.Flatpak.rules.in [new file with mode: 0644]
test-driver [new file with mode: 0755]
tests/Makefile.am.inc [new file with mode: 0644]
tests/dbs/no_tables [new file with mode: 0644]
tests/flatpak.supp [new file with mode: 0644]
tests/glib.supp [new file with mode: 0644]
tests/libtest.sh [new file with mode: 0644]
tests/make-test-app.sh [new file with mode: 0755]
tests/make-test-bundles.sh [new file with mode: 0755]
tests/make-test-runtime.sh [new file with mode: 0755]
tests/org.test.Hello.png [new file with mode: 0644]
tests/package_version.txt [new file with mode: 0644]
tests/session.conf.in [new file with mode: 0644]
tests/test-basic.sh [new file with mode: 0755]
tests/test-bundle-system.sh [new file with mode: 0755]
tests/test-bundle.sh [new file with mode: 0755]
tests/test-doc-portal.c [new file with mode: 0644]
tests/test-extensions.sh [new file with mode: 0755]
tests/test-keyring/README [new file with mode: 0644]
tests/test-keyring/pubring.gpg [new file with mode: 0644]
tests/test-keyring/secring.gpg [new file with mode: 0644]
tests/test-keyring2/README [new file with mode: 0644]
tests/test-keyring2/pubring.gpg [new file with mode: 0644]
tests/test-keyring2/secring.gpg [new file with mode: 0644]
tests/test-oci.sh [new file with mode: 0755]
tests/test-repo-collections-server-only.sh [new file with mode: 0755]
tests/test-repo-collections.sh [new file with mode: 0755]
tests/test-repo-system.sh [new file with mode: 0755]
tests/test-repo.sh [new file with mode: 0755]
tests/test-run-deltas.sh [new file with mode: 0755]
tests/test-run-system-deltas.sh [new file with mode: 0755]
tests/test-run-system.sh [new file with mode: 0755]
tests/test-run.sh [new file with mode: 0755]
tests/test-unsigned-summaries.sh [new file with mode: 0755]
tests/test-update-remote-configuration.sh [new file with mode: 0755]
tests/test-webserver.sh [new file with mode: 0755]
tests/testdb.c [new file with mode: 0644]
tests/testlibrary.c [new file with mode: 0644]
triggers/desktop-database.trigger [new file with mode: 0755]
triggers/gtk-icon-cache.trigger [new file with mode: 0755]
triggers/mime-database.trigger [new file with mode: 0755]

diff --git a/ABOUT-NLS b/ABOUT-NLS
new file mode 100644 (file)
index 0000000..b1de1b6
--- /dev/null
+++ b/ABOUT-NLS
@@ -0,0 +1,1282 @@
+1 Notes on the Free Translation Project
+***************************************
+
+Free software is going international!  The Free Translation Project is
+a way to get maintainers of free software, translators, and users all
+together, so that free software will gradually become able to speak many
+languages.  A few packages already provide translations for their
+messages.
+
+   If you found this `ABOUT-NLS' file inside a distribution, you may
+assume that the distributed package does use GNU `gettext' internally,
+itself available at your nearest GNU archive site.  But you do _not_
+need to install GNU `gettext' prior to configuring, installing or using
+this package with messages translated.
+
+   Installers will find here some useful hints.  These notes also
+explain how users should proceed for getting the programs to use the
+available translations.  They tell how people wanting to contribute and
+work on translations can contact the appropriate team.
+
+1.1 INSTALL Matters
+===================
+
+Some packages are "localizable" when properly installed; the programs
+they contain can be made to speak your own native language.  Most such
+packages use GNU `gettext'.  Other packages have their own ways to
+internationalization, predating GNU `gettext'.
+
+   By default, this package will be installed to allow translation of
+messages.  It will automatically detect whether the system already
+provides the GNU `gettext' functions.  Installers may use special
+options at configuration time for changing the default behaviour.  The
+command:
+
+     ./configure --disable-nls
+
+will _totally_ disable translation of messages.
+
+   When you already have GNU `gettext' installed on your system and run
+configure without an option for your new package, `configure' will
+probably detect the previously built and installed `libintl' library
+and will decide to use it.  If not, you may have to to use the
+`--with-libintl-prefix' option to tell `configure' where to look for it.
+
+   Internationalized packages usually have many `po/LL.po' files, where
+LL gives an ISO 639 two-letter code identifying the language.  Unless
+translations have been forbidden at `configure' time by using the
+`--disable-nls' switch, all available translations are installed
+together with the package.  However, the environment variable `LINGUAS'
+may be set, prior to configuration, to limit the installed set.
+`LINGUAS' should then contain a space separated list of two-letter
+codes, stating which languages are allowed.
+
+1.2 Using This Package
+======================
+
+As a user, if your language has been installed for this package, you
+only have to set the `LANG' environment variable to the appropriate
+`LL_CC' combination.  If you happen to have the `LC_ALL' or some other
+`LC_xxx' environment variables set, you should unset them before
+setting `LANG', otherwise the setting of `LANG' will not have the
+desired effect.  Here `LL' is an ISO 639 two-letter language code, and
+`CC' is an ISO 3166 two-letter country code.  For example, let's
+suppose that you speak German and live in Germany.  At the shell
+prompt, merely execute `setenv LANG de_DE' (in `csh'),
+`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
+This can be done from your `.login' or `.profile' file, once and for
+all.
+
+   You might think that the country code specification is redundant.
+But in fact, some languages have dialects in different countries.  For
+example, `de_AT' is used for Austria, and `pt_BR' for Brazil.  The
+country code serves to distinguish the dialects.
+
+   The locale naming convention of `LL_CC', with `LL' denoting the
+language and `CC' denoting the country, is the one use on systems based
+on GNU libc.  On other systems, some variations of this scheme are
+used, such as `LL' or `LL_CC.ENCODING'.  You can get the list of
+locales supported by your system for your language by running the
+command `locale -a | grep '^LL''.
+
+   Not all programs have translations for all languages.  By default, an
+English message is shown in place of a nonexistent translation.  If you
+understand other languages, you can set up a priority list of languages.
+This is done through a different environment variable, called
+`LANGUAGE'.  GNU `gettext' gives preference to `LANGUAGE' over `LANG'
+for the purpose of message handling, but you still need to have `LANG'
+set to the primary language; this is required by other parts of the
+system libraries.  For example, some Swedish users who would rather
+read translations in German than English for when Swedish is not
+available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
+
+   Special advice for Norwegian users: The language code for Norwegian
+bokma*l changed from `no' to `nb' recently (in 2003).  During the
+transition period, while some message catalogs for this language are
+installed under `nb' and some older ones under `no', it's recommended
+for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
+older translations are used.
+
+   In the `LANGUAGE' environment variable, but not in the `LANG'
+environment variable, `LL_CC' combinations can be abbreviated as `LL'
+to denote the language's main dialect.  For example, `de' is equivalent
+to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
+(Portuguese as spoken in Portugal) in this context.
+
+1.3 Translating Teams
+=====================
+
+For the Free Translation Project to be a success, we need interested
+people who like their own language and write it well, and who are also
+able to synergize with other translators speaking the same language.
+Each translation team has its own mailing list.  The up-to-date list of
+teams can be found at the Free Translation Project's homepage,
+`http://translationproject.org/', in the "Teams" area.
+
+   If you'd like to volunteer to _work_ at translating messages, you
+should become a member of the translating team for your own language.
+The subscribing address is _not_ the same as the list itself, it has
+`-request' appended.  For example, speakers of Swedish can send a
+message to `sv-request@li.org', having this message body:
+
+     subscribe
+
+   Keep in mind that team members are expected to participate
+_actively_ in translations, or at solving translational difficulties,
+rather than merely lurking around.  If your team does not exist yet and
+you want to start one, or if you are unsure about what to do or how to
+get started, please write to `coordinator@translationproject.org' to
+reach the coordinator for all translator teams.
+
+   The English team is special.  It works at improving and uniformizing
+the terminology in use.  Proven linguistic skills are praised more than
+programming skills, here.
+
+1.4 Available Packages
+======================
+
+Languages are not equally supported in all packages.  The following
+matrix shows the current state of internationalization, as of June
+2010.  The matrix shows, in regard of each package, for which languages
+PO files have been submitted to translation coordination, with a
+translation percentage of at least 50%.
+
+     Ready PO files       af am an ar as ast az be be@latin bg bn_IN bs ca
+                        +--------------------------------------------------+
+     a2ps               |                       []                      [] |
+     aegis              |                                                  |
+     ant-phone          |                                                  |
+     anubis             |                                                  |
+     aspell             |                []                             [] |
+     bash               |                                                  |
+     bfd                |                                                  |
+     bibshelf           |                []                                |
+     binutils           |                                                  |
+     bison              |                                                  |
+     bison-runtime      |                []                                |
+     bluez-pin          | []             []                                |
+     bombono-dvd        |                                                  |
+     buzztard           |                                                  |
+     cflow              |                                                  |
+     clisp              |                                                  |
+     coreutils          |                                   []          [] |
+     cpio               |                                                  |
+     cppi               |                                                  |
+     cpplib             |                                               [] |
+     cryptsetup         |                                                  |
+     dfarc              |                                                  |
+     dialog             |                             []                [] |
+     dico               |                                                  |
+     diffutils          |                                               [] |
+     dink               |                                                  |
+     doodle             |                                                  |
+     e2fsprogs          |                                               [] |
+     enscript           |                                               [] |
+     exif               |                                                  |
+     fetchmail          |                                               [] |
+     findutils          |                                   []             |
+     flex               |                                               [] |
+     freedink           |                                                  |
+     gas                |                                                  |
+     gawk               |                []                             [] |
+     gcal               |                                               [] |
+     gcc                |                                                  |
+     gettext-examples   | []             []                 []          [] |
+     gettext-runtime    |                                   []          [] |
+     gettext-tools      |                                   []          [] |
+     gip                |                                   []             |
+     gjay               |                                                  |
+     gliv               |                                   []             |
+     glunarclock        |                []                 []             |
+     gnubiff            |                                                  |
+     gnucash            |                                               [] |
+     gnuedu             |                                                  |
+     gnulib             |                                                  |
+     gnunet             |                                                  |
+     gnunet-gtk         |                                                  |
+     gnutls             |                                                  |
+     gold               |                                                  |
+     gpe-aerial         |                                                  |
+     gpe-beam           |                                                  |
+     gpe-bluetooth      |                                                  |
+     gpe-calendar       |                                                  |
+     gpe-clock          |                []                                |
+     gpe-conf           |                                                  |
+     gpe-contacts       |                                                  |
+     gpe-edit           |                                                  |
+     gpe-filemanager    |                                                  |
+     gpe-go             |                                                  |
+     gpe-login          |                                                  |
+     gpe-ownerinfo      |                []                                |
+     gpe-package        |                                                  |
+     gpe-sketchbook     |                                                  |
+     gpe-su             |                []                                |
+     gpe-taskmanager    |                []                                |
+     gpe-timesheet      |                []                                |
+     gpe-today          |                []                                |
+     gpe-todo           |                                                  |
+     gphoto2            |                                                  |
+     gprof              |                                   []             |
+     gpsdrive           |                                                  |
+     gramadoir          |                                                  |
+     grep               |                                                  |
+     grub               |                []                             [] |
+     gsasl              |                                                  |
+     gss                |                                                  |
+     gst-plugins-bad    |                                   []             |
+     gst-plugins-base   |                                   []             |
+     gst-plugins-good   |                                   []             |
+     gst-plugins-ugly   |                                   []             |
+     gstreamer          | []                                []          [] |
+     gtick              |                                                  |
+     gtkam              |                       []                         |
+     gtkorphan          |                                   []             |
+     gtkspell           | []             []     []                         |
+     gutenprint         |                                                  |
+     hello              |                                   []             |
+     help2man           |                                                  |
+     hylafax            |                                                  |
+     idutils            |                                                  |
+     indent             |                                   []          [] |
+     iso_15924          |                                                  |
+     iso_3166           | []          []        []          []  []   [] [] |
+     iso_3166_2         |                                                  |
+     iso_4217           |                                                  |
+     iso_639            |             [] []     []              []         |
+     iso_639_3          |                                                  |
+     jwhois             |                                                  |
+     kbd                |                                                  |
+     keytouch           |                                               [] |
+     keytouch-editor    |                                                  |
+     keytouch-keyboa... |                                               [] |
+     klavaro            |          []                                      |
+     latrine            |                                                  |
+     ld                 |                                   []             |
+     leafpad            |                                   []          [] |
+     libc               |                                   []          [] |
+     libexif            |                       ()                         |
+     libextractor       |                                                  |
+     libgnutls          |                                                  |
+     libgpewidget       |                                                  |
+     libgpg-error       |                                                  |
+     libgphoto2         |                                                  |
+     libgphoto2_port    |                                                  |
+     libgsasl           |                                                  |
+     libiconv           |                                   []             |
+     libidn             |                                                  |
+     lifelines          |                                                  |
+     liferea            |                             []                [] |
+     lilypond           |                                                  |
+     linkdr             |          []                                      |
+     lordsawar          |                                                  |
+     lprng              |                                                  |
+     lynx               |                                               [] |
+     m4                 |                                                  |
+     mailfromd          |                                                  |
+     mailutils          |                                                  |
+     make               |                                                  |
+     man-db             |                                                  |
+     man-db-manpages    |                                                  |
+     minicom            |                                                  |
+     mkisofs            |                                                  |
+     myserver           |                                                  |
+     nano               |                                   []          [] |
+     opcodes            |                                                  |
+     parted             |                                                  |
+     pies               |                                                  |
+     popt               |                                                  |
+     psmisc             |                                                  |
+     pspp               |                                               [] |
+     pwdutils           |                                                  |
+     radius             |                                               [] |
+     recode             |                       []                      [] |
+     rosegarden         |                                                  |
+     rpm                |                                                  |
+     rush               |                                                  |
+     sarg               |                                                  |
+     screem             |                                                  |
+     scrollkeeper       |                    [] []                      [] |
+     sed                |                []                             [] |
+     sharutils          |                                   []          [] |
+     shishi             |                                                  |
+     skencil            |                                                  |
+     solfege            |                                                  |
+     solfege-manual     |                                                  |
+     soundtracker       |                                                  |
+     sp                 |                                                  |
+     sysstat            |                                                  |
+     tar                |                                   []             |
+     texinfo            |                                                  |
+     tin                |                                                  |
+     unicode-han-tra... |                                                  |
+     unicode-transla... |                                                  |
+     util-linux-ng      |                                               [] |
+     vice               |                                                  |
+     vmm                |                                                  |
+     vorbis-tools       |                                                  |
+     wastesedge         |                                                  |
+     wdiff              |                                                  |
+     wget               |                       []                      [] |
+     wyslij-po          |                                                  |
+     xchat              |                []     []          []          [] |
+     xdg-user-dirs      | []    []    [] []     []    []    []  []      [] |
+     xkeyboard-config   |                                   []          [] |
+                        +--------------------------------------------------+
+                          af am an ar as ast az be be@latin bg bn_IN bs ca
+                           6  0  1  2  3 19   1 10     3    28   3    1 38
+
+                          crh cs da  de  el en en_GB en_ZA eo es et eu fa
+                        +-------------------------------------------------+
+     a2ps               |     [] []  []  []     []            [] []       |
+     aegis              |        []  []                       []          |
+     ant-phone          |        []  ()                                   |
+     anubis             |        []  []                                   |
+     aspell             |     [] []  []         []            []          |
+     bash               |     []                           [] []          |
+     bfd                |                                     []          |
+     bibshelf           |        []  []                       []          |
+     binutils           |                                     []          |
+     bison              |            []  []                               |
+     bison-runtime      |        []  []  []                      []       |
+     bluez-pin          |     [] []  []  []                [] []          |
+     bombono-dvd        |        []                                       |
+     buzztard           |     [] []  []                                   |
+     cflow              |        []  []                                   |
+     clisp              |        []  []     []                []          |
+     coreutils          |     [] []  []                          []       |
+     cpio               |                                                 |
+     cppi               |                                                 |
+     cpplib             |        []  []                       []          |
+     cryptsetup         |            []                                   |
+     dfarc              |        []  []                       []          |
+     dialog             |        []  []                    [] []    []    |
+     dico               |                                                 |
+     diffutils          |     [] []  []  []                [] []          |
+     dink               |        []  []                       []          |
+     doodle             |            []                                   |
+     e2fsprogs          |     []     []                       []          |
+     enscript           |        []  []         []                        |
+     exif               |     () []  []                                   |
+     fetchmail          |     [] []  ()  []     []            []          |
+     findutils          |     [] []  []                                   |
+     flex               |            []                       []          |
+     freedink           |        []  []                       []          |
+     gas                |                                     []          |
+     gawk               |        []  []                       []          |
+     gcal               |                                     []          |
+     gcc                |            []                       []          |
+     gettext-examples   |            []  []                [] []          |
+     gettext-runtime    |        []  []                    [] []          |
+     gettext-tools      |            []                       []    []    |
+     gip                |        []  []                       []    []    |
+     gjay               |            []                                   |
+     gliv               |     [] []  []                                   |
+     glunarclock        |        []  []                                   |
+     gnubiff            |            ()                                   |
+     gnucash            |     []     ()  ()     ()            ()          |
+     gnuedu             |        []                           []          |
+     gnulib             |            []                       []          |
+     gnunet             |                                                 |
+     gnunet-gtk         |        []                                       |
+     gnutls             |     []     []                                   |
+     gold               |                                     []          |
+     gpe-aerial         |     [] []  []                       []          |
+     gpe-beam           |     [] []  []                       []          |
+     gpe-bluetooth      |        []  []                                   |
+     gpe-calendar       |        []                                       |
+     gpe-clock          |     [] []  []                       []          |
+     gpe-conf           |     [] []  []                                   |
+     gpe-contacts       |        []  []                       []          |
+     gpe-edit           |        []  []                                   |
+     gpe-filemanager    |        []  []                       []          |
+     gpe-go             |     [] []  []                       []          |
+     gpe-login          |        []  []                                   |
+     gpe-ownerinfo      |     [] []  []                       []          |
+     gpe-package        |        []  []                       []          |
+     gpe-sketchbook     |     [] []  []                       []          |
+     gpe-su             |     [] []  []                       []          |
+     gpe-taskmanager    |     [] []  []                       []          |
+     gpe-timesheet      |     [] []  []                       []          |
+     gpe-today          |     [] []  []                       []          |
+     gpe-todo           |        []  []                       []          |
+     gphoto2            |     [] []  ()         []            []    []    |
+     gprof              |        []  []                       []          |
+     gpsdrive           |        []                           [] []       |
+     gramadoir          |        []  []                    []             |
+     grep               |     []                                          |
+     grub               |        []  []                                   |
+     gsasl              |            []                                   |
+     gss                |                                                 |
+     gst-plugins-bad    |     [] []  []                       []    []    |
+     gst-plugins-base   |     [] []  []                       []    []    |
+     gst-plugins-good   |     [] []  []  []                   []    []    |
+     gst-plugins-ugly   |     [] []  []  []                   []    []    |
+     gstreamer          |     [] []  []                       []    []    |
+     gtick              |        []  ()                    []             |
+     gtkam              |     [] []  ()                    [] []          |
+     gtkorphan          |     [] []  []                    []             |
+     gtkspell           |     [] []  []  []                [] []    []    |
+     gutenprint         |        []  []         []                        |
+     hello              |        []  []                    [] []          |
+     help2man           |            []                                   |
+     hylafax            |            []                       []          |
+     idutils            |        []  []                                   |
+     indent             |     [] []  []                    [] [] [] []    |
+     iso_15924          |        []      ()                [] []          |
+     iso_3166           | []  [] []  []  ()                [] [] [] ()    |
+     iso_3166_2         |                ()                               |
+     iso_4217           |     [] []  []  ()                   [] []       |
+     iso_639            | []  [] []  []  ()                [] []          |
+     iso_639_3          | []                                              |
+     jwhois             |                                     []          |
+     kbd                |     [] []  []  []                   []          |
+     keytouch           |        []  []                                   |
+     keytouch-editor    |        []  []                                   |
+     keytouch-keyboa... |        []                                       |
+     klavaro            |     [] []  []                    []             |
+     latrine            |        []  ()                                   |
+     ld                 |        []                           []          |
+     leafpad            |     [] []  []  []                   []    []    |
+     libc               |     [] []  []                       []          |
+     libexif            |        []  []         ()                        |
+     libextractor       |                                                 |
+     libgnutls          |     []                                          |
+     libgpewidget       |        []  []                                   |
+     libgpg-error       |     []     []                                   |
+     libgphoto2         |        []  ()                                   |
+     libgphoto2_port    |        []  ()                             []    |
+     libgsasl           |                                                 |
+     libiconv           |     [] []  []                    []    []       |
+     libidn             |     []     []                    []             |
+     lifelines          |        []  ()                                   |
+     liferea            |     []     []  []                   []    []    |
+     lilypond           |     []     []                       []          |
+     linkdr             |        []  []                       []          |
+     lordsawar          |        []                                       |
+     lprng              |                                                 |
+     lynx               |     [] []  []                          []       |
+     m4                 |     [] []  []  []                               |
+     mailfromd          |                                                 |
+     mailutils          |                                     []          |
+     make               |        []  []                       []          |
+     man-db             |                                                 |
+     man-db-manpages    |                                                 |
+     minicom            |     [] []  []                       []          |
+     mkisofs            |                                                 |
+     myserver           |                                                 |
+     nano               |            []                       []    []    |
+     opcodes            |            []                       []          |
+     parted             |     []     []                                   |
+     pies               |                                                 |
+     popt               |     [] []  []                    [] []          |
+     psmisc             |     []     []                             []    |
+     pspp               |                                     []          |
+     pwdutils           |        []                                       |
+     radius             |                                     []          |
+     recode             |     [] []  []  []                [] []          |
+     rosegarden         |     ()     ()                       ()          |
+     rpm                |        []  []                       []          |
+     rush               |                                                 |
+     sarg               |                                                 |
+     screem             |                                                 |
+     scrollkeeper       |     [] []  []         []            []          |
+     sed                |     []     []  []                [] [] []       |
+     sharutils          |        []  []                       [] []       |
+     shishi             |                                                 |
+     skencil            |        []  ()                       []          |
+     solfege            |            []                    []    []       |
+     solfege-manual     |                                  []    []       |
+     soundtracker       |        []  []                       []          |
+     sp                 |            []                                   |
+     sysstat            |        []  []                             []    |
+     tar                |     []     []                          [] []    |
+     texinfo            |            []                    [] []          |
+     tin                |            []                          []       |
+     unicode-han-tra... |                                                 |
+     unicode-transla... |                                                 |
+     util-linux-ng      |     [] []  []                       []          |
+     vice               |        ()  ()                                   |
+     vmm                |            []                                   |
+     vorbis-tools       |     []                           []             |
+     wastesedge         |        []                                       |
+     wdiff              |            []                       []          |
+     wget               |     []     []                          []       |
+     wyslij-po          |                                                 |
+     xchat              |     []     []  []                   [] []       |
+     xdg-user-dirs      | []  [] []  []  []                [] [] [] []    |
+     xkeyboard-config   | []  [] []  []                    [] []          |
+                        +-------------------------------------------------+
+                          crh cs da  de  el en en_GB en_ZA eo es et eu fa
+                           5  64 105 117 18  1   8     0   28 89 18 19  0
+
+                          fi  fr  ga gl gu he hi hr hu hy id  is it ja ka kn
+                        +----------------------------------------------------+
+     a2ps               | []  []                          []        []       |
+     aegis              |     []                                 []          |
+     ant-phone          |     []                                 []          |
+     anubis             | []  []                          []     []          |
+     aspell             |     []  []                      []     []          |
+     bash               | []  []                          []        []       |
+     bfd                | []  []                          []                 |
+     bibshelf           | []  []  []                      []     []          |
+     binutils           | []  []                          []                 |
+     bison              | []  []  []                      []                 |
+     bison-runtime      | []  []  []                      []     [] []       |
+     bluez-pin          | []  []  []                [] [] []  []    []       |
+     bombono-dvd        | []                                                 |
+     buzztard           |                                 []                 |
+     cflow              | []      []                      []                 |
+     clisp              |     []                                             |
+     coreutils          |     []  []                []    []     []          |
+     cpio               | []  []  []                      []                 |
+     cppi               | []  []                                             |
+     cpplib             | []  []                          []                 |
+     cryptsetup         |     []                          []     []          |
+     dfarc              | []  []                                 []          |
+     dialog             |     []  [] []                   []  [] [] []       |
+     dico               |                                                    |
+     diffutils          | []  []  [] []    []       []    []     [] []       |
+     dink               |     []                                             |
+     doodle             |         []                             []          |
+     e2fsprogs          |     []                          []                 |
+     enscript           |     []  []             []       []                 |
+     exif               | []  []                          []  [] [] []       |
+     fetchmail          |     []                          []     [] []       |
+     findutils          | []  []  []                []    []     []          |
+     flex               | []  []  []                                         |
+     freedink           | []  []                          []                 |
+     gas                |     []                          []                 |
+     gawk               |     []  []       []             []     () []       |
+     gcal               |     []                                             |
+     gcc                |                                 []                 |
+     gettext-examples   | []  []  []                []    []     [] []       |
+     gettext-runtime    | []  []  []                      []     [] []       |
+     gettext-tools      |     []                          []     [] []       |
+     gip                | []  []  [] []                   []        []       |
+     gjay               | []                                                 |
+     gliv               | []  ()                                             |
+     glunarclock        | []      []                []    []                 |
+     gnubiff            |     ()                          []     ()          |
+     gnucash            | ()  ()           ()       ()           () []       |
+     gnuedu             |     []                                 []          |
+     gnulib             | []  []  []                []           [] []       |
+     gnunet             |                                                    |
+     gnunet-gtk         |     []                                             |
+     gnutls             |     []                                 []          |
+     gold               | []                              []                 |
+     gpe-aerial         | []  []                          []                 |
+     gpe-beam           | []  []                          []        []       |
+     gpe-bluetooth      | []                              []     [] []       |
+     gpe-calendar       | []                                        []       |
+     gpe-clock          | []  []                    []    []        []       |
+     gpe-conf           | []  []                          []        []       |
+     gpe-contacts       | []  []                          []        []       |
+     gpe-edit           | []                              []        []       |
+     gpe-filemanager    | []                        []    []        []       |
+     gpe-go             | []  []                    []    []        []       |
+     gpe-login          | []                              []        []       |
+     gpe-ownerinfo      | []  []                    []    []        []       |
+     gpe-package        | []                              []        []       |
+     gpe-sketchbook     | []  []                          []        []       |
+     gpe-su             | []  []     []             []    []        []       |
+     gpe-taskmanager    | []  []                    []    []        []       |
+     gpe-timesheet      | []  []  []                      []        []       |
+     gpe-today          | []  []  [] []             []    []        []       |
+     gpe-todo           | []                              []        []       |
+     gphoto2            | []  []                    []    []     [] []       |
+     gprof              | []  []  []                      []                 |
+     gpsdrive           |            []                   []     []          |
+     gramadoir          |     []  []                      []                 |
+     grep               | []                                     []          |
+     grub               | []                        []    []     []          |
+     gsasl              | []  []  []                      []     []          |
+     gss                | []  []  []                      []     []          |
+     gst-plugins-bad    | []  []                    []    []     [] []       |
+     gst-plugins-base   | []  []                    []    []     [] []       |
+     gst-plugins-good   | []  []                    []    []     [] []       |
+     gst-plugins-ugly   | []  []                    []    []     [] []       |
+     gstreamer          | []  []                    []    []     []          |
+     gtick              | []  []  []                      []     []          |
+     gtkam              |     []                    []    []     [] []       |
+     gtkorphan          |     []                          []     []          |
+     gtkspell           | []  []  [] []             [] [] []     [] []       |
+     gutenprint         | []  []                    []           []          |
+     hello              | []      []                      []                 |
+     help2man           | []  []                                             |
+     hylafax            |                                 []                 |
+     idutils            | []  []  []                []    []     []          |
+     indent             | []  []  [] []             []    []     [] []       |
+     iso_15924          | []  ()                          []     []          |
+     iso_3166           | []  ()  [] [] [] [] [] [] []    []     [] []       |
+     iso_3166_2         |     ()                    []    []     []          |
+     iso_4217           | []  ()                    []    []     [] []       |
+     iso_639            | []  ()  []    []          []    []     [] []    [] |
+     iso_639_3          |     ()                                 []       [] |
+     jwhois             | []  []                    []    []     []          |
+     kbd                |     []                          []                 |
+     keytouch           | []  []  []                []    []     []          |
+     keytouch-editor    | []      []                []    []     []          |
+     keytouch-keyboa... | []      []                []    []     []          |
+     klavaro            |            []             []                       |
+     latrine            | []                              []     []          |
+     ld                 | []  []  []                      []                 |
+     leafpad            | []  []  []       []       []    []     [] ()       |
+     libc               | []  []     []                   []        []       |
+     libexif            |                                        []          |
+     libextractor       |                                                    |
+     libgnutls          |     []                                 []          |
+     libgpewidget       | []      []                      []        []       |
+     libgpg-error       |     []                                 []          |
+     libgphoto2         |     []                                 [] []       |
+     libgphoto2_port    |     []                                 [] []       |
+     libgsasl           | []  []  []                      []     []          |
+     libiconv           | []  []  []                      []     [] []       |
+     libidn             | []  []                          []     []          |
+     lifelines          |     ()                                             |
+     liferea            |     []                    []           [] []       |
+     lilypond           | []  []                                             |
+     linkdr             | []               []    [] []           []          |
+     lordsawar          |                                                    |
+     lprng              |                                 []                 |
+     lynx               |     []                    []    []     [] []       |
+     m4                 | []  []  [] []                   []        []       |
+     mailfromd          |                                                    |
+     mailutils          |     []                          []                 |
+     make               | []  []  [] []    []    []       []     [] []       |
+     man-db             |                                 []     []          |
+     man-db-manpages    |                                 []                 |
+     minicom            | []  []                    []    []        []       |
+     mkisofs            | []  []                          []     []          |
+     myserver           |                                                    |
+     nano               | []  []  [] []             []           []          |
+     opcodes            | []  []  []                      []                 |
+     parted             |     []                          []     [] []       |
+     pies               |                                                    |
+     popt               | []  []  [] []             []    []  [] [] []       |
+     psmisc             | []  []                          []                 |
+     pspp               |                                                    |
+     pwdutils           |     []                          []                 |
+     radius             |     []                          []                 |
+     recode             | []  []  [] []    []       []    []     []          |
+     rosegarden         | ()  ()                          ()     () ()       |
+     rpm                |                                 []        []       |
+     rush               |                                                    |
+     sarg               |     []                                             |
+     screem             |                                        [] []       |
+     scrollkeeper       | []                        []    []     []          |
+     sed                | []  []  [] []             []    []     [] []       |
+     sharutils          | []  []  []                []    []     [] []       |
+     shishi             |     []                                             |
+     skencil            |     []                                             |
+     solfege            | []  []     []                          []          |
+     solfege-manual     |     []     []                                      |
+     soundtracker       |     []                                 []          |
+     sp                 |     []                                    ()       |
+     sysstat            | []  []                          []     [] []       |
+     tar                | []  []  []                []    []     [] []       |
+     texinfo            |     []                          []     [] []       |
+     tin                |     []                                             |
+     unicode-han-tra... |                                                    |
+     unicode-transla... |     []  []                                         |
+     util-linux-ng      | []  []                    []    []     [] []       |
+     vice               |     ()                    ()           ()          |
+     vmm                |     []                                             |
+     vorbis-tools       |                                 []                 |
+     wastesedge         |     ()                                 ()          |
+     wdiff              | []                                                 |
+     wget               | []  []  []             [] []    []     [] []       |
+     wyslij-po          | []  []                          []                 |
+     xchat              | []  []        []    []    []    []     [] []    [] |
+     xdg-user-dirs      | []  []  [] [] [] [] []    []    []  [] [] []    [] |
+     xkeyboard-config   | []  []                    []    []     []          |
+                        +----------------------------------------------------+
+                          fi  fr  ga gl gu he hi hr hu hy id  is it ja ka kn
+                          105 121 53 20  4  8  3  5 53  2 120  5 84 67  0  4
+
+                          ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne
+                        +-----------------------------------------------+
+     a2ps               |                               []              |
+     aegis              |                                               |
+     ant-phone          |                                               |
+     anubis             |                               []    []        |
+     aspell             |                         []                    |
+     bash               |                                               |
+     bfd                |                                               |
+     bibshelf           |                []             []              |
+     binutils           |                                               |
+     bison              |                               []              |
+     bison-runtime      |       []    [] []             []    []        |
+     bluez-pin          |    [] []    [] []             []              |
+     bombono-dvd        |                                               |
+     buzztard           |                                               |
+     cflow              |                                               |
+     clisp              |                                               |
+     coreutils          |          []                                   |
+     cpio               |                                               |
+     cppi               |                                               |
+     cpplib             |                                               |
+     cryptsetup         |                                               |
+     dfarc              |                   []                          |
+     dialog             |    []       [] []             []    []        |
+     dico               |                                               |
+     diffutils          |                []             []              |
+     dink               |                                               |
+     doodle             |                                               |
+     e2fsprogs          |                                               |
+     enscript           |                                               |
+     exif               |                []                             |
+     fetchmail          |                                               |
+     findutils          |                                               |
+     flex               |                                               |
+     freedink           |                                     []        |
+     gas                |                                               |
+     gawk               |                                               |
+     gcal               |                                               |
+     gcc                |                                               |
+     gettext-examples   |       []       []             [] []           |
+     gettext-runtime    | []                                            |
+     gettext-tools      | []                                            |
+     gip                |                []             []              |
+     gjay               |                                               |
+     gliv               |                                               |
+     glunarclock        |                []                             |
+     gnubiff            |                                               |
+     gnucash            | ()          ()                      ()     () |
+     gnuedu             |                                               |
+     gnulib             |                                               |
+     gnunet             |                                               |
+     gnunet-gtk         |                                               |
+     gnutls             |                               []              |
+     gold               |                                               |
+     gpe-aerial         |                []                             |
+     gpe-beam           |                []                             |
+     gpe-bluetooth      |                []                []           |
+     gpe-calendar       |                []                             |
+     gpe-clock          | []    []       []             [] []           |
+     gpe-conf           | []             []                             |
+     gpe-contacts       | []             []                             |
+     gpe-edit           |                []                             |
+     gpe-filemanager    | []             []                             |
+     gpe-go             | []             []                []           |
+     gpe-login          |                []                             |
+     gpe-ownerinfo      |                []             []              |
+     gpe-package        | []             []                             |
+     gpe-sketchbook     | []             []                             |
+     gpe-su             | []    []       []             [] [] []        |
+     gpe-taskmanager    | [] [] []       []             [] []           |
+     gpe-timesheet      |                []             []              |
+     gpe-today          |       []       []             [] []           |
+     gpe-todo           |                []                   []        |
+     gphoto2            |                                               |
+     gprof              |                               []              |
+     gpsdrive           |                                               |
+     gramadoir          |                                               |
+     grep               |                                               |
+     grub               |                                               |
+     gsasl              |                                               |
+     gss                |                                               |
+     gst-plugins-bad    |             [] []                [] []        |
+     gst-plugins-base   |             [] []                             |
+     gst-plugins-good   |                []                []           |
+     gst-plugins-ugly   |             [] []             [] [] []        |
+     gstreamer          |                                               |
+     gtick              |                                               |
+     gtkam              |                                     []        |
+     gtkorphan          |                []                      []     |
+     gtkspell           |       []    [] []       []    []    [] []     |
+     gutenprint         |                                               |
+     hello              | []             []             []              |
+     help2man           |                                               |
+     hylafax            |                                               |
+     idutils            |                                               |
+     indent             |                                               |
+     iso_15924          |             [] []                             |
+     iso_3166           | [] []       () [] [] []    []       []        |
+     iso_3166_2         |                                               |
+     iso_4217           |             []                      []        |
+     iso_639            |                      []    []                 |
+     iso_639_3          |                            []                 |
+     jwhois             |                []                             |
+     kbd                |                                               |
+     keytouch           |                []                             |
+     keytouch-editor    |                []                             |
+     keytouch-keyboa... |                []                             |
+     klavaro            |                                     []        |
+     latrine            |                []                             |
+     ld                 |                                               |
+     leafpad            | []          [] []                             |
+     libc               | []                                            |
+     libexif            |                                               |
+     libextractor       |                                               |
+     libgnutls          |                               []              |
+     libgpewidget       |                []             []              |
+     libgpg-error       |                                               |
+     libgphoto2         |                                               |
+     libgphoto2_port    |                                               |
+     libgsasl           |                                               |
+     libiconv           |                                               |
+     libidn             |                                               |
+     lifelines          |                                               |
+     liferea            |                                               |
+     lilypond           |                                               |
+     linkdr             |                                               |
+     lordsawar          |                                               |
+     lprng              |                                               |
+     lynx               |                                               |
+     m4                 |                                               |
+     mailfromd          |                                               |
+     mailutils          |                                               |
+     make               | []                                            |
+     man-db             |                                               |
+     man-db-manpages    |                                               |
+     minicom            |                                     []        |
+     mkisofs            |                                               |
+     myserver           |                                               |
+     nano               |                               []    []        |
+     opcodes            |                                               |
+     parted             |                                               |
+     pies               |                                               |
+     popt               | []             []                   []        |
+     psmisc             |                                               |
+     pspp               |                                               |
+     pwdutils           |                                               |
+     radius             |                                               |
+     recode             |                                               |
+     rosegarden         |                                               |
+     rpm                |                                               |
+     rush               |                                               |
+     sarg               |                                               |
+     screem             |                                               |
+     scrollkeeper       |                                     []     [] |
+     sed                |                                               |
+     sharutils          |                                               |
+     shishi             |                                               |
+     skencil            |                                               |
+     solfege            |                                     []        |
+     solfege-manual     |                                               |
+     soundtracker       |                                               |
+     sp                 |                                               |
+     sysstat            |                []                             |
+     tar                |       []                                      |
+     texinfo            |                                     []        |
+     tin                |                                               |
+     unicode-han-tra... |                                               |
+     unicode-transla... |                                               |
+     util-linux-ng      |                                               |
+     vice               |                                               |
+     vmm                |                                               |
+     vorbis-tools       |                                               |
+     wastesedge         |                                               |
+     wdiff              |                                               |
+     wget               |             []                                |
+     wyslij-po          |                                               |
+     xchat              | []             [] []                          |
+     xdg-user-dirs      | [] []       [] [] []       []       [] []     |
+     xkeyboard-config   | []    []    []                                |
+                        +-----------------------------------------------+
+                          ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne
+                          20  5 10  1 13 48  4  2  2  4 24 10 20  3   1
+
+                          nl  nn or pa pl  ps pt pt_BR ro ru rw sk sl sq sr
+                        +---------------------------------------------------+
+     a2ps               | []           []     []  []   [] []       []    [] |
+     aegis              | []                      []      []                |
+     ant-phone          |                         []   []                   |
+     anubis             | []           []                 []                |
+     aspell             | []                           [] []    [] []       |
+     bash               | []                                    []          |
+     bfd                |                                 []                |
+     bibshelf           | []  []                                            |
+     binutils           |                                 []    []          |
+     bison              | []           []                 []                |
+     bison-runtime      | []           []     []  []   [] []       []       |
+     bluez-pin          | []           []         []   [] []    [] []    [] |
+     bombono-dvd        |     []                          ()                |
+     buzztard           | []  []                                            |
+     cflow              |              []                                   |
+     clisp              | []                              []                |
+     coreutils          | []           []     []  []      []       []       |
+     cpio               | []           []                 []                |
+     cppi               |              []                                   |
+     cpplib             | []                                                |
+     cryptsetup         | []                                                |
+     dfarc              |              []                                   |
+     dialog             | []           []         []      []                |
+     dico               |              []                                   |
+     diffutils          | []           []         []   [] []             [] |
+     dink               | ()                                                |
+     doodle             | []                                          []    |
+     e2fsprogs          | []           []                                   |
+     enscript           | []                      []   [] []       []       |
+     exif               | []           []              [] ()    []          |
+     fetchmail          | []           []                 []          []    |
+     findutils          | []           []     []          []       []       |
+     flex               | []           []         []   [] []                |
+     freedink           | []           []                                   |
+     gas                |                                                   |
+     gawk               | []           []         []   []                   |
+     gcal               |                                                   |
+     gcc                |                                                [] |
+     gettext-examples   | []           []     []       [] []    [] []    [] |
+     gettext-runtime    | []  []       []     []       [] []    [] []    [] |
+     gettext-tools      |              []              [] []    [] []    [] |
+     gip                | []           []                 []    []       [] |
+     gjay               |                                                   |
+     gliv               | []           []         []   [] []    []          |
+     glunarclock        | []                      []   []       []       [] |
+     gnubiff            | []                           ()                   |
+     gnucash            | []           ()         ()      ()                |
+     gnuedu             | []                                                |
+     gnulib             | []           []                 []       []       |
+     gnunet             |                                                   |
+     gnunet-gtk         |                                                   |
+     gnutls             | []           []                                   |
+     gold               |                                                   |
+     gpe-aerial         | []                  []  []   [] []       []    [] |
+     gpe-beam           | []                  []  []   [] []       []    [] |
+     gpe-bluetooth      | []                      []                        |
+     gpe-calendar       |                         []      []       []    [] |
+     gpe-clock          | []                  []  []   [] []    [] []    [] |
+     gpe-conf           | []                  []  []   [] []    [] []       |
+     gpe-contacts       |                         []   [] []       []    [] |
+     gpe-edit           | []           []                          []       |
+     gpe-filemanager    | []                              []       []       |
+     gpe-go             | []           []         []   [] []    [] []    [] |
+     gpe-login          | []                      []                        |
+     gpe-ownerinfo      | []                  []  []   [] []    [] []    [] |
+     gpe-package        | []                                       []       |
+     gpe-sketchbook     | []                  []  []   [] []       []    [] |
+     gpe-su             | []                  []  []   [] []    [] []    [] |
+     gpe-taskmanager    | []                  []  []   [] []    [] []    [] |
+     gpe-timesheet      | []                  []  []   [] []    [] []    [] |
+     gpe-today          | []                  []  []   [] []    [] []    [] |
+     gpe-todo           | []                      []      []       []    [] |
+     gphoto2            | []        [] []         []   [] []    []       [] |
+     gprof              | []                      []   []                   |
+     gpsdrive           | []                              []                |
+     gramadoir          | []                                    []          |
+     grep               | []           []                 []    []          |
+     grub               | []           []                 []                |
+     gsasl              | []           []                       []       [] |
+     gss                |              []              []       []          |
+     gst-plugins-bad    | []           []         []      []    []    []    |
+     gst-plugins-base   | []           []         []      []    []          |
+     gst-plugins-good   | []           []         []      []    []          |
+     gst-plugins-ugly   | []           []         []      []    [] []       |
+     gstreamer          | []           []         []      []    []          |
+     gtick              | []                              []    []          |
+     gtkam              | []        [] []         []      []    []          |
+     gtkorphan          | []                                                |
+     gtkspell           | []           []     []  []   [] []    [] [] [] [] |
+     gutenprint         | []                              []                |
+     hello              | []           []                       [] []       |
+     help2man           |              []                 []                |
+     hylafax            | []                                                |
+     idutils            | []           []         []   [] []                |
+     indent             | []           []         []   [] []    []       [] |
+     iso_15924          | []           []                 []       []       |
+     iso_3166           | []  [] [] [] []     ()  []   [] [] [] [] [] [] [] |
+     iso_3166_2         | []           []                          []       |
+     iso_4217           | []  []       []     []          [] []    []    [] |
+     iso_639            | []     [] [] []                 [] [] [] []    [] |
+     iso_639_3          |        [] []                                      |
+     jwhois             | []           []         []   []                   |
+     kbd                | []           []              []                   |
+     keytouch           | []           []                       []          |
+     keytouch-editor    | []           []                       []          |
+     keytouch-keyboa... | []           []                       []          |
+     klavaro            | []                      []                        |
+     latrine            |              []                 []                |
+     ld                 |                                                   |
+     leafpad            | []  []       []     []  []      []    [] []    [] |
+     libc               | []           []                 []    []          |
+     libexif            | []           []         ()            []          |
+     libextractor       |                                                   |
+     libgnutls          | []           []                                   |
+     libgpewidget       | []           []                          []       |
+     libgpg-error       |              []              []                   |
+     libgphoto2         | []           []                                   |
+     libgphoto2_port    | []           []         []      []    []          |
+     libgsasl           | []           []              []       []       [] |
+     libiconv           | []           []                       [] []    [] |
+     libidn             | []           []                                   |
+     lifelines          | []           []                                   |
+     liferea            | []           []     []  []   [] ()    ()    []    |
+     lilypond           | []                                                |
+     linkdr             | []                  []          []                |
+     lordsawar          |                                                   |
+     lprng              |              []                                   |
+     lynx               | []                      []      []                |
+     m4                 | []           []         []   [] []                |
+     mailfromd          |              []                                   |
+     mailutils          |              []                                   |
+     make               | []           []         []      []                |
+     man-db             | []           []                 []                |
+     man-db-manpages    | []           []                 []                |
+     minicom            |              []         []   [] []                |
+     mkisofs            | []           []                 []                |
+     myserver           |                                                   |
+     nano               | []           []         []      []                |
+     opcodes            | []                           []                   |
+     parted             | []           []                 []    []          |
+     pies               |              []                                   |
+     popt               | []           []     []          []                |
+     psmisc             | []           []                 []                |
+     pspp               | []                      []                        |
+     pwdutils           |              []                                   |
+     radius             | []           []                 []                |
+     recode             | []           []     []  []   [] []    [] []       |
+     rosegarden         |              ()                 ()                |
+     rpm                | []           []     []                            |
+     rush               | []           []                                   |
+     sarg               |                                                   |
+     screem             |                                                   |
+     scrollkeeper       | []  []       []              [] []    []    [] [] |
+     sed                | []           []     []  []   [] []    [] []    [] |
+     sharutils          | []           []                 []             [] |
+     shishi             |              []                                   |
+     skencil            |                     []  []                        |
+     solfege            | []           []         []      []                |
+     solfege-manual     | []           []         []                        |
+     soundtracker       |                                       []          |
+     sp                 |                                                   |
+     sysstat            | []           []         []      []                |
+     tar                | []           []                 []       []       |
+     texinfo            | []           []              [] []                |
+     tin                |                                 []                |
+     unicode-han-tra... |                                                   |
+     unicode-transla... |                                                   |
+     util-linux-ng      | []           []         []      []       []       |
+     vice               | []                                                |
+     vmm                | []                                                |
+     vorbis-tools       | []           []                                   |
+     wastesedge         | []                                                |
+     wdiff              | []           []                                   |
+     wget               | []           []     []  []      []    [] []       |
+     wyslij-po          | []  []       []                                   |
+     xchat              | []        [] []     []          []    [] [] [] [] |
+     xdg-user-dirs      | []  [] [] [] []  [] []  []   [] []    [] [] [] [] |
+     xkeyboard-config   | []           []                 []                |
+                        +---------------------------------------------------+
+                          nl  nn or pa pl  ps pt pt_BR ro ru rw sk sl sq sr
+                          135 10  4  7 105  1 29  62   47 91  3 54 46  9 37
+
+                          sv  sw ta te tg th tr uk vi  wa zh_CN zh_HK zh_TW
+                        +---------------------------------------------------+
+     a2ps               | []              [] [] [] []                       | 27
+     aegis              |                          []                       |  9
+     ant-phone          | []                 []    []      []               |  9
+     anubis             | []                 [] [] []                       | 15
+     aspell             |                       [] []  []                   | 20
+     bash               | []                    [] []                       | 12
+     bfd                |                          []                       |  6
+     bibshelf           | []                       []      []               | 16
+     binutils           |                       [] []                       |  8
+     bison              | []                       []                       | 12
+     bison-runtime      | []              []    [] []      []          []   | 29
+     bluez-pin          | []              [] [] [] []  []  []          []   | 37
+     bombono-dvd        |                          []                       |  4
+     buzztard           |                          []                       |  7
+     cflow              |                       [] []      []               |  9
+     clisp              |                                                   | 10
+     coreutils          | []                    [] []      []               | 22
+     cpio               | []                 [] [] []      []          []   | 13
+     cppi               |                       [] []                       |  5
+     cpplib             | []                 [] [] []      []          []   | 14
+     cryptsetup         | []                       []                       |  7
+     dfarc              |                          []                       |  9
+     dialog             | []  []          []       []  []  []          []   | 30
+     dico               |                       []                          |  2
+     diffutils          | []                 [] [] []      []          []   | 30
+     dink               |                                                   |  4
+     doodle             | []                       []                       |  7
+     e2fsprogs          | []                 []    []                       | 11
+     enscript           | []                 [] [] []                       | 17
+     exif               | []                       []      []               | 16
+     fetchmail          |                    []    []      []               | 17
+     findutils          | []                 [] [] []      []               | 20
+     flex               | []                 []    []                  []   | 15
+     freedink           |                          []                       | 10
+     gas                |                    []                             |  4
+     gawk               | []                 []    []      []               | 18
+     gcal               | []                 []                             |  5
+     gcc                | []                 []            []               |  7
+     gettext-examples   | []                 [] [] []      []    []    []   | 34
+     gettext-runtime    | []                 [] [] []      []    []    []   | 29
+     gettext-tools      | []                 [] [] []      []          []   | 22
+     gip                | []                       []      []          []   | 22
+     gjay               |                          []                       |  3
+     gliv               | []                 []    []                       | 14
+     glunarclock        | []                       []  []  []          []   | 19
+     gnubiff            | []                       []                       |  4
+     gnucash            |                    () [] ()      []          ()   | 10
+     gnuedu             |                          []                  []   |  7
+     gnulib             | []                    [] []      []               | 16
+     gnunet             |                          []                       |  1
+     gnunet-gtk         | []                 []    []                       |  5
+     gnutls             | []                       []      []               | 10
+     gold               |                          []                       |  4
+     gpe-aerial         | []                       []      []               | 18
+     gpe-beam           | []                       []      []               | 19
+     gpe-bluetooth      | []                       []      []               | 13
+     gpe-calendar       | []                       []  []  []               | 12
+     gpe-clock          | []                 []    []  []  []               | 28
+     gpe-conf           | []                       []  []  []               | 20
+     gpe-contacts       | []                       []      []               | 17
+     gpe-edit           | []                       []      []               | 12
+     gpe-filemanager    | []                       []  []  []               | 16
+     gpe-go             | []                 []    []  []  []               | 25
+     gpe-login          | []                       []      []               | 11
+     gpe-ownerinfo      | []                 []    []      []          []   | 25
+     gpe-package        | []                       []      []               | 13
+     gpe-sketchbook     | []                       []      []               | 20
+     gpe-su             | []                 []    []  []  []               | 30
+     gpe-taskmanager    | []                 []    []  []  []               | 29
+     gpe-timesheet      | []                 []    []      []          []   | 25
+     gpe-today          | []                 []    []  []  []          []   | 30
+     gpe-todo           | []                       []  []  []               | 17
+     gphoto2            | []                    [] []      []          []   | 24
+     gprof              | []                 []    []                       | 15
+     gpsdrive           | []                       []      []               | 11
+     gramadoir          | []                       []      []               | 11
+     grep               |                 []       []      []               | 10
+     grub               | []                       []      []               | 14
+     gsasl              | []                       []      []          []   | 14
+     gss                | []                       []      []               | 11
+     gst-plugins-bad    | []                 []    []      []               | 26
+     gst-plugins-base   | []                 [] [] []      []               | 24
+     gst-plugins-good   | []                 []    []      []               | 24
+     gst-plugins-ugly   | []                 [] [] []      []               | 29
+     gstreamer          | []                    [] []      []               | 22
+     gtick              |                       [] []      []               | 13
+     gtkam              | []                       []      []               | 20
+     gtkorphan          | []                       []      []               | 14
+     gtkspell           | []              [] [] [] []  []  []    []    []   | 45
+     gutenprint         | []                                                | 10
+     hello              | []              [] []    []      []          []   | 21
+     help2man           | []                       []                       |  7
+     hylafax            |                          []                       |  5
+     idutils            | []                 []    []      []               | 17
+     indent             | []                 [] [] []      []          []   | 30
+     iso_15924          |                 ()    [] ()      []          []   | 16
+     iso_3166           | []        []    () [] [] ()  []  []    []    ()   | 53
+     iso_3166_2         |                 ()    [] ()      []               |  9
+     iso_4217           | []              () [] [] ()      []    []         | 26
+     iso_639            | []     [] []    ()    [] ()  []  []    []    []   | 38
+     iso_639_3          |        []                ()                       |  8
+     jwhois             | []                 []    []      []          []   | 16
+     kbd                | []                 [] [] []      []               | 15
+     keytouch           | []                       []      []               | 16
+     keytouch-editor    | []                       []      []               | 14
+     keytouch-keyboa... | []                       []      []               | 14
+     klavaro            |                          []                       | 11
+     latrine            |                    []    []      []               | 10
+     ld                 | []                 []    []                  []   | 11
+     leafpad            | []                 [] [] []      []          []   | 33
+     libc               | []                 []    []      []          []   | 21
+     libexif            |                          []      ()               |  7
+     libextractor       |                          []                       |  1
+     libgnutls          | []                       []      []               |  9
+     libgpewidget       | []                       []      []               | 14
+     libgpg-error       | []                       []      []               |  9
+     libgphoto2         |                       [] []                       |  8
+     libgphoto2_port    | []                    [] []                  []   | 14
+     libgsasl           | []                       []      []               | 13
+     libiconv           | []                       []  []  []               | 21
+     libidn             | ()                       []      []               | 11
+     lifelines          | []                                                |  4
+     liferea            | []                 []            []               | 21
+     lilypond           |                          []                       |  7
+     linkdr             | []                 []    []      []          []   | 17
+     lordsawar          |                                                   |  1
+     lprng              |                          []                       |  3
+     lynx               | []                 [] [] []                       | 17
+     m4                 | []                       []      []          []   | 19
+     mailfromd          |                       [] []                       |  3
+     mailutils          |                          []                       |  5
+     make               | []                 []    []      []               | 21
+     man-db             | []                       []      []               |  8
+     man-db-manpages    |                                                   |  4
+     minicom            | []                       []                       | 16
+     mkisofs            |                          []      []               |  9
+     myserver           |                                                   |  0
+     nano               | []                       []      []          []   | 21
+     opcodes            | []                 []    []                       | 11
+     parted             | []                 [] [] []                  []   | 15
+     pies               |                       [] []                       |  3
+     popt               | []              [] []    []      []          []   | 27
+     psmisc             | []                       []                       | 11
+     pspp               |                                                   |  4
+     pwdutils           | []                       []                       |  6
+     radius             |                       [] []                       |  9
+     recode             | []                 []    []      []               | 28
+     rosegarden         | ()                                                |  0
+     rpm                | []                       []                  []   | 11
+     rush               |                       [] []                       |  4
+     sarg               |                                                   |  1
+     screem             |                          []                       |  3
+     scrollkeeper       | []                 [] [] []                  []   | 27
+     sed                | []                 []    []      []          []   | 30
+     sharutils          | []                 []    []      []          []   | 22
+     shishi             |                          []                       |  3
+     skencil            | []                       []                       |  7
+     solfege            | []                 []    []      []               | 16
+     solfege-manual     |                    []                             |  8
+     soundtracker       | []                 []    []                       |  9
+     sp                 |                    []                             |  3
+     sysstat            |                          []      []               | 15
+     tar                | []                 [] [] []      []          []   | 23
+     texinfo            | []                 [] [] []      []               | 17
+     tin                |                                                   |  4
+     unicode-han-tra... |                                                   |  0
+     unicode-transla... |                                                   |  2
+     util-linux-ng      | []                 [] [] []                       | 20
+     vice               | ()                 ()                             |  1
+     vmm                |                          []                       |  4
+     vorbis-tools       |                          []                       |  6
+     wastesedge         |                                                   |  2
+     wdiff              | []                       []                       |  7
+     wget               | []                 []    []      []          []   | 26
+     wyslij-po          |                       [] []                       |  8
+     xchat              | []              []    [] []      []          []   | 36
+     xdg-user-dirs      | []     [] []    [] [] [] []      []    []    []   | 63
+     xkeyboard-config   | []                    [] []                       | 22
+                        +---------------------------------------------------+
+       85 teams           sv  sw ta te tg th tr uk vi  wa zh_CN zh_HK zh_TW
+      178 domains         119  1  3  3  0 10 65 51 155 17  98     7    41    2618
+
+   Some counters in the preceding matrix are higher than the number of
+visible blocks let us expect.  This is because a few extra PO files are
+used for implementing regional variants of languages, or language
+dialects.
+
+   For a PO file in the matrix above to be effective, the package to
+which it applies should also have been internationalized and
+distributed as such by its maintainer.  There might be an observable
+lag between the mere existence a PO file and its wide availability in a
+distribution.
+
+   If June 2010 seems to be old, you may fetch a more recent copy of
+this `ABOUT-NLS' file on most GNU archive sites.  The most up-to-date
+matrix with full percentage details can be found at
+`http://translationproject.org/extra/matrix.html'.
+
+1.5 Using `gettext' in new packages
+===================================
+
+If you are writing a freely available program and want to
+internationalize it you are welcome to use GNU `gettext' in your
+package.  Of course you have to respect the GNU Library General Public
+License which covers the use of the GNU `gettext' library.  This means
+in particular that even non-free programs can use `libintl' as a shared
+library, whereas only free software can use `libintl' as a static
+library or use modified versions of `libintl'.
+
+   Once the sources are changed appropriately and the setup can handle
+the use of `gettext' the only thing missing are the translations.  The
+Free Translation Project is also available for packages which are not
+developed inside the GNU project.  Therefore the information given above
+applies also for every other Free Software Project.  Contact
+`coordinator@translationproject.org' to make the `.pot' files available
+to the translation teams.
+
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..4362b49
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..96b83ab
--- /dev/null
@@ -0,0 +1,168 @@
+NULL =
+
+bin_PROGRAMS = $(NULL)
+dist_installed_test_extra_scripts = $(NULL)
+noinst_PROGRAMS = $(NULL)
+noinst_LTLIBRARIES = $(NULL)
+libexec_PROGRAMS = $(NULL)
+CLEANFILES = $(NULL)
+MAINTAINERCLEANFILES = $(NULL)
+DISTCLEANFILES= $(NULL)
+BUILT_SOURCES = $(NULL)
+EXTRA_DIST =
+
+include $(top_srcdir)/buildutil/glib-tap.mk
+
+SUBDIRS =
+
+
+if BUILD_DOCUMENTATION
+SUBDIRS += . doc
+endif
+
+SUBDIRS += po
+
+%.service: %.service.in config.log
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" \
+               -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@extraargs\@||" $< > $@
+
+dbus_servicedir = $(DBUS_SERVICE_DIR)
+service_in_files = $(NULL)
+dbus_service_DATA = $(NULL)
+systemduserunit_DATA = $(NULL)
+CLEANFILES += $(dbus_service_DATA)
+CLEANFILES += $(systemduserunit_DATA)
+EXTRA_DIST += $(service_in_files)
+
+FLATPAK_BINDIR=$(bindir)
+
+ACLOCAL_AMFLAGS = -I m4 -I libglnx ${ACLOCAL_FLAGS}
+AM_CPPFLAGS =                                                  \
+       -DFLATPAK_BINDIR=\"$(FLATPAK_BINDIR)\"                  \
+       -DFLATPAK_SYSTEMDIR=\"$(SYSTEM_INSTALL_DIR)\"           \
+       -DFLATPAK_CONFIGDIR=\"$(sysconfdir)/flatpak\"           \
+       -DFLATPAK_BASEDIR=\"$(pkgdatadir)\"                     \
+       -DFLATPAK_TRIGGERDIR=\"$(pkgdatadir)/triggers\"         \
+       -DSYSTEM_FONTS_DIR=\"$(SYSTEM_FONTS_DIR)\"              \
+       -DSYSTEM_FONT_CACHE_DIRS=\"$(SYSTEM_FONT_CACHE_DIRS)\"          \
+       -DDBUSPROXY=\"$(libexecdir)/flatpak-dbus-proxy\"        \
+       -DG_LOG_DOMAIN=\"flatpak\"                              \
+       -I$(srcdir)/libglnx                                     \
+       -I$(srcdir)/common                                      \
+       -I$(builddir)/common                                    \
+       -I$(srcdir)/lib                                         \
+       -I$(builddir)/lib                                       \
+       -include "config.h"                                     \
+       $(NULL)
+
+AM_CFLAGS = $(WARN_CFLAGS)
+
+if WITH_SYSTEM_BWRAP
+AM_CPPFLAGS += -DHELPER=\"$(BWRAP)\"
+else
+AM_CPPFLAGS += -DHELPER=\"$(libexecdir)/flatpak-bwrap\"
+endif
+
+triggersdir = $(pkgdatadir)/triggers
+dist_triggers_SCRIPTS = \
+       triggers/gtk-icon-cache.trigger \
+       triggers/mime-database.trigger \
+       triggers/desktop-database.trigger \
+       $(NULL)
+
+# This canonicalizes the PKG_CHECK_MODULES or AM_PATH_GPGME results
+INTERNAL_GPGME_CFLAGS = $(DEP_GPGME_CFLAGS) $(GPGME_PTHREAD_CFLAGS)
+INTERNAL_GPGME_LIBS = $(DEP_GPGME_LIBS) $(GPGME_PTHREAD_LIBS)
+
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES += libglnx.la
+libglnx_srcpath := $(srcdir)/libglnx
+libglnx_cflags := \
+       $(BASE_CFLAGS) \
+       "-I$(libglnx_srcpath)" \
+       -std=gnu99 \
+       $(HIDDEN_VISIBILITY_CFLAGS) \
+       $(NULL)
+libglnx_libs := $(BASE_LIBS)
+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 system-helper/Makefile.am.inc
+include dbus-proxy/Makefile.am.inc
+include permission-store/Makefile.am.inc
+include document-portal/Makefile.am.inc
+include tests/Makefile.am.inc
+
+if !WITH_SYSTEM_BWRAP
+
+bwrap_PROGRAMS = flatpak-bwrap
+flatpak_bwrap_SOURCES = $(bwrap_SOURCES)
+flatpak_bwrap_CFLAGS = $(AM_CFLAGS) $(bwrap_CFLAGS)
+flatpak_bwrap_LDADD = $(AM_LDADD) $(bwrap_LDADD)
+bwrapdir = $(libexecdir)
+include bubblewrap/Makefile-bwrap.am.inc
+
+endif # !WITH_SYSTEM_BWRAP
+
+# NOTE: bwrap is install-bwrapPROGS which is run from install-data, not install-exec, this data-hook is used
+install-data-hook:
+       $(MAKE) $(AM_MAKEFLAGS) install-test-data-hook
+if !WITH_SYSTEM_BWRAP
+if PRIV_MODE_SETUID
+       $(SUDO_BIN) chown root $(DESTDIR)$(libexecdir)/flatpak-bwrap
+       $(SUDO_BIN) chmod u+s $(DESTDIR)$(libexecdir)/flatpak-bwrap
+endif # !PRIV_MODE_SETUID
+endif # !WITH_SYSTEM_BWRAP
+
+completiondir = $(datadir)/bash-completion/completions
+completion_DATA = completion/flatpak
+EXTRA_DIST += $(completion_DATA)
+
+profiledir = $(PROFILE_DIR)
+profile_DATA = flatpak.sh
+EXTRA_DIST += \
+       profile/flatpak.sh.in \
+       $(NULL)
+DISTCLEANFILES += flatpak.sh
+
+flatpak.sh: profile/flatpak.sh.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+envdir = $(datadir)/gdm/env.d
+env_DATA = flatpak.env
+EXTRA_DIST += env.d/flatpak.env.in
+DISTCLEANFILES += flatpak.env
+
+flatpak.env: env.d/flatpak.env.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+dbussnippetdir = $(systemduserunitdir)/dbus.service.d
+dbussnippet_DATA = flatpak.conf
+EXTRA_DIST += dbus.service.d/flatpak.conf.in
+DISTCLEANFILES += flatpak.conf
+
+flatpak.conf: dbus.service.d/flatpak.conf.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = flatpak.pc
+EXTRA_DIST += flatpak.pc.in
+
+scriptsdir = $(bindir)
+scripts_SCRIPTS = scripts/flatpak-bisect
+EXTRA_DIST += scripts/flatpak-bisect
+
+EXTRA_DIST += README.md
+
+AM_DISTCHECK_CONFIGURE_FLAGS =         \
+       --enable-documentation          \
+       --disable-maintainer-mode       \
+       --enable-introspection
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..3cb37fd
--- /dev/null
@@ -0,0 +1,5232 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# GLIB - Library of useful C routines
+
+# Copyright (C) 2015 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \  ]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = $(am__EXEEXT_1) flatpak$(EXEEXT) $(am__EXEEXT_1)
+noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_8) \
+       test-libflatpak$(EXEEXT)
+libexec_PROGRAMS = $(am__EXEEXT_1) flatpak-session-helper$(EXEEXT) \
+       $(am__EXEEXT_1) $(am__EXEEXT_7) flatpak-dbus-proxy$(EXEEXT) \
+       $(am__EXEEXT_1) xdg-permission-store$(EXEEXT) $(am__EXEEXT_1) \
+       xdg-document-portal$(EXEEXT) $(am__EXEEXT_1)
+TESTS = $(am__EXEEXT_2) $(am__EXEEXT_9) $(am__EXEEXT_5)
+installed_test_PROGRAMS = $(am__EXEEXT_6)
+check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5)
+@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_1 = $(all_test_ltlibs)
+@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_2 = $(all_test_programs)
+@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_3 = $(all_test_scripts)
+@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_4 = $(all_test_data)
+@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_5 = $(all_test_ltlibs)
+@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_6 = $(all_test_programs)
+@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_7 = $(all_test_scripts)
+@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_8 = $(all_test_data)
+@ENABLE_INSTALLED_TESTS_TRUE@am__append_9 = $(test_programs) $(installed_test_programs) \
+@ENABLE_INSTALLED_TESTS_TRUE@                          $(test_extra_programs) $(installed_test_extra_programs)
+
+@ENABLE_INSTALLED_TESTS_TRUE@am__append_10 = $(test_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(installed_test_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(test_extra_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(test_installed_extra_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_test_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_test_extra_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_installed_test_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_installed_test_extra_scripts)
+@ENABLE_INSTALLED_TESTS_TRUE@am__append_11 = $(test_data) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(installed_test_data) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_test_data) \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(dist_installed_test_data)
+@ENABLE_INSTALLED_TESTS_TRUE@am__append_12 = $(test_ltlibraries) $(installed_test_ltlibraries)
+@ENABLE_INSTALLED_TESTS_TRUE@am__append_13 = $(installed_test_meta_DATA)
+@BUILD_DOCUMENTATION_TRUE@am__append_14 = . doc
+@WITH_SYSTEM_BWRAP_TRUE@am__append_15 = -DHELPER=\"$(BWRAP)\"
+@WITH_SYSTEM_BWRAP_FALSE@am__append_16 = -DHELPER=\"$(libexecdir)/flatpak-bwrap\"
+@HAVE_INTROSPECTION_TRUE@am__append_17 = Flatpak-1.0.gir
+@HAVE_INTROSPECTION_TRUE@am__append_18 = $(nodist_gir_DATA) \
+@HAVE_INTROSPECTION_TRUE@      $(nodist_typelib_DATA)
+@BUILD_SYSTEM_HELPER_TRUE@am__append_19 = \
+@BUILD_SYSTEM_HELPER_TRUE@     flatpak-system-helper \
+@BUILD_SYSTEM_HELPER_TRUE@     $(NULL)
+
+@BUILD_SYSTEM_HELPER_TRUE@am__append_20 = system-helper/org.freedesktop.Flatpak.SystemHelper.service.in \
+@BUILD_SYSTEM_HELPER_TRUE@     system-helper/flatpak-system-helper.service.in
+@BUILD_SYSTEM_HELPER_TRUE@am__append_21 = system-helper/org.freedesktop.Flatpak.policy system-helper/org.freedesktop.Flatpak.rules system-helper/flatpak-system-helper.service system-helper/org.freedesktop.Flatpak.SystemHelper.service
+@WITH_SYSTEM_BWRAP_TRUE@am__append_22 = FLATPAK_BWRAP=$(BWRAP)
+@WITH_SYSTEM_BWRAP_FALSE@am__append_23 = FLATPAK_BWRAP=$$(cd $(top_builddir) && pwd)/flatpak-bwrap
+@WITH_SYSTEM_BWRAP_FALSE@bwrap_PROGRAMS = flatpak-bwrap$(EXEEXT)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libglnx/libglnx.m4 \
+       $(top_srcdir)/m4/attributes.m4 $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/glibtests.m4 $(top_srcdir)/m4/gtk-doc.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+       $(am__configure_deps) $(dist_triggers_SCRIPTS) \
+       $(am__dist_dbusconf_DATA_DIST) \
+       $(am__dist_installed_test_dbs_DATA_DIST) \
+       $(am__dist_installed_test_keyring_DATA_DIST) \
+       $(am__dist_installed_test_keyring2_DATA_DIST) \
+       $(flatpakinclude_HEADERS) $(am__DIST_COMMON)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = flatpak.pc lib/flatpak-version-macros.h
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(installed_testdir)" \
+       "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+       "$(DESTDIR)$(bwrapdir)" "$(DESTDIR)$(installed_testdir)" \
+       "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(triggersdir)" \
+       "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(scriptsdir)" \
+       "$(DESTDIR)$(completiondir)" "$(DESTDIR)$(dbus_servicedir)" \
+       "$(DESTDIR)$(dbussnippetdir)" \
+       "$(DESTDIR)$(dbussystemservicedir)" "$(DESTDIR)$(dbusconfdir)" \
+       "$(DESTDIR)$(installed_test_dbsdir)" \
+       "$(DESTDIR)$(installed_test_keyringdir)" \
+       "$(DESTDIR)$(installed_test_keyring2dir)" \
+       "$(DESTDIR)$(envdir)" "$(DESTDIR)$(installed_testdir)" \
+       "$(DESTDIR)$(installed_test_metadir)" \
+       "$(DESTDIR)$(introspectiondir)" \
+       "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(girdir)" \
+       "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(pkgconfigdir)" \
+       "$(DESTDIR)$(polkit_policydir)" "$(DESTDIR)$(polkit_rulesdir)" \
+       "$(DESTDIR)$(profiledir)" "$(DESTDIR)$(systemdsystemunitdir)" \
+       "$(DESTDIR)$(systemduserunitdir)" \
+       "$(DESTDIR)$(flatpakincludedir)" \
+       "$(DESTDIR)$(flatpakincludedir)"
+LTLIBRARIES = $(installed_test_LTLIBRARIES) $(lib_LTLIBRARIES) \
+       $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+libflatpak_common_la_DEPENDENCIES = libglnx.la $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__dirstamp = $(am__leading_dot)dirstamp
+am__objects_1 =
+am_libflatpak_common_la_OBJECTS =  \
+       common/libflatpak_common_la-flatpak-dir.lo \
+       common/libflatpak_common_la-flatpak-run.lo \
+       common/libflatpak_common_la-flatpak-portal-error.lo \
+       common/libflatpak_common_la-flatpak-utils.lo \
+       common/libflatpak_common_la-flatpak-table-printer.lo \
+       common/libflatpak_common_la-flatpak-chain-input-stream.lo \
+       common/gvdb/libflatpak_common_la-gvdb-reader.lo \
+       common/gvdb/libflatpak_common_la-gvdb-builder.lo \
+       common/libflatpak_common_la-flatpak-db.lo \
+       common/libflatpak_common_la-flatpak-json.lo \
+       common/libflatpak_common_la-flatpak-json-oci.lo \
+       common/libflatpak_common_la-flatpak-oci-registry.lo \
+       $(am__objects_1)
+am__objects_2 = common/libflatpak_common_la-flatpak-dbus.lo
+am__objects_3 = common/libflatpak_common_la-flatpak-systemd-dbus.lo
+am__objects_4 = document-portal/libflatpak_common_la-xdp-dbus.lo
+nodist_libflatpak_common_la_OBJECTS = $(am__objects_2) \
+       $(am__objects_3) $(am__objects_4) $(am__objects_1)
+libflatpak_common_la_OBJECTS = $(am_libflatpak_common_la_OBJECTS) \
+       $(nodist_libflatpak_common_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
+libflatpak_common_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(libflatpak_common_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+libflatpak_la_DEPENDENCIES = libflatpak-common.la \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1)
+am_libflatpak_la_OBJECTS = lib/libflatpak_la-flatpak.lo \
+       lib/libflatpak_la-flatpak-ref.lo \
+       lib/libflatpak_la-flatpak-installed-ref.lo \
+       lib/libflatpak_la-flatpak-remote-ref.lo \
+       lib/libflatpak_la-flatpak-bundle-ref.lo \
+       lib/libflatpak_la-flatpak-related-ref.lo \
+       lib/libflatpak_la-flatpak-remote.lo \
+       lib/libflatpak_la-flatpak-error.lo \
+       lib/libflatpak_la-flatpak-installation.lo $(am__objects_1)
+nodist_libflatpak_la_OBJECTS =  \
+       lib/libflatpak_la-flatpak-enum-types.lo $(am__objects_1)
+libflatpak_la_OBJECTS = $(am_libflatpak_la_OBJECTS) \
+       $(nodist_libflatpak_la_OBJECTS)
+libflatpak_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libflatpak_la_CFLAGS) \
+       $(CFLAGS) $(libflatpak_la_LDFLAGS) $(LDFLAGS) -o $@
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
+libglnx_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
+am_libglnx_la_OBJECTS = libglnx/libglnx_la-glnx-backports.lo \
+       libglnx/libglnx_la-glnx-local-alloc.lo \
+       libglnx/libglnx_la-glnx-errors.lo \
+       libglnx/libglnx_la-glnx-console.lo \
+       libglnx/libglnx_la-glnx-dirfd.lo \
+       libglnx/libglnx_la-glnx-fdio.lo \
+       libglnx/libglnx_la-glnx-lockfile.lo \
+       libglnx/libglnx_la-glnx-xattrs.lo \
+       libglnx/libglnx_la-glnx-shutil.lo $(am__objects_1)
+libglnx_la_OBJECTS = $(am_libglnx_la_OBJECTS)
+libglnx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libglnx_la_CFLAGS) \
+       $(CFLAGS) $(libglnx_la_LDFLAGS) $(LDFLAGS) -o $@
+am__EXEEXT_1 =
+am__EXEEXT_2 = testdb$(EXEEXT) test-doc-portal$(EXEEXT) \
+       testlibrary$(EXEEXT)
+am__EXEEXT_3 = $(am__EXEEXT_2)
+@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__EXEEXT_4 = $(am__EXEEXT_3)
+am__EXEEXT_5 = test-libglnx-xattrs$(EXEEXT) test-libglnx-fdio$(EXEEXT) \
+       test-libglnx-errors$(EXEEXT) test-libglnx-macros$(EXEEXT) \
+       test-libglnx-shutil$(EXEEXT)
+@ENABLE_INSTALLED_TESTS_TRUE@am__EXEEXT_6 = $(am__EXEEXT_2)
+@BUILD_SYSTEM_HELPER_TRUE@am__EXEEXT_7 =  \
+@BUILD_SYSTEM_HELPER_TRUE@     flatpak-system-helper$(EXEEXT) \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__EXEEXT_1)
+@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__EXEEXT_8 = $(am__EXEEXT_3)
+PROGRAMS = $(bin_PROGRAMS) $(bwrap_PROGRAMS) \
+       $(installed_test_PROGRAMS) $(libexec_PROGRAMS) \
+       $(noinst_PROGRAMS)
+am_flatpak_OBJECTS = app/flatpak-flatpak-main.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-utils.$(OBJEXT) \
+       app/flatpak-flatpak-transaction.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-add-remote.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-delete-remote.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-list-remotes.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-ls-remote.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-info-remote.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-install.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-override.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-make-current.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-update.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-uninstall.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-list.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-info.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-config.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-run.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-enter.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-init.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-finish.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-export.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-bundle.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-import-bundle.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-commit-from.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-build-sign.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-repo-update.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-repo.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-document-export.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-document-unexport.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-document-info.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-document-list.$(OBJEXT) \
+       app/flatpak-flatpak-builtins-search.$(OBJEXT) $(am__objects_1)
+flatpak_OBJECTS = $(am_flatpak_OBJECTS)
+flatpak_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) libglnx.la libflatpak-common.la
+flatpak_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(flatpak_CFLAGS) \
+       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am__flatpak_bwrap_SOURCES_DIST = bubblewrap/bubblewrap.c \
+       bubblewrap/bind-mount.h bubblewrap/bind-mount.c \
+       bubblewrap/network.h bubblewrap/network.c bubblewrap/utils.h \
+       bubblewrap/utils.c
+@WITH_SYSTEM_BWRAP_FALSE@am__objects_5 = bubblewrap/flatpak_bwrap-bubblewrap.$(OBJEXT) \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/flatpak_bwrap-bind-mount.$(OBJEXT) \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/flatpak_bwrap-network.$(OBJEXT) \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/flatpak_bwrap-utils.$(OBJEXT) \
+@WITH_SYSTEM_BWRAP_FALSE@      $(am__objects_1)
+@WITH_SYSTEM_BWRAP_FALSE@am_flatpak_bwrap_OBJECTS = $(am__objects_5)
+flatpak_bwrap_OBJECTS = $(am_flatpak_bwrap_OBJECTS)
+@WITH_SYSTEM_BWRAP_FALSE@flatpak_bwrap_DEPENDENCIES =  \
+@WITH_SYSTEM_BWRAP_FALSE@      $(am__DEPENDENCIES_1)
+flatpak_bwrap_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(flatpak_bwrap_CFLAGS) \
+       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_flatpak_dbus_proxy_OBJECTS =  \
+       dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.$(OBJEXT) \
+       dbus-proxy/flatpak_dbus_proxy-dbus-proxy.$(OBJEXT) \
+       $(am__objects_1)
+flatpak_dbus_proxy_OBJECTS = $(am_flatpak_dbus_proxy_OBJECTS)
+flatpak_dbus_proxy_DEPENDENCIES = $(am__DEPENDENCIES_1) libglnx.la
+flatpak_dbus_proxy_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_flatpak_session_helper_OBJECTS = session-helper/flatpak_session_helper-flatpak-session-helper.$(OBJEXT) \
+       $(am__objects_1)
+flatpak_session_helper_OBJECTS = $(am_flatpak_session_helper_OBJECTS)
+flatpak_session_helper_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       libflatpak-common.la
+flatpak_session_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(flatpak_session_helper_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am__flatpak_system_helper_SOURCES_DIST =  \
+       system-helper/flatpak-system-helper.c lib/flatpak-error.c
+@BUILD_SYSTEM_HELPER_TRUE@am_flatpak_system_helper_OBJECTS = system-helper/flatpak_system_helper-flatpak-system-helper.$(OBJEXT) \
+@BUILD_SYSTEM_HELPER_TRUE@     lib/flatpak_system_helper-flatpak-error.$(OBJEXT) \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__objects_1)
+flatpak_system_helper_OBJECTS = $(am_flatpak_system_helper_OBJECTS)
+@BUILD_SYSTEM_HELPER_TRUE@flatpak_system_helper_DEPENDENCIES =  \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__DEPENDENCIES_1) \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__DEPENDENCIES_1) \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__DEPENDENCIES_1) \
+@BUILD_SYSTEM_HELPER_TRUE@     $(am__DEPENDENCIES_1) \
+@BUILD_SYSTEM_HELPER_TRUE@     libflatpak-common.la
+flatpak_system_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(flatpak_system_helper_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_test_doc_portal_OBJECTS =  \
+       tests/test_doc_portal-test-doc-portal.$(OBJEXT)
+am__objects_6 = document-portal/test_doc_portal-xdp-dbus.$(OBJEXT)
+nodist_test_doc_portal_OBJECTS = $(am__objects_6)
+test_doc_portal_OBJECTS = $(am_test_doc_portal_OBJECTS) \
+       $(nodist_test_doc_portal_OBJECTS)
+test_doc_portal_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) libglnx.la libflatpak-common.la \
+       $(am__DEPENDENCIES_1)
+test_doc_portal_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_doc_portal_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+       -o $@
+am_test_libflatpak_OBJECTS = lib/test_libflatpak-test-lib.$(OBJEXT) \
+       $(am__objects_1)
+test_libflatpak_OBJECTS = $(am_test_libflatpak_OBJECTS)
+test_libflatpak_DEPENDENCIES = $(am__DEPENDENCIES_1) libflatpak.la \
+       $(am__DEPENDENCIES_1)
+test_libflatpak_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libflatpak_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+       -o $@
+am_test_libglnx_errors_OBJECTS = libglnx/tests/test_libglnx_errors-test-libglnx-errors.$(OBJEXT)
+test_libglnx_errors_OBJECTS = $(am_test_libglnx_errors_OBJECTS)
+test_libglnx_errors_DEPENDENCIES = $(am__DEPENDENCIES_3) libglnx.la
+test_libglnx_errors_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libglnx_errors_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_test_libglnx_fdio_OBJECTS =  \
+       libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.$(OBJEXT)
+test_libglnx_fdio_OBJECTS = $(am_test_libglnx_fdio_OBJECTS)
+test_libglnx_fdio_DEPENDENCIES = $(am__DEPENDENCIES_3) libglnx.la
+test_libglnx_fdio_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libglnx_fdio_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+       -o $@
+am_test_libglnx_macros_OBJECTS = libglnx/tests/test_libglnx_macros-test-libglnx-macros.$(OBJEXT)
+test_libglnx_macros_OBJECTS = $(am_test_libglnx_macros_OBJECTS)
+test_libglnx_macros_DEPENDENCIES = $(am__DEPENDENCIES_3) libglnx.la
+test_libglnx_macros_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libglnx_macros_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_test_libglnx_shutil_OBJECTS = libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.$(OBJEXT)
+test_libglnx_shutil_OBJECTS = $(am_test_libglnx_shutil_OBJECTS)
+test_libglnx_shutil_DEPENDENCIES = $(am__DEPENDENCIES_3) libglnx.la
+test_libglnx_shutil_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libglnx_shutil_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_test_libglnx_xattrs_OBJECTS = libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.$(OBJEXT)
+test_libglnx_xattrs_OBJECTS = $(am_test_libglnx_xattrs_OBJECTS)
+test_libglnx_xattrs_DEPENDENCIES = $(am__DEPENDENCIES_3) libglnx.la
+test_libglnx_xattrs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_testdb_OBJECTS = tests/testdb-testdb.$(OBJEXT)
+testdb_OBJECTS = $(am_testdb_OBJECTS)
+testdb_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       libglnx.la libflatpak-common.la $(am__DEPENDENCIES_1)
+testdb_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testdb_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_testlibrary_OBJECTS = tests/testlibrary-testlibrary.$(OBJEXT)
+testlibrary_OBJECTS = $(am_testlibrary_OBJECTS)
+testlibrary_DEPENDENCIES = $(am__DEPENDENCIES_1) libglnx.la \
+       libflatpak.la $(am__DEPENDENCIES_1)
+testlibrary_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testlibrary_CFLAGS) \
+       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_xdg_document_portal_OBJECTS =  \
+       document-portal/xdg_document_portal-xdp-main.$(OBJEXT) \
+       document-portal/xdg_document_portal-xdp-util.$(OBJEXT) \
+       document-portal/xdg_document_portal-xdp-fuse.$(OBJEXT) \
+       $(am__objects_1)
+am__objects_7 =  \
+       document-portal/xdg_document_portal-xdp-dbus.$(OBJEXT)
+am__objects_8 = permission-store/xdg_document_portal-permission-store-dbus.$(OBJEXT)
+am__objects_9 = $(am__objects_8)
+nodist_xdg_document_portal_OBJECTS = $(am__objects_7) $(am__objects_9) \
+       $(am__objects_1)
+xdg_document_portal_OBJECTS = $(am_xdg_document_portal_OBJECTS) \
+       $(nodist_xdg_document_portal_OBJECTS)
+xdg_document_portal_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) libflatpak-common.la
+xdg_document_portal_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(xdg_document_portal_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am_xdg_permission_store_OBJECTS = permission-store/xdg_permission_store-permission-store.$(OBJEXT) \
+       permission-store/xdg_permission_store-xdg-permission-store.$(OBJEXT) \
+       $(am__objects_1)
+nodist_xdg_permission_store_OBJECTS = permission-store/xdg_permission_store-permission-store-dbus.$(OBJEXT)
+xdg_permission_store_OBJECTS = $(am_xdg_permission_store_OBJECTS) \
+       $(nodist_xdg_permission_store_OBJECTS)
+xdg_permission_store_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       libflatpak-common.la
+xdg_permission_store_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(xdg_permission_store_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SCRIPTS = $(dist_triggers_SCRIPTS) $(installed_test_SCRIPTS) \
+       $(noinst_SCRIPTS) $(scripts_SCRIPTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
+SOURCES = $(libflatpak_common_la_SOURCES) \
+       $(nodist_libflatpak_common_la_SOURCES) \
+       $(libflatpak_la_SOURCES) $(nodist_libflatpak_la_SOURCES) \
+       $(libglnx_la_SOURCES) $(flatpak_SOURCES) \
+       $(flatpak_bwrap_SOURCES) $(flatpak_dbus_proxy_SOURCES) \
+       $(flatpak_session_helper_SOURCES) \
+       $(flatpak_system_helper_SOURCES) $(test_doc_portal_SOURCES) \
+       $(nodist_test_doc_portal_SOURCES) $(test_libflatpak_SOURCES) \
+       $(test_libglnx_errors_SOURCES) $(test_libglnx_fdio_SOURCES) \
+       $(test_libglnx_macros_SOURCES) $(test_libglnx_shutil_SOURCES) \
+       $(test_libglnx_xattrs_SOURCES) $(testdb_SOURCES) \
+       $(testlibrary_SOURCES) $(xdg_document_portal_SOURCES) \
+       $(nodist_xdg_document_portal_SOURCES) \
+       $(xdg_permission_store_SOURCES) \
+       $(nodist_xdg_permission_store_SOURCES)
+DIST_SOURCES = $(libflatpak_common_la_SOURCES) \
+       $(libflatpak_la_SOURCES) $(libglnx_la_SOURCES) \
+       $(flatpak_SOURCES) $(am__flatpak_bwrap_SOURCES_DIST) \
+       $(flatpak_dbus_proxy_SOURCES) \
+       $(flatpak_session_helper_SOURCES) \
+       $(am__flatpak_system_helper_SOURCES_DIST) \
+       $(test_doc_portal_SOURCES) $(test_libflatpak_SOURCES) \
+       $(test_libglnx_errors_SOURCES) $(test_libglnx_fdio_SOURCES) \
+       $(test_libglnx_macros_SOURCES) $(test_libglnx_shutil_SOURCES) \
+       $(test_libglnx_xattrs_SOURCES) $(testdb_SOURCES) \
+       $(testlibrary_SOURCES) $(xdg_document_portal_SOURCES) \
+       $(xdg_permission_store_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+       ctags-recursive dvi-recursive html-recursive info-recursive \
+       install-data-recursive install-dvi-recursive \
+       install-exec-recursive install-html-recursive \
+       install-info-recursive install-pdf-recursive \
+       install-ps-recursive install-recursive installcheck-recursive \
+       installdirs-recursive pdf-recursive ps-recursive \
+       tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__dist_dbusconf_DATA_DIST =  \
+       system-helper/org.freedesktop.Flatpak.SystemHelper.conf
+am__dist_installed_test_dbs_DATA_DIST = tests/dbs/no_tables
+am__dist_installed_test_keyring_DATA_DIST = tests/test-keyring/README \
+       tests/test-keyring/pubring.gpg tests/test-keyring/secring.gpg
+am__dist_installed_test_keyring2_DATA_DIST =  \
+       tests/test-keyring2/README tests/test-keyring2/pubring.gpg \
+       tests/test-keyring2/secring.gpg
+DATA = $(completion_DATA) $(dbus_service_DATA) $(dbussnippet_DATA) \
+       $(dbussystemservice_DATA) $(dist_dbusconf_DATA) \
+       $(dist_installed_test_dbs_DATA) \
+       $(dist_installed_test_keyring_DATA) \
+       $(dist_installed_test_keyring2_DATA) $(env_DATA) \
+       $(installed_test_DATA) $(installed_test_meta_DATA) \
+       $(introspection_DATA) $(nobase_installed_test_DATA) \
+       $(nodist_gir_DATA) $(nodist_typelib_DATA) $(noinst_DATA) \
+       $(pkgconfig_DATA) $(polkit_policy_DATA) $(polkit_rules_DATA) \
+       $(profile_DATA) $(systemdsystemunit_DATA) \
+       $(systemduserunit_DATA)
+HEADERS = $(flatpakinclude_HEADERS) $(nodist_flatpakinclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+       cscope check recheck distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+       $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red='\e[0;31m'; \
+    grn='\e[0;32m'; \
+    lgn='\e[1;32m'; \
+    blu='\e[1;34m'; \
+    mgn='\e[0;35m'; \
+    brg='\e[1m'; \
+    std='\e[m'; \
+  fi; \
+}
+am__recheck_rx = ^[    ]*:recheck:[    ]*
+am__global_test_result_rx = ^[         ]*:global-test-result:[         ]*
+am__copy_in_global_log_rx = ^[         ]*:copy-in-global-log:[         ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+  recheck = 1; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+        { \
+          if ((getline line2 < ($$0 ".log")) < 0) \
+           recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+        { \
+          recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+        { \
+          break; \
+        } \
+    }; \
+  if (recheck) \
+    print $$0; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+  print "fatal: making $@: " msg | "cat >&2"; \
+  exit 1; \
+} \
+function rst_section(header) \
+{ \
+  print header; \
+  len = length(header); \
+  for (i = 1; i <= len; i = i + 1) \
+    printf "="; \
+  printf "\n\n"; \
+} \
+{ \
+  copy_in_global_log = 1; \
+  global_test_result = "RUN"; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+         fatal("failed to read from " $$0 ".trs"); \
+      if (line ~ /$(am__global_test_result_rx)/) \
+        { \
+          sub("$(am__global_test_result_rx)", "", line); \
+          sub("[       ]*$$", "", line); \
+          global_test_result = line; \
+        } \
+      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+        copy_in_global_log = 0; \
+    }; \
+  if (copy_in_global_log) \
+    { \
+      rst_section(global_test_result ": " $$0); \
+      while ((rc = (getline line < ($$0 ".log"))) != 0) \
+      { \
+        if (rc < 0) \
+          fatal("failed to read from " $$0 ".log"); \
+        print line; \
+      }; \
+      printf "\n"; \
+    }; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test.  Creates the
+# directory for the log if needed.  Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log.  Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup);                                     \
+$(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
+srcdir=$(srcdir); export srcdir;                       \
+case "$@" in                                           \
+  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;   \
+    *) am__odir=.;;                                    \
+esac;                                                  \
+test "x$$am__odir" = x"." || test -d "$$am__odir"      \
+  || $(MKDIR_P) "$$am__odir" || exit $$?;              \
+if test -f "./$$f"; then dir=./;                       \
+elif test -f "$$f"; then dir=;                         \
+else dir="$(srcdir)/"; fi;                             \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
+case " $(XFAIL_TESTS) " in                             \
+  *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed).  The result is saved in the shell variable
+# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+  bases='$(TEST_LOGS)'; \
+  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+  bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+am__EXEEXT_9 = tests/test-basic.sh tests/test-run.sh \
+       tests/test-run-system.sh tests/test-run-deltas.sh \
+       tests/test-run-system-deltas.sh tests/test-repo.sh \
+       tests/test-repo-collections.sh \
+       tests/test-repo-collections-server-only.sh \
+       tests/test-repo-system.sh tests/test-extensions.sh \
+       tests/test-bundle.sh tests/test-bundle-system.sh \
+       tests/test-oci.sh tests/test-unsigned-summaries.sh \
+       tests/test-update-remote-configuration.sh $(am__EXEEXT_1)
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+  case '$@' in \
+    */*) \
+      case '$*' in \
+        */*) b='$*';; \
+          *) b=`echo '$@' | sed 's/\.log$$//'`; \
+       esac;; \
+    *) \
+      b='$*';; \
+  esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+       $(TEST_LOG_FLAGS)
+DIST_SUBDIRS = . doc po
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/app/Makefile.am.inc \
+       $(srcdir)/bubblewrap/Makefile-bwrap.am.inc \
+       $(srcdir)/common/Makefile.am.inc $(srcdir)/config.h.in \
+       $(srcdir)/data/Makefile.am.inc \
+       $(srcdir)/dbus-proxy/Makefile.am.inc \
+       $(srcdir)/document-portal/Makefile.am.inc \
+       $(srcdir)/flatpak.pc.in $(srcdir)/lib/Makefile.am.inc \
+       $(srcdir)/libglnx/Makefile-libglnx.am.inc \
+       $(srcdir)/permission-store/Makefile.am.inc \
+       $(srcdir)/session-helper/Makefile.am.inc \
+       $(srcdir)/system-helper/Makefile.am.inc \
+       $(srcdir)/tests/Makefile.am.inc \
+       $(top_srcdir)/buildutil/glib-tap.mk \
+       $(top_srcdir)/lib/flatpak-version-macros.h.in ABOUT-NLS \
+       COPYING INSTALL NEWS compile config.guess config.rpath \
+       config.sub depcomp install-sh ltmain.sh missing test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+GZIP_ENV = --best
+DIST_ARCHIVES = $(distdir).tar.xz
+DIST_TARGETS = dist-xz
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_GLIB_CFLAGS = @APPSTREAM_GLIB_CFLAGS@
+APPSTREAM_GLIB_LIBS = @APPSTREAM_GLIB_LIBS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+BASE_LIBS = @BASE_LIBS@
+BWRAP = @BWRAP@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DBUS_CONFIG_DIR = @DBUS_CONFIG_DIR@
+DBUS_SERVICE_DIR = @DBUS_SERVICE_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEP_GPGME_CFLAGS = @DEP_GPGME_CFLAGS@
+DEP_GPGME_LIBS = @DEP_GPGME_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLATPAK_INTERFACE_AGE = @FLATPAK_INTERFACE_AGE@
+FLATPAK_MAJOR_VERSION = @FLATPAK_MAJOR_VERSION@
+FLATPAK_MICRO_VERSION = @FLATPAK_MICRO_VERSION@
+FLATPAK_MINOR_VERSION = @FLATPAK_MINOR_VERSION@
+FLATPAK_VERSION = @FLATPAK_VERSION@
+FUSE_CFLAGS = @FUSE_CFLAGS@
+FUSE_LIBS = @FUSE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GPGME_CONFIG = @GPGME_CONFIG@
+GPGME_PTHREAD_CFLAGS = @GPGME_PTHREAD_CFLAGS@
+GPGME_PTHREAD_LIBS = @GPGME_PTHREAD_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
+INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
+JSON_CFLAGS = @JSON_CFLAGS@
+JSON_LIBS = @JSON_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@
+LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OSTREE_CFLAGS = @OSTREE_CFLAGS@
+OSTREE_LIBS = @OSTREE_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PRIVILEGED_GROUP = @PRIVILEGED_GROUP@
+PROFILE_DIR = @PROFILE_DIR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+STRIP = @STRIP@
+SUDO_BIN = @SUDO_BIN@
+SYSTEM_FONTS_DIR = @SYSTEM_FONTS_DIR@
+SYSTEM_FONT_CACHE_DIRS = @SYSTEM_FONT_CACHE_DIRS@
+SYSTEM_INSTALL_DIR = @SYSTEM_INSTALL_DIR@
+USE_NLS = @USE_NLS@
+VALGRIND = @VALGRIND@
+VALGRIND_ENABLED = @VALGRIND_ENABLED@
+VALGRIND_HAVE_TOOL_memcheck = @VALGRIND_HAVE_TOOL_memcheck@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+XAUTH_CFLAGS = @XAUTH_CFLAGS@
+XAUTH_LIBS = @XAUTH_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMLCATALOG = @XMLCATALOG@
+XMLTO = @XMLTO@
+XMLTO_FLAGS = @XMLTO_FLAGS@
+XML_CATALOG_FILE = @XML_CATALOG_FILE@
+XSLTPROC = @XSLTPROC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+installed_test_metadir = @installed_test_metadir@
+installed_testdir = @installed_testdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
+systemduserunitdir = @systemduserunitdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+NULL = 
+dist_installed_test_extra_scripts = $(NULL) buildutil/tap-driver.sh \
+       tests/make-test-app.sh tests/make-test-runtime.sh \
+       tests/make-test-bundles.sh tests/test-webserver.sh $(NULL)
+noinst_LTLIBRARIES = $(NULL) $(am__append_1) libglnx.la \
+       libflatpak-common.la
+CLEANFILES = $(NULL) $(am__append_13) $(dbus_service_DATA) \
+       $(systemduserunit_DATA) $(nodist_libflatpak_common_la_SOURCES) \
+       $(am__append_18) $(nodist_xdg_permission_store_SOURCES)
+MAINTAINERCLEANFILES = $(NULL)
+DISTCLEANFILES = $(NULL) $(nodist_flatpakinclude_HEADERS) \
+       $(nodist_libflatpak_la_SOURCES) $(NULL) $(am__append_21) \
+       tests/services/org.freedesktop.Flatpak.service \
+       tests/services/org.freedesktop.portal.Documents.service \
+       tests/services/org.freedesktop.impl.portal.PermissionStore.service \
+       tests/services/org.freedesktop.Flatpak.SystemHelper.service \
+       tests/package_version.txt $(NULL) flatpak.sh flatpak.env \
+       flatpak.conf
+BUILT_SOURCES = $(NULL) $(nodist_libflatpak_common_la_SOURCES) \
+       $(nodist_flatpakinclude_HEADERS) \
+       $(nodist_libflatpak_la_SOURCES) $(NULL) \
+       $(nodist_xdg_permission_store_SOURCES) \
+       $(xdp_dbus_built_sources)
+EXTRA_DIST = buildutil/tap-driver.sh buildutil/tap-test \
+       $(all_dist_test_scripts) $(all_dist_test_data) \
+       $(service_in_files) libglnx/README.md libglnx/COPYING \
+       libglnx/libglnx.m4 $(NULL) \
+       data/org.freedesktop.portal.Documents.xml \
+       data/org.freedesktop.impl.portal.PermissionStore.xml \
+       data/org.freedesktop.systemd1.xml \
+       data/org.freedesktop.Flatpak.xml $(NULL) \
+       lib/flatpak-enum-types.c.template \
+       lib/flatpak-enum-types.h.template \
+       system-helper/org.freedesktop.Flatpak.policy.in \
+       system-helper/org.freedesktop.Flatpak.SystemHelper.conf \
+       system-helper/org.freedesktop.Flatpak.rules.in \
+       system-helper/org.freedesktop.Flatpak.SystemHelper.service.in \
+       system-helper/flatpak-system-helper.service.in \
+       tests/flatpak.supp tests/glib.supp $(completion_DATA) \
+       profile/flatpak.sh.in $(NULL) env.d/flatpak.env.in \
+       dbus.service.d/flatpak.conf.in flatpak.pc.in \
+       scripts/flatpak-bisect README.md
+TESTS_ENVIRONMENT = \
+       G_TEST_SRCDIR="$(abs_srcdir)/tests"     \
+       G_TEST_BUILDDIR="$(abs_builddir)/tests" \
+       UNINSTALLEDTESTS=1                      \
+       G_DEBUG=gc-friendly                     \
+       MALLOC_CHECK_=2                         \
+       MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
+
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/buildutil/tap-driver.sh
+LOG_COMPILER = $(top_srcdir)/buildutil/tap-test
+installed_test_LTLIBRARIES = $(am__append_12)
+installed_test_SCRIPTS = $(am__append_10)
+installed_test_DATA = $(am__append_11)
+nobase_installed_test_DATA = 
+noinst_SCRIPTS = $(am__append_3)
+noinst_DATA = $(am__append_4)
+check_LTLIBRARIES = $(am__append_5)
+check_SCRIPTS = $(am__append_7)
+check_DATA = $(am__append_8)
+
+# Note: build even the installed-only targets during 'make check' to ensure that they still work.
+# We need to do a bit of trickery here and manage dist-ing via EXTRA_DIST instead of using dist_ prefixes to
+# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
+# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
+all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
+                        $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
+
+all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) \
+       $(installed_test_scripts) $(test_extra_scripts) \
+       $(uninstalled_test_extra_scripts) \
+       $(installed_test_extra_scripts) $(all_dist_test_scripts)
+all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
+                        $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
+
+all_test_data = $(test_data) $(uninstalled_test_data) \
+       $(installed_test_data) $(all_dist_test_data)
+all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
+all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
+@ENABLE_INSTALLED_TESTS_TRUE@installed_testcases = $(test_programs) $(installed_test_programs) \
+@ENABLE_INSTALLED_TESTS_TRUE@                      $(test_scripts) $(installed_test_scripts) \
+@ENABLE_INSTALLED_TESTS_TRUE@                      $(dist_test_scripts) $(dist_installed_test_scripts)
+
+@ENABLE_INSTALLED_TESTS_TRUE@installed_test_meta_DATA = $(installed_testcases:=.test)
+SUBDIRS = $(am__append_14) po
+dbus_servicedir = $(DBUS_SERVICE_DIR)
+service_in_files = $(NULL) \
+       session-helper/flatpak-session-helper.service.in \
+       session-helper/org.freedesktop.Flatpak.service.in \
+       $(am__append_20) \
+       permission-store/xdg-permission-store.service.in \
+       permission-store/org.freedesktop.impl.portal.PermissionStore.service.in \
+       document-portal/xdg-document-portal.service.in \
+       document-portal/org.freedesktop.portal.Documents.service.in
+dbus_service_DATA = $(NULL) \
+       session-helper/org.freedesktop.Flatpak.service \
+       permission-store/org.freedesktop.impl.portal.PermissionStore.service \
+       document-portal/org.freedesktop.portal.Documents.service
+systemduserunit_DATA = $(NULL) \
+       session-helper/flatpak-session-helper.service \
+       permission-store/xdg-permission-store.service \
+       document-portal/xdg-document-portal.service
+FLATPAK_BINDIR = $(bindir)
+ACLOCAL_AMFLAGS = -I m4 -I libglnx ${ACLOCAL_FLAGS}
+AM_CPPFLAGS = -DFLATPAK_BINDIR=\"$(FLATPAK_BINDIR)\" \
+       -DFLATPAK_SYSTEMDIR=\"$(SYSTEM_INSTALL_DIR)\" \
+       -DFLATPAK_CONFIGDIR=\"$(sysconfdir)/flatpak\" \
+       -DFLATPAK_BASEDIR=\"$(pkgdatadir)\" \
+       -DFLATPAK_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \
+       -DSYSTEM_FONTS_DIR=\"$(SYSTEM_FONTS_DIR)\" \
+       -DSYSTEM_FONT_CACHE_DIRS=\"$(SYSTEM_FONT_CACHE_DIRS)\" \
+       -DDBUSPROXY=\"$(libexecdir)/flatpak-dbus-proxy\" \
+       -DG_LOG_DOMAIN=\"flatpak\" -I$(srcdir)/libglnx \
+       -I$(srcdir)/common -I$(builddir)/common -I$(srcdir)/lib \
+       -I$(builddir)/lib -include "config.h" $(NULL) $(am__append_15) \
+       $(am__append_16)
+AM_CFLAGS = $(WARN_CFLAGS)
+triggersdir = $(pkgdatadir)/triggers
+dist_triggers_SCRIPTS = \
+       triggers/gtk-icon-cache.trigger \
+       triggers/mime-database.trigger \
+       triggers/desktop-database.trigger \
+       $(NULL)
+
+
+# This canonicalizes the PKG_CHECK_MODULES or AM_PATH_GPGME results
+INTERNAL_GPGME_CFLAGS = $(DEP_GPGME_CFLAGS) $(GPGME_PTHREAD_CFLAGS)
+INTERNAL_GPGME_LIBS = $(DEP_GPGME_LIBS) $(GPGME_PTHREAD_LIBS)
+lib_LTLIBRARIES = libflatpak.la
+libglnx_srcpath := $(srcdir)/libglnx
+libglnx_cflags := \
+       $(BASE_CFLAGS) \
+       "-I$(libglnx_srcpath)" \
+       -std=gnu99 \
+       $(HIDDEN_VISIBILITY_CFLAGS) \
+       $(NULL)
+
+libglnx_libs := $(BASE_LIBS)
+libglnx_la_SOURCES = \
+       libglnx/glnx-macros.h \
+       libglnx/glnx-backport-autocleanups.h \
+       libglnx/glnx-backport-autoptr.h \
+       libglnx/glnx-backports.h \
+       libglnx/glnx-backports.c \
+       libglnx/glnx-local-alloc.h \
+       libglnx/glnx-local-alloc.c \
+       libglnx/glnx-errors.h \
+       libglnx/glnx-errors.c \
+       libglnx/glnx-console.h \
+       libglnx/glnx-console.c \
+       libglnx/glnx-dirfd.h \
+       libglnx/glnx-dirfd.c \
+       libglnx/glnx-fdio.h \
+       libglnx/glnx-fdio.c \
+       libglnx/glnx-lockfile.h \
+       libglnx/glnx-lockfile.c \
+       libglnx/glnx-missing-syscall.h \
+       libglnx/glnx-missing.h \
+       libglnx/glnx-xattrs.h \
+       libglnx/glnx-xattrs.c \
+       libglnx/glnx-shutil.h \
+       libglnx/glnx-shutil.c \
+       libglnx/libglnx.h \
+       libglnx/tests/libglnx-testlib.h \
+       $(NULL)
+
+libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic 
+libglnx_la_LIBADD = $(libglnx_libs)
+libglnx_tests = test-libglnx-xattrs test-libglnx-fdio test-libglnx-errors test-libglnx-macros test-libglnx-shutil
+test_libglnx_xattrs_SOURCES = libglnx/tests/test-libglnx-xattrs.c
+test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la
+test_libglnx_fdio_SOURCES = libglnx/tests/test-libglnx-fdio.c
+test_libglnx_fdio_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_fdio_LDADD = $(libglnx_libs) libglnx.la
+test_libglnx_errors_SOURCES = libglnx/tests/test-libglnx-errors.c
+test_libglnx_errors_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_errors_LDADD = $(libglnx_libs) libglnx.la
+test_libglnx_macros_SOURCES = libglnx/tests/test-libglnx-macros.c
+test_libglnx_macros_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_macros_LDADD = $(libglnx_libs) libglnx.la
+test_libglnx_shutil_SOURCES = libglnx/tests/test-libglnx-shutil.c
+test_libglnx_shutil_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_shutil_LDADD = $(libglnx_libs) libglnx.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
+nodist_libflatpak_common_la_SOURCES = \
+       $(dbus_built_sources)           \
+       $(systemd_dbus_built_sources)   \
+       $(xdp_dbus_built_sources) \
+       $(NULL)
+
+libflatpak_common_la_SOURCES = \
+       common/flatpak-common-types.h \
+       common/flatpak-dir.c \
+       common/flatpak-dir.h \
+       common/flatpak-run.c \
+       common/flatpak-run.h \
+       common/flatpak-portal-error.c \
+       common/flatpak-portal-error.h \
+       common/flatpak-utils.c \
+       common/flatpak-utils.h \
+       common/flatpak-table-printer.c \
+       common/flatpak-table-printer.h \
+       common/flatpak-chain-input-stream.c \
+       common/flatpak-chain-input-stream.h \
+       common/gvdb/gvdb-reader.h       \
+       common/gvdb/gvdb-format.h       \
+       common/gvdb/gvdb-reader.c       \
+       common/gvdb/gvdb-builder.h      \
+       common/gvdb/gvdb-builder.c      \
+       common/flatpak-db.c \
+       common/flatpak-db.h \
+       common/flatpak-json.c \
+       common/flatpak-json.h \
+       common/flatpak-json-oci.c \
+       common/flatpak-json-oci.h \
+       common/flatpak-oci-registry.c \
+       common/flatpak-oci-registry.h \
+       $(NULL)
+
+libflatpak_common_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(BASE_CFLAGS) \
+       $(HIDDEN_VISIBILITY_CFLAGS) \
+       $(OSTREE_CFLAGS) \
+       $(SOUP_CFLAGS) \
+       $(JSON_CFLAGS) \
+       $(XAUTH_CFLAGS) \
+       $(LIBSECCOMP_CFLAGS) \
+       $(INTERNAL_GPGME_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)
+introspectiondir = $(datadir)/dbus-1/interfaces
+introspection_DATA = \
+       data/org.freedesktop.impl.portal.PermissionStore.xml \
+       data/org.freedesktop.portal.Documents.xml \
+       data/org.freedesktop.Flatpak.xml \
+       $(NULL)
+
+flatpak_SOURCES = \
+       app/flatpak-main.c \
+       app/flatpak-builtins.h \
+       app/flatpak-builtins-utils.h \
+       app/flatpak-builtins-utils.c \
+       app/flatpak-transaction.h \
+       app/flatpak-transaction.c \
+       app/flatpak-builtins-add-remote.c \
+       app/flatpak-builtins-delete-remote.c \
+       app/flatpak-builtins-list-remotes.c \
+       app/flatpak-builtins-ls-remote.c \
+       app/flatpak-builtins-info-remote.c \
+       app/flatpak-builtins-install.c \
+       app/flatpak-builtins-override.c \
+       app/flatpak-builtins-make-current.c \
+       app/flatpak-builtins-update.c \
+       app/flatpak-builtins-uninstall.c \
+       app/flatpak-builtins-list.c \
+       app/flatpak-builtins-info.c \
+       app/flatpak-builtins-config.c \
+       app/flatpak-builtins-run.c \
+       app/flatpak-builtins-enter.c \
+       app/flatpak-builtins-build-init.c \
+       app/flatpak-builtins-build.c \
+       app/flatpak-builtins-build-finish.c \
+       app/flatpak-builtins-build-export.c \
+       app/flatpak-builtins-build-bundle.c \
+       app/flatpak-builtins-build-import-bundle.c \
+       app/flatpak-builtins-build-commit-from.c \
+       app/flatpak-builtins-build-sign.c \
+       app/flatpak-builtins-repo-update.c \
+       app/flatpak-builtins-repo.c \
+       app/flatpak-builtins-document-export.c \
+       app/flatpak-builtins-document-unexport.c \
+       app/flatpak-builtins-document-info.c \
+       app/flatpak-builtins-document-list.c \
+       app/flatpak-builtins-search.c \
+       $(NULL)
+
+flatpak_LDADD = $(AM_LDADD) $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(APPSTREAM_GLIB_LIBS) \
+       libglnx.la libflatpak-common.la
+
+flatpak_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(APPSTREAM_GLIB_CFLAGS) \
+        -DLOCALEDIR=\"$(localedir)\"
+
+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)
+
+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)
+
+INTROSPECTION_GIRS = $(am__append_17)
+@HAVE_INTROSPECTION_TRUE@introspected_headers = \
+@HAVE_INTROSPECTION_TRUE@      $(flatpakinclude_HEADERS) \
+@HAVE_INTROSPECTION_TRUE@      $(nodist_flatpakinclude_HEADERS) \
+@HAVE_INTROSPECTION_TRUE@      $(NULL)
+
+@HAVE_INTROSPECTION_TRUE@introspected_sources = $(filter-out %-private.h,$(sources))
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_NAMESPACE = Flatpak
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_VERSION = 1.0
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_LIBS = libflatpak.la
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources)
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS)
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
+@HAVE_INTROSPECTION_TRUE@Flatpak_1_0_gir_SCANNERFLAGS = \
+@HAVE_INTROSPECTION_TRUE@        --warn-all \
+@HAVE_INTROSPECTION_TRUE@        --c-include='flatpak.h' \
+@HAVE_INTROSPECTION_TRUE@        --pkg-export=flatpak
+
+@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0
+@HAVE_INTROSPECTION_TRUE@nodist_gir_DATA = $(INTROSPECTION_GIRS)
+@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0
+@HAVE_INTROSPECTION_TRUE@nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+flatpak_session_helper_SOURCES = \
+       session-helper/flatpak-session-helper.c \
+       $(NULL)
+
+flatpak_session_helper_LDADD = $(AM_LDADD) $(BASE_LIBS) libflatpak-common.la
+flatpak_session_helper_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(SOUP_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) $(JSON_CFLAGS)
+@BUILD_SYSTEM_HELPER_TRUE@dbussystemservicedir = $(datadir)/dbus-1/system-services
+@BUILD_SYSTEM_HELPER_TRUE@dbussystemservice_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.service
+@BUILD_SYSTEM_HELPER_TRUE@dbusconfdir = $(DBUS_CONFIG_DIR)
+@BUILD_SYSTEM_HELPER_TRUE@dist_dbusconf_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.conf
+@BUILD_SYSTEM_HELPER_TRUE@systemdsystemunit_DATA = system-helper/flatpak-system-helper.service
+@BUILD_SYSTEM_HELPER_TRUE@flatpak_system_helper_SOURCES = \
+@BUILD_SYSTEM_HELPER_TRUE@     system-helper/flatpak-system-helper.c   \
+@BUILD_SYSTEM_HELPER_TRUE@     lib/flatpak-error.c     \
+@BUILD_SYSTEM_HELPER_TRUE@     $(NULL)
+
+@BUILD_SYSTEM_HELPER_TRUE@flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(JSON_LIBS) $(POLKIT_LIBS) libflatpak-common.la
+@BUILD_SYSTEM_HELPER_TRUE@flatpak_system_helper_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(POLKIT_CFLAGS)
+@BUILD_SYSTEM_HELPER_TRUE@polkit_rulesdir = $(datadir)/polkit-1/rules.d
+@BUILD_SYSTEM_HELPER_TRUE@polkit_rules_DATA = \
+@BUILD_SYSTEM_HELPER_TRUE@     system-helper/org.freedesktop.Flatpak.rules
+
+@BUILD_SYSTEM_HELPER_TRUE@polkit_policydir = $(datadir)/polkit-1/actions
+@BUILD_SYSTEM_HELPER_TRUE@polkit_policy_DATA = \
+@BUILD_SYSTEM_HELPER_TRUE@     system-helper/org.freedesktop.Flatpak.policy
+
+flatpak_dbus_proxy_SOURCES = \
+       dbus-proxy/flatpak-proxy.c      \
+       dbus-proxy/flatpak-proxy.h      \
+       dbus-proxy/dbus-proxy.c         \
+       $(NULL)
+
+flatpak_dbus_proxy_LDADD = $(AM_LDADD) $(BASE_LIBS) libglnx.la
+flatpak_dbus_proxy_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) -I$(srcdir)/dbus-proxy
+nodist_xdg_permission_store_SOURCES = permission-store/permission-store-dbus.c permission-store/permission-store-dbus.h
+
+# also used by the document portal
+ps_dbus_built_sources = $(nodist_xdg_permission_store_SOURCES)
+xdg_permission_store_SOURCES = \
+       permission-store/permission-store.c     \
+       permission-store/xdg-permission-store.c \
+       permission-store/xdg-permission-store.h \
+       $(NULL)
+
+xdg_permission_store_LDADD = $(AM_LDADD) $(BASE_LIBS) libflatpak-common.la
+xdg_permission_store_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) -I$(srcdir)/permission-store -I$(builddir)/permission-store
+xdp_dbus_built_sources = document-portal/xdp-dbus.c document-portal/xdp-dbus.h
+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             \
+       document-portal/xdp-util.h              \
+       document-portal/xdp-util.c              \
+       document-portal/xdp-fuse.h              \
+       document-portal/xdp-fuse.c              \
+       $(NULL)
+
+xdg_document_portal_LDADD = $(AM_LDADD) $(BASE_LIBS) $(FUSE_LIBS) libflatpak-common.la
+xdg_document_portal_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(FUSE_CFLAGS) -I$(srcdir)/document-portal -I$(builddir)/document-portal -I$(srcdir)/permission-store -I$(builddir)/permission-store -DFLATPAK_COMPILATION
+AM_TESTS_ENVIRONMENT = FLATPAK_TESTS_DEBUG=1 FLATPAK_TRIGGERSDIR=$$(cd \
+       $(top_srcdir) && pwd)/triggers FLATPAK_DBUSPROXY=$$(cd \
+       $(top_builddir) && pwd)/flatpak-dbus-proxy \
+       GI_TYPELIB_PATH=$$(cd $(top_builddir) && \
+       pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
+       LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && \
+       pwd)$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} PATH=$$(cd \
+       $(top_builddir) && pwd):$${PATH} $(NULL) $(am__append_22) \
+       $(am__append_23)
+testdb_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+testdb_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             $(OSTREE_LIBS) \
+             libglnx.la \
+             libflatpak-common.la \
+             $(NULL)
+
+testdb_SOURCES = tests/testdb.c
+test_doc_portal_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+test_doc_portal_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             $(OSTREE_LIBS) \
+             libglnx.la \
+             libflatpak-common.la \
+             $(NULL)
+
+test_doc_portal_SOURCES = tests/test-doc-portal.c
+nodist_test_doc_portal_SOURCES = $(xdp_dbus_built_sources)
+testlibrary_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+testlibrary_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             libglnx.la \
+             libflatpak.la \
+             $(NULL)
+
+testlibrary_SOURCES = tests/testlibrary.c
+EXTRA_test_doc_portal_DEPENDENCIES = tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service  tests/services/org.freedesktop.Flatpak.service tests/services/org.freedesktop.Flatpak.SystemHelper.service
+dist_installed_test_data = \
+       tests/libtest.sh \
+       tests/org.test.Hello.png \
+       tests/package_version.txt \
+       tests/session.conf.in \
+       $(NULL)
+
+installed_test_keyringdir = $(installed_testdir)/test-keyring
+installed_test_keyring2dir = $(installed_testdir)/test-keyring2
+installed_test_dbsdir = $(installed_testdir)/dbs
+@ENABLE_INSTALLED_TESTS_TRUE@dist_installed_test_keyring_DATA = \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring/README \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring/pubring.gpg \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring/secring.gpg \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(NULL)
+
+@ENABLE_INSTALLED_TESTS_TRUE@dist_installed_test_keyring2_DATA = \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring2/README \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring2/pubring.gpg \
+@ENABLE_INSTALLED_TESTS_TRUE@  tests/test-keyring2/secring.gpg \
+@ENABLE_INSTALLED_TESTS_TRUE@  $(NULL)
+
+@ENABLE_INSTALLED_TESTS_TRUE@dist_installed_test_dbs_DATA = tests/dbs/no_tables
+dist_test_scripts = \
+       tests/test-basic.sh \
+       tests/test-run.sh \
+       tests/test-run-system.sh \
+       tests/test-run-deltas.sh \
+       tests/test-run-system-deltas.sh \
+       tests/test-repo.sh \
+       tests/test-repo-collections.sh \
+       tests/test-repo-collections-server-only.sh \
+       tests/test-repo-system.sh \
+       tests/test-extensions.sh \
+       tests/test-bundle.sh \
+       tests/test-bundle-system.sh \
+       tests/test-oci.sh \
+       tests/test-unsigned-summaries.sh \
+       tests/test-update-remote-configuration.sh \
+       $(NULL)
+
+test_programs = testdb test-doc-portal testlibrary
+VALGRIND_SUPPRESSIONS_FILES = tests/flatpak.supp tests/glib.supp
+@WITH_SYSTEM_BWRAP_FALSE@flatpak_bwrap_SOURCES = $(bwrap_SOURCES)
+@WITH_SYSTEM_BWRAP_FALSE@flatpak_bwrap_CFLAGS = $(AM_CFLAGS) $(bwrap_CFLAGS)
+@WITH_SYSTEM_BWRAP_FALSE@flatpak_bwrap_LDADD = $(AM_LDADD) $(bwrap_LDADD)
+@WITH_SYSTEM_BWRAP_FALSE@bwrapdir = $(libexecdir)
+@WITH_SYSTEM_BWRAP_FALSE@bwrap_SOURCES = \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/bubblewrap.c \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/bind-mount.h \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/bind-mount.c \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/network.h \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/network.c \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/utils.h \
+@WITH_SYSTEM_BWRAP_FALSE@      bubblewrap/utils.c \
+@WITH_SYSTEM_BWRAP_FALSE@      $(NULL)
+
+@WITH_SYSTEM_BWRAP_FALSE@bwrap_CFLAGS = $(AM_CFLAGS)
+@WITH_SYSTEM_BWRAP_FALSE@bwrap_LDADD = $(SELINUX_LIBS)
+completiondir = $(datadir)/bash-completion/completions
+completion_DATA = completion/flatpak
+profiledir = $(PROFILE_DIR)
+profile_DATA = flatpak.sh
+envdir = $(datadir)/gdm/env.d
+env_DATA = flatpak.env
+dbussnippetdir = $(systemduserunitdir)/dbus.service.d
+dbussnippet_DATA = flatpak.conf
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = flatpak.pc
+scriptsdir = $(bindir)
+scripts_SCRIPTS = scripts/flatpak-bisect
+AM_DISTCHECK_CONFIGURE_FLAGS = \
+       --enable-documentation          \
+       --disable-maintainer-mode       \
+       --enable-introspection
+
+all: $(BUILT_SOURCES) config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+am--refresh: Makefile
+       @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/buildutil/glib-tap.mk $(srcdir)/libglnx/Makefile-libglnx.am.inc $(srcdir)/common/Makefile.am.inc $(srcdir)/data/Makefile.am.inc $(srcdir)/app/Makefile.am.inc $(srcdir)/lib/Makefile.am.inc $(srcdir)/session-helper/Makefile.am.inc $(srcdir)/system-helper/Makefile.am.inc $(srcdir)/dbus-proxy/Makefile.am.inc $(srcdir)/permission-store/Makefile.am.inc $(srcdir)/document-portal/Makefile.am.inc $(srcdir)/tests/Makefile.am.inc $(srcdir)/bubblewrap/Makefile-bwrap.am.inc $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+             $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --foreign Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+$(top_srcdir)/buildutil/glib-tap.mk $(srcdir)/libglnx/Makefile-libglnx.am.inc $(srcdir)/common/Makefile.am.inc $(srcdir)/data/Makefile.am.inc $(srcdir)/app/Makefile.am.inc $(srcdir)/lib/Makefile.am.inc $(srcdir)/session-helper/Makefile.am.inc $(srcdir)/system-helper/Makefile.am.inc $(srcdir)/dbus-proxy/Makefile.am.inc $(srcdir)/permission-store/Makefile.am.inc $(srcdir)/document-portal/Makefile.am.inc $(srcdir)/tests/Makefile.am.inc $(srcdir)/bubblewrap/Makefile-bwrap.am.inc $(am__empty):
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+       @test -f $@ || rm -f stamp-h1
+       @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+       ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f config.h stamp-h1
+flatpak.pc: $(top_builddir)/config.status $(srcdir)/flatpak.pc.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+lib/flatpak-version-macros.h: $(top_builddir)/config.status $(top_srcdir)/lib/flatpak-version-macros.h.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+
+clean-checkLTLIBRARIES:
+       -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+       @list='$(check_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+
+install-installed_testLTLIBRARIES: $(installed_test_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       @list='$(installed_test_LTLIBRARIES)'; test -n "$(installed_testdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(installed_testdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(installed_testdir)"; \
+       }
+
+uninstall-installed_testLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(installed_test_LTLIBRARIES)'; test -n "$(installed_testdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(installed_testdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(installed_testdir)/$$f"; \
+       done
+
+clean-installed_testLTLIBRARIES:
+       -test -z "$(installed_test_LTLIBRARIES)" || rm -f $(installed_test_LTLIBRARIES)
+       @list='$(installed_test_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+
+clean-noinstLTLIBRARIES:
+       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+       @list='$(noinst_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+common/$(am__dirstamp):
+       @$(MKDIR_P) common
+       @: > common/$(am__dirstamp)
+common/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) common/$(DEPDIR)
+       @: > common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-dir.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-run.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-portal-error.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-utils.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-table-printer.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-chain-input-stream.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+common/gvdb/$(am__dirstamp):
+       @$(MKDIR_P) common/gvdb
+       @: > common/gvdb/$(am__dirstamp)
+common/gvdb/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) common/gvdb/$(DEPDIR)
+       @: > common/gvdb/$(DEPDIR)/$(am__dirstamp)
+common/gvdb/libflatpak_common_la-gvdb-reader.lo:  \
+       common/gvdb/$(am__dirstamp) \
+       common/gvdb/$(DEPDIR)/$(am__dirstamp)
+common/gvdb/libflatpak_common_la-gvdb-builder.lo:  \
+       common/gvdb/$(am__dirstamp) \
+       common/gvdb/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-db.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-json.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-json-oci.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-oci-registry.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-dbus.lo: common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+common/libflatpak_common_la-flatpak-systemd-dbus.lo:  \
+       common/$(am__dirstamp) common/$(DEPDIR)/$(am__dirstamp)
+document-portal/$(am__dirstamp):
+       @$(MKDIR_P) document-portal
+       @: > document-portal/$(am__dirstamp)
+document-portal/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) document-portal/$(DEPDIR)
+       @: > document-portal/$(DEPDIR)/$(am__dirstamp)
+document-portal/libflatpak_common_la-xdp-dbus.lo:  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+
+libflatpak-common.la: $(libflatpak_common_la_OBJECTS) $(libflatpak_common_la_DEPENDENCIES) $(EXTRA_libflatpak_common_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libflatpak_common_la_LINK)  $(libflatpak_common_la_OBJECTS) $(libflatpak_common_la_LIBADD) $(LIBS)
+lib/$(am__dirstamp):
+       @$(MKDIR_P) lib
+       @: > lib/$(am__dirstamp)
+lib/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/$(DEPDIR)
+       @: > lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-ref.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-installed-ref.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-remote-ref.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-bundle-ref.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-related-ref.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-remote.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-error.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-installation.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libflatpak_la-flatpak-enum-types.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+
+libflatpak.la: $(libflatpak_la_OBJECTS) $(libflatpak_la_DEPENDENCIES) $(EXTRA_libflatpak_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libflatpak_la_LINK) -rpath $(libdir) $(libflatpak_la_OBJECTS) $(libflatpak_la_LIBADD) $(LIBS)
+libglnx/$(am__dirstamp):
+       @$(MKDIR_P) libglnx
+       @: > libglnx/$(am__dirstamp)
+libglnx/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) libglnx/$(DEPDIR)
+       @: > libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-backports.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-local-alloc.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-errors.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-console.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-dirfd.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-fdio.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-lockfile.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-xattrs.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+libglnx/libglnx_la-glnx-shutil.lo: libglnx/$(am__dirstamp) \
+       libglnx/$(DEPDIR)/$(am__dirstamp)
+
+libglnx.la: $(libglnx_la_OBJECTS) $(libglnx_la_DEPENDENCIES) $(EXTRA_libglnx_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libglnx_la_LINK)  $(libglnx_la_OBJECTS) $(libglnx_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+       fi; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p \
+        || test -f $$p1 \
+         ; then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' \
+           -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' \
+       `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+       @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+install-bwrapPROGRAMS: $(bwrap_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       @list='$(bwrap_PROGRAMS)'; test -n "$(bwrapdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(bwrapdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(bwrapdir)" || exit 1; \
+       fi; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p \
+        || test -f $$p1 \
+         ; then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' \
+           -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bwrapdir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bwrapdir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-bwrapPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bwrap_PROGRAMS)'; test -n "$(bwrapdir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' \
+       `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(bwrapdir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(bwrapdir)" && rm -f $$files
+
+clean-bwrapPROGRAMS:
+       @list='$(bwrap_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+
+clean-checkPROGRAMS:
+       @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+install-installed_testPROGRAMS: $(installed_test_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       @list='$(installed_test_PROGRAMS)'; test -n "$(installed_testdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \
+       fi; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p \
+        || test -f $$p1 \
+         ; then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' \
+           -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-installed_testPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(installed_test_PROGRAMS)'; test -n "$(installed_testdir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' \
+       `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(installed_testdir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(installed_testdir)" && rm -f $$files
+
+clean-installed_testPROGRAMS:
+       @list='$(installed_test_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+       fi; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p \
+        || test -f $$p1 \
+         ; then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' \
+           -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-libexecPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' \
+       `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
+
+clean-libexecPROGRAMS:
+       @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+app/$(am__dirstamp):
+       @$(MKDIR_P) app
+       @: > app/$(am__dirstamp)
+app/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) app/$(DEPDIR)
+       @: > app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-main.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-utils.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-transaction.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-add-remote.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-delete-remote.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-list-remotes.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-ls-remote.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-info-remote.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-install.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-override.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-make-current.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-update.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-uninstall.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-list.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-info.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-config.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-run.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-enter.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-init.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-finish.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-export.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-bundle.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-import-bundle.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-commit-from.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-build-sign.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-repo-update.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-repo.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-document-export.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-document-unexport.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-document-info.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-document-list.$(OBJEXT):  \
+       app/$(am__dirstamp) app/$(DEPDIR)/$(am__dirstamp)
+app/flatpak-flatpak-builtins-search.$(OBJEXT): app/$(am__dirstamp) \
+       app/$(DEPDIR)/$(am__dirstamp)
+
+flatpak$(EXEEXT): $(flatpak_OBJECTS) $(flatpak_DEPENDENCIES) $(EXTRA_flatpak_DEPENDENCIES) 
+       @rm -f flatpak$(EXEEXT)
+       $(AM_V_CCLD)$(flatpak_LINK) $(flatpak_OBJECTS) $(flatpak_LDADD) $(LIBS)
+bubblewrap/$(am__dirstamp):
+       @$(MKDIR_P) bubblewrap
+       @: > bubblewrap/$(am__dirstamp)
+bubblewrap/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) bubblewrap/$(DEPDIR)
+       @: > bubblewrap/$(DEPDIR)/$(am__dirstamp)
+bubblewrap/flatpak_bwrap-bubblewrap.$(OBJEXT):  \
+       bubblewrap/$(am__dirstamp) \
+       bubblewrap/$(DEPDIR)/$(am__dirstamp)
+bubblewrap/flatpak_bwrap-bind-mount.$(OBJEXT):  \
+       bubblewrap/$(am__dirstamp) \
+       bubblewrap/$(DEPDIR)/$(am__dirstamp)
+bubblewrap/flatpak_bwrap-network.$(OBJEXT):  \
+       bubblewrap/$(am__dirstamp) \
+       bubblewrap/$(DEPDIR)/$(am__dirstamp)
+bubblewrap/flatpak_bwrap-utils.$(OBJEXT): bubblewrap/$(am__dirstamp) \
+       bubblewrap/$(DEPDIR)/$(am__dirstamp)
+
+flatpak-bwrap$(EXEEXT): $(flatpak_bwrap_OBJECTS) $(flatpak_bwrap_DEPENDENCIES) $(EXTRA_flatpak_bwrap_DEPENDENCIES) 
+       @rm -f flatpak-bwrap$(EXEEXT)
+       $(AM_V_CCLD)$(flatpak_bwrap_LINK) $(flatpak_bwrap_OBJECTS) $(flatpak_bwrap_LDADD) $(LIBS)
+dbus-proxy/$(am__dirstamp):
+       @$(MKDIR_P) dbus-proxy
+       @: > dbus-proxy/$(am__dirstamp)
+dbus-proxy/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) dbus-proxy/$(DEPDIR)
+       @: > dbus-proxy/$(DEPDIR)/$(am__dirstamp)
+dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.$(OBJEXT):  \
+       dbus-proxy/$(am__dirstamp) \
+       dbus-proxy/$(DEPDIR)/$(am__dirstamp)
+dbus-proxy/flatpak_dbus_proxy-dbus-proxy.$(OBJEXT):  \
+       dbus-proxy/$(am__dirstamp) \
+       dbus-proxy/$(DEPDIR)/$(am__dirstamp)
+
+flatpak-dbus-proxy$(EXEEXT): $(flatpak_dbus_proxy_OBJECTS) $(flatpak_dbus_proxy_DEPENDENCIES) $(EXTRA_flatpak_dbus_proxy_DEPENDENCIES) 
+       @rm -f flatpak-dbus-proxy$(EXEEXT)
+       $(AM_V_CCLD)$(flatpak_dbus_proxy_LINK) $(flatpak_dbus_proxy_OBJECTS) $(flatpak_dbus_proxy_LDADD) $(LIBS)
+session-helper/$(am__dirstamp):
+       @$(MKDIR_P) session-helper
+       @: > session-helper/$(am__dirstamp)
+session-helper/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) session-helper/$(DEPDIR)
+       @: > session-helper/$(DEPDIR)/$(am__dirstamp)
+session-helper/flatpak_session_helper-flatpak-session-helper.$(OBJEXT):  \
+       session-helper/$(am__dirstamp) \
+       session-helper/$(DEPDIR)/$(am__dirstamp)
+
+flatpak-session-helper$(EXEEXT): $(flatpak_session_helper_OBJECTS) $(flatpak_session_helper_DEPENDENCIES) $(EXTRA_flatpak_session_helper_DEPENDENCIES) 
+       @rm -f flatpak-session-helper$(EXEEXT)
+       $(AM_V_CCLD)$(flatpak_session_helper_LINK) $(flatpak_session_helper_OBJECTS) $(flatpak_session_helper_LDADD) $(LIBS)
+system-helper/$(am__dirstamp):
+       @$(MKDIR_P) system-helper
+       @: > system-helper/$(am__dirstamp)
+system-helper/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) system-helper/$(DEPDIR)
+       @: > system-helper/$(DEPDIR)/$(am__dirstamp)
+system-helper/flatpak_system_helper-flatpak-system-helper.$(OBJEXT):  \
+       system-helper/$(am__dirstamp) \
+       system-helper/$(DEPDIR)/$(am__dirstamp)
+lib/flatpak_system_helper-flatpak-error.$(OBJEXT):  \
+       lib/$(am__dirstamp) lib/$(DEPDIR)/$(am__dirstamp)
+
+flatpak-system-helper$(EXEEXT): $(flatpak_system_helper_OBJECTS) $(flatpak_system_helper_DEPENDENCIES) $(EXTRA_flatpak_system_helper_DEPENDENCIES) 
+       @rm -f flatpak-system-helper$(EXEEXT)
+       $(AM_V_CCLD)$(flatpak_system_helper_LINK) $(flatpak_system_helper_OBJECTS) $(flatpak_system_helper_LDADD) $(LIBS)
+tests/$(am__dirstamp):
+       @$(MKDIR_P) tests
+       @: > tests/$(am__dirstamp)
+tests/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) tests/$(DEPDIR)
+       @: > tests/$(DEPDIR)/$(am__dirstamp)
+tests/test_doc_portal-test-doc-portal.$(OBJEXT):  \
+       tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp)
+document-portal/test_doc_portal-xdp-dbus.$(OBJEXT):  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+
+test-doc-portal$(EXEEXT): $(test_doc_portal_OBJECTS) $(test_doc_portal_DEPENDENCIES) $(EXTRA_test_doc_portal_DEPENDENCIES) 
+       @rm -f test-doc-portal$(EXEEXT)
+       $(AM_V_CCLD)$(test_doc_portal_LINK) $(test_doc_portal_OBJECTS) $(test_doc_portal_LDADD) $(LIBS)
+lib/test_libflatpak-test-lib.$(OBJEXT): lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+
+test-libflatpak$(EXEEXT): $(test_libflatpak_OBJECTS) $(test_libflatpak_DEPENDENCIES) $(EXTRA_test_libflatpak_DEPENDENCIES) 
+       @rm -f test-libflatpak$(EXEEXT)
+       $(AM_V_CCLD)$(test_libflatpak_LINK) $(test_libflatpak_OBJECTS) $(test_libflatpak_LDADD) $(LIBS)
+libglnx/tests/$(am__dirstamp):
+       @$(MKDIR_P) libglnx/tests
+       @: > libglnx/tests/$(am__dirstamp)
+libglnx/tests/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) libglnx/tests/$(DEPDIR)
+       @: > libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+libglnx/tests/test_libglnx_errors-test-libglnx-errors.$(OBJEXT):  \
+       libglnx/tests/$(am__dirstamp) \
+       libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+
+test-libglnx-errors$(EXEEXT): $(test_libglnx_errors_OBJECTS) $(test_libglnx_errors_DEPENDENCIES) $(EXTRA_test_libglnx_errors_DEPENDENCIES) 
+       @rm -f test-libglnx-errors$(EXEEXT)
+       $(AM_V_CCLD)$(test_libglnx_errors_LINK) $(test_libglnx_errors_OBJECTS) $(test_libglnx_errors_LDADD) $(LIBS)
+libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.$(OBJEXT):  \
+       libglnx/tests/$(am__dirstamp) \
+       libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+
+test-libglnx-fdio$(EXEEXT): $(test_libglnx_fdio_OBJECTS) $(test_libglnx_fdio_DEPENDENCIES) $(EXTRA_test_libglnx_fdio_DEPENDENCIES) 
+       @rm -f test-libglnx-fdio$(EXEEXT)
+       $(AM_V_CCLD)$(test_libglnx_fdio_LINK) $(test_libglnx_fdio_OBJECTS) $(test_libglnx_fdio_LDADD) $(LIBS)
+libglnx/tests/test_libglnx_macros-test-libglnx-macros.$(OBJEXT):  \
+       libglnx/tests/$(am__dirstamp) \
+       libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+
+test-libglnx-macros$(EXEEXT): $(test_libglnx_macros_OBJECTS) $(test_libglnx_macros_DEPENDENCIES) $(EXTRA_test_libglnx_macros_DEPENDENCIES) 
+       @rm -f test-libglnx-macros$(EXEEXT)
+       $(AM_V_CCLD)$(test_libglnx_macros_LINK) $(test_libglnx_macros_OBJECTS) $(test_libglnx_macros_LDADD) $(LIBS)
+libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.$(OBJEXT):  \
+       libglnx/tests/$(am__dirstamp) \
+       libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+
+test-libglnx-shutil$(EXEEXT): $(test_libglnx_shutil_OBJECTS) $(test_libglnx_shutil_DEPENDENCIES) $(EXTRA_test_libglnx_shutil_DEPENDENCIES) 
+       @rm -f test-libglnx-shutil$(EXEEXT)
+       $(AM_V_CCLD)$(test_libglnx_shutil_LINK) $(test_libglnx_shutil_OBJECTS) $(test_libglnx_shutil_LDADD) $(LIBS)
+libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.$(OBJEXT):  \
+       libglnx/tests/$(am__dirstamp) \
+       libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+
+test-libglnx-xattrs$(EXEEXT): $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_DEPENDENCIES) $(EXTRA_test_libglnx_xattrs_DEPENDENCIES) 
+       @rm -f test-libglnx-xattrs$(EXEEXT)
+       $(AM_V_CCLD)$(test_libglnx_xattrs_LINK) $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_LDADD) $(LIBS)
+tests/testdb-testdb.$(OBJEXT): tests/$(am__dirstamp) \
+       tests/$(DEPDIR)/$(am__dirstamp)
+
+testdb$(EXEEXT): $(testdb_OBJECTS) $(testdb_DEPENDENCIES) $(EXTRA_testdb_DEPENDENCIES) 
+       @rm -f testdb$(EXEEXT)
+       $(AM_V_CCLD)$(testdb_LINK) $(testdb_OBJECTS) $(testdb_LDADD) $(LIBS)
+tests/testlibrary-testlibrary.$(OBJEXT): tests/$(am__dirstamp) \
+       tests/$(DEPDIR)/$(am__dirstamp)
+
+testlibrary$(EXEEXT): $(testlibrary_OBJECTS) $(testlibrary_DEPENDENCIES) $(EXTRA_testlibrary_DEPENDENCIES) 
+       @rm -f testlibrary$(EXEEXT)
+       $(AM_V_CCLD)$(testlibrary_LINK) $(testlibrary_OBJECTS) $(testlibrary_LDADD) $(LIBS)
+document-portal/xdg_document_portal-xdp-main.$(OBJEXT):  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+document-portal/xdg_document_portal-xdp-util.$(OBJEXT):  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+document-portal/xdg_document_portal-xdp-fuse.$(OBJEXT):  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+document-portal/xdg_document_portal-xdp-dbus.$(OBJEXT):  \
+       document-portal/$(am__dirstamp) \
+       document-portal/$(DEPDIR)/$(am__dirstamp)
+permission-store/$(am__dirstamp):
+       @$(MKDIR_P) permission-store
+       @: > permission-store/$(am__dirstamp)
+permission-store/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) permission-store/$(DEPDIR)
+       @: > permission-store/$(DEPDIR)/$(am__dirstamp)
+permission-store/xdg_document_portal-permission-store-dbus.$(OBJEXT):  \
+       permission-store/$(am__dirstamp) \
+       permission-store/$(DEPDIR)/$(am__dirstamp)
+
+xdg-document-portal$(EXEEXT): $(xdg_document_portal_OBJECTS) $(xdg_document_portal_DEPENDENCIES) $(EXTRA_xdg_document_portal_DEPENDENCIES) 
+       @rm -f xdg-document-portal$(EXEEXT)
+       $(AM_V_CCLD)$(xdg_document_portal_LINK) $(xdg_document_portal_OBJECTS) $(xdg_document_portal_LDADD) $(LIBS)
+permission-store/xdg_permission_store-permission-store.$(OBJEXT):  \
+       permission-store/$(am__dirstamp) \
+       permission-store/$(DEPDIR)/$(am__dirstamp)
+permission-store/xdg_permission_store-xdg-permission-store.$(OBJEXT):  \
+       permission-store/$(am__dirstamp) \
+       permission-store/$(DEPDIR)/$(am__dirstamp)
+permission-store/xdg_permission_store-permission-store-dbus.$(OBJEXT):  \
+       permission-store/$(am__dirstamp) \
+       permission-store/$(DEPDIR)/$(am__dirstamp)
+
+xdg-permission-store$(EXEEXT): $(xdg_permission_store_OBJECTS) $(xdg_permission_store_DEPENDENCIES) $(EXTRA_xdg_permission_store_DEPENDENCIES) 
+       @rm -f xdg-permission-store$(EXEEXT)
+       $(AM_V_CCLD)$(xdg_permission_store_LINK) $(xdg_permission_store_OBJECTS) $(xdg_permission_store_LDADD) $(LIBS)
+install-dist_triggersSCRIPTS: $(dist_triggers_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_triggers_SCRIPTS)'; test -n "$(triggersdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(triggersdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(triggersdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n' \
+           -e 'h;s|.*|.|' \
+           -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+             if (++n[d] == $(am__install_max)) { \
+               print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+           else { print "f", d "/" $$4, $$1 } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+            test -z "$$files" || { \
+              echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(triggersdir)$$dir'"; \
+              $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(triggersdir)$$dir" || exit $$?; \
+            } \
+       ; done
+
+uninstall-dist_triggersSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_triggers_SCRIPTS)'; test -n "$(triggersdir)" || exit 0; \
+       files=`for p in $$list; do echo "$$p"; done | \
+              sed -e 's,.*/,,;$(transform)'`; \
+       dir='$(DESTDIR)$(triggersdir)'; $(am__uninstall_files_from_dir)
+install-installed_testSCRIPTS: $(installed_test_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       @list='$(installed_test_SCRIPTS)'; test -n "$(installed_testdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n' \
+           -e 'h;s|.*|.|' \
+           -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+             if (++n[d] == $(am__install_max)) { \
+               print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+           else { print "f", d "/" $$4, $$1 } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+            test -z "$$files" || { \
+              echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \
+              $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \
+            } \
+       ; done
+
+uninstall-installed_testSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(installed_test_SCRIPTS)'; test -n "$(installed_testdir)" || exit 0; \
+       files=`for p in $$list; do echo "$$p"; done | \
+              sed -e 's,.*/,,;$(transform)'`; \
+       dir='$(DESTDIR)$(installed_testdir)'; $(am__uninstall_files_from_dir)
+install-scriptsSCRIPTS: $(scripts_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       @list='$(scripts_SCRIPTS)'; test -n "$(scriptsdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(scriptsdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(scriptsdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n' \
+           -e 'h;s|.*|.|' \
+           -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+             if (++n[d] == $(am__install_max)) { \
+               print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+           else { print "f", d "/" $$4, $$1 } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+            test -z "$$files" || { \
+              echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(scriptsdir)$$dir'"; \
+              $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(scriptsdir)$$dir" || exit $$?; \
+            } \
+       ; done
+
+uninstall-scriptsSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(scripts_SCRIPTS)'; test -n "$(scriptsdir)" || exit 0; \
+       files=`for p in $$list; do echo "$$p"; done | \
+              sed -e 's,.*/,,;$(transform)'`; \
+       dir='$(DESTDIR)$(scriptsdir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+       -rm -f app/*.$(OBJEXT)
+       -rm -f bubblewrap/*.$(OBJEXT)
+       -rm -f common/*.$(OBJEXT)
+       -rm -f common/*.lo
+       -rm -f common/gvdb/*.$(OBJEXT)
+       -rm -f common/gvdb/*.lo
+       -rm -f dbus-proxy/*.$(OBJEXT)
+       -rm -f document-portal/*.$(OBJEXT)
+       -rm -f document-portal/*.lo
+       -rm -f lib/*.$(OBJEXT)
+       -rm -f lib/*.lo
+       -rm -f libglnx/*.$(OBJEXT)
+       -rm -f libglnx/*.lo
+       -rm -f libglnx/tests/*.$(OBJEXT)
+       -rm -f permission-store/*.$(OBJEXT)
+       -rm -f session-helper/*.$(OBJEXT)
+       -rm -f system-helper/*.$(OBJEXT)
+       -rm -f tests/*.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-build.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-info.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-install.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-override.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-run.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-search.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-update.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@app/$(DEPDIR)/flatpak-flatpak-transaction.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-chain-input-stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-db.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-dbus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-dir.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-json-oci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-json.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-oci-registry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-portal-error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-run.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-systemd-dbus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-table-printer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/libflatpak_common_la-flatpak-utils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-builder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-reader.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/libflatpak_common_la-xdp-dbus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-bundle-ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-enum-types.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-installation.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-installed-ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-related-ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-remote-ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak-remote.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libflatpak_la-flatpak.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/test_libflatpak-test-lib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-backports.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-console.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-dirfd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-errors.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-fdio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-local-alloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-lockfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-shutil.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/$(DEPDIR)/libglnx_la-glnx-xattrs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/testdb-testdb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/testlibrary-testlibrary.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+common/libflatpak_common_la-flatpak-dir.lo: common/flatpak-dir.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-dir.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-dir.Tpo -c -o common/libflatpak_common_la-flatpak-dir.lo `test -f 'common/flatpak-dir.c' || echo '$(srcdir)/'`common/flatpak-dir.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-dir.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-dir.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-dir.c' object='common/libflatpak_common_la-flatpak-dir.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-dir.lo `test -f 'common/flatpak-dir.c' || echo '$(srcdir)/'`common/flatpak-dir.c
+
+common/libflatpak_common_la-flatpak-run.lo: common/flatpak-run.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-run.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-run.Tpo -c -o common/libflatpak_common_la-flatpak-run.lo `test -f 'common/flatpak-run.c' || echo '$(srcdir)/'`common/flatpak-run.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-run.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-run.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-run.c' object='common/libflatpak_common_la-flatpak-run.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-run.lo `test -f 'common/flatpak-run.c' || echo '$(srcdir)/'`common/flatpak-run.c
+
+common/libflatpak_common_la-flatpak-portal-error.lo: common/flatpak-portal-error.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-portal-error.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-portal-error.Tpo -c -o common/libflatpak_common_la-flatpak-portal-error.lo `test -f 'common/flatpak-portal-error.c' || echo '$(srcdir)/'`common/flatpak-portal-error.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-portal-error.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-portal-error.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-portal-error.c' object='common/libflatpak_common_la-flatpak-portal-error.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-portal-error.lo `test -f 'common/flatpak-portal-error.c' || echo '$(srcdir)/'`common/flatpak-portal-error.c
+
+common/libflatpak_common_la-flatpak-utils.lo: common/flatpak-utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-utils.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-utils.Tpo -c -o common/libflatpak_common_la-flatpak-utils.lo `test -f 'common/flatpak-utils.c' || echo '$(srcdir)/'`common/flatpak-utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-utils.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-utils.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-utils.c' object='common/libflatpak_common_la-flatpak-utils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-utils.lo `test -f 'common/flatpak-utils.c' || echo '$(srcdir)/'`common/flatpak-utils.c
+
+common/libflatpak_common_la-flatpak-table-printer.lo: common/flatpak-table-printer.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-table-printer.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-table-printer.Tpo -c -o common/libflatpak_common_la-flatpak-table-printer.lo `test -f 'common/flatpak-table-printer.c' || echo '$(srcdir)/'`common/flatpak-table-printer.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-table-printer.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-table-printer.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-table-printer.c' object='common/libflatpak_common_la-flatpak-table-printer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-table-printer.lo `test -f 'common/flatpak-table-printer.c' || echo '$(srcdir)/'`common/flatpak-table-printer.c
+
+common/libflatpak_common_la-flatpak-chain-input-stream.lo: common/flatpak-chain-input-stream.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-chain-input-stream.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-chain-input-stream.Tpo -c -o common/libflatpak_common_la-flatpak-chain-input-stream.lo `test -f 'common/flatpak-chain-input-stream.c' || echo '$(srcdir)/'`common/flatpak-chain-input-stream.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-chain-input-stream.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-chain-input-stream.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-chain-input-stream.c' object='common/libflatpak_common_la-flatpak-chain-input-stream.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-chain-input-stream.lo `test -f 'common/flatpak-chain-input-stream.c' || echo '$(srcdir)/'`common/flatpak-chain-input-stream.c
+
+common/gvdb/libflatpak_common_la-gvdb-reader.lo: common/gvdb/gvdb-reader.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/gvdb/libflatpak_common_la-gvdb-reader.lo -MD -MP -MF common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-reader.Tpo -c -o common/gvdb/libflatpak_common_la-gvdb-reader.lo `test -f 'common/gvdb/gvdb-reader.c' || echo '$(srcdir)/'`common/gvdb/gvdb-reader.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-reader.Tpo common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-reader.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/gvdb/gvdb-reader.c' object='common/gvdb/libflatpak_common_la-gvdb-reader.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/gvdb/libflatpak_common_la-gvdb-reader.lo `test -f 'common/gvdb/gvdb-reader.c' || echo '$(srcdir)/'`common/gvdb/gvdb-reader.c
+
+common/gvdb/libflatpak_common_la-gvdb-builder.lo: common/gvdb/gvdb-builder.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/gvdb/libflatpak_common_la-gvdb-builder.lo -MD -MP -MF common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-builder.Tpo -c -o common/gvdb/libflatpak_common_la-gvdb-builder.lo `test -f 'common/gvdb/gvdb-builder.c' || echo '$(srcdir)/'`common/gvdb/gvdb-builder.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-builder.Tpo common/gvdb/$(DEPDIR)/libflatpak_common_la-gvdb-builder.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/gvdb/gvdb-builder.c' object='common/gvdb/libflatpak_common_la-gvdb-builder.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/gvdb/libflatpak_common_la-gvdb-builder.lo `test -f 'common/gvdb/gvdb-builder.c' || echo '$(srcdir)/'`common/gvdb/gvdb-builder.c
+
+common/libflatpak_common_la-flatpak-db.lo: common/flatpak-db.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-db.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-db.Tpo -c -o common/libflatpak_common_la-flatpak-db.lo `test -f 'common/flatpak-db.c' || echo '$(srcdir)/'`common/flatpak-db.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-db.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-db.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-db.c' object='common/libflatpak_common_la-flatpak-db.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-db.lo `test -f 'common/flatpak-db.c' || echo '$(srcdir)/'`common/flatpak-db.c
+
+common/libflatpak_common_la-flatpak-json.lo: common/flatpak-json.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-json.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-json.Tpo -c -o common/libflatpak_common_la-flatpak-json.lo `test -f 'common/flatpak-json.c' || echo '$(srcdir)/'`common/flatpak-json.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-json.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-json.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-json.c' object='common/libflatpak_common_la-flatpak-json.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-json.lo `test -f 'common/flatpak-json.c' || echo '$(srcdir)/'`common/flatpak-json.c
+
+common/libflatpak_common_la-flatpak-json-oci.lo: common/flatpak-json-oci.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-json-oci.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-json-oci.Tpo -c -o common/libflatpak_common_la-flatpak-json-oci.lo `test -f 'common/flatpak-json-oci.c' || echo '$(srcdir)/'`common/flatpak-json-oci.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-json-oci.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-json-oci.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-json-oci.c' object='common/libflatpak_common_la-flatpak-json-oci.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-json-oci.lo `test -f 'common/flatpak-json-oci.c' || echo '$(srcdir)/'`common/flatpak-json-oci.c
+
+common/libflatpak_common_la-flatpak-oci-registry.lo: common/flatpak-oci-registry.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-oci-registry.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-oci-registry.Tpo -c -o common/libflatpak_common_la-flatpak-oci-registry.lo `test -f 'common/flatpak-oci-registry.c' || echo '$(srcdir)/'`common/flatpak-oci-registry.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-oci-registry.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-oci-registry.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-oci-registry.c' object='common/libflatpak_common_la-flatpak-oci-registry.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-oci-registry.lo `test -f 'common/flatpak-oci-registry.c' || echo '$(srcdir)/'`common/flatpak-oci-registry.c
+
+common/libflatpak_common_la-flatpak-dbus.lo: common/flatpak-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-dbus.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-dbus.Tpo -c -o common/libflatpak_common_la-flatpak-dbus.lo `test -f 'common/flatpak-dbus.c' || echo '$(srcdir)/'`common/flatpak-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-dbus.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-dbus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-dbus.c' object='common/libflatpak_common_la-flatpak-dbus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-dbus.lo `test -f 'common/flatpak-dbus.c' || echo '$(srcdir)/'`common/flatpak-dbus.c
+
+common/libflatpak_common_la-flatpak-systemd-dbus.lo: common/flatpak-systemd-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT common/libflatpak_common_la-flatpak-systemd-dbus.lo -MD -MP -MF common/$(DEPDIR)/libflatpak_common_la-flatpak-systemd-dbus.Tpo -c -o common/libflatpak_common_la-flatpak-systemd-dbus.lo `test -f 'common/flatpak-systemd-dbus.c' || echo '$(srcdir)/'`common/flatpak-systemd-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) common/$(DEPDIR)/libflatpak_common_la-flatpak-systemd-dbus.Tpo common/$(DEPDIR)/libflatpak_common_la-flatpak-systemd-dbus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='common/flatpak-systemd-dbus.c' object='common/libflatpak_common_la-flatpak-systemd-dbus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o common/libflatpak_common_la-flatpak-systemd-dbus.lo `test -f 'common/flatpak-systemd-dbus.c' || echo '$(srcdir)/'`common/flatpak-systemd-dbus.c
+
+document-portal/libflatpak_common_la-xdp-dbus.lo: document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -MT document-portal/libflatpak_common_la-xdp-dbus.lo -MD -MP -MF document-portal/$(DEPDIR)/libflatpak_common_la-xdp-dbus.Tpo -c -o document-portal/libflatpak_common_la-xdp-dbus.lo `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/libflatpak_common_la-xdp-dbus.Tpo document-portal/$(DEPDIR)/libflatpak_common_la-xdp-dbus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-dbus.c' object='document-portal/libflatpak_common_la-xdp-dbus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_common_la_CFLAGS) $(CFLAGS) -c -o document-portal/libflatpak_common_la-xdp-dbus.lo `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+
+lib/libflatpak_la-flatpak.lo: lib/flatpak.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak.Tpo -c -o lib/libflatpak_la-flatpak.lo `test -f 'lib/flatpak.c' || echo '$(srcdir)/'`lib/flatpak.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak.c' object='lib/libflatpak_la-flatpak.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak.lo `test -f 'lib/flatpak.c' || echo '$(srcdir)/'`lib/flatpak.c
+
+lib/libflatpak_la-flatpak-ref.lo: lib/flatpak-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-ref.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-ref.Tpo -c -o lib/libflatpak_la-flatpak-ref.lo `test -f 'lib/flatpak-ref.c' || echo '$(srcdir)/'`lib/flatpak-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-ref.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-ref.c' object='lib/libflatpak_la-flatpak-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-ref.lo `test -f 'lib/flatpak-ref.c' || echo '$(srcdir)/'`lib/flatpak-ref.c
+
+lib/libflatpak_la-flatpak-installed-ref.lo: lib/flatpak-installed-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-installed-ref.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-installed-ref.Tpo -c -o lib/libflatpak_la-flatpak-installed-ref.lo `test -f 'lib/flatpak-installed-ref.c' || echo '$(srcdir)/'`lib/flatpak-installed-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-installed-ref.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-installed-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-installed-ref.c' object='lib/libflatpak_la-flatpak-installed-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-installed-ref.lo `test -f 'lib/flatpak-installed-ref.c' || echo '$(srcdir)/'`lib/flatpak-installed-ref.c
+
+lib/libflatpak_la-flatpak-remote-ref.lo: lib/flatpak-remote-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-remote-ref.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-remote-ref.Tpo -c -o lib/libflatpak_la-flatpak-remote-ref.lo `test -f 'lib/flatpak-remote-ref.c' || echo '$(srcdir)/'`lib/flatpak-remote-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-remote-ref.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-remote-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-remote-ref.c' object='lib/libflatpak_la-flatpak-remote-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-remote-ref.lo `test -f 'lib/flatpak-remote-ref.c' || echo '$(srcdir)/'`lib/flatpak-remote-ref.c
+
+lib/libflatpak_la-flatpak-bundle-ref.lo: lib/flatpak-bundle-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-bundle-ref.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-bundle-ref.Tpo -c -o lib/libflatpak_la-flatpak-bundle-ref.lo `test -f 'lib/flatpak-bundle-ref.c' || echo '$(srcdir)/'`lib/flatpak-bundle-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-bundle-ref.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-bundle-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-bundle-ref.c' object='lib/libflatpak_la-flatpak-bundle-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-bundle-ref.lo `test -f 'lib/flatpak-bundle-ref.c' || echo '$(srcdir)/'`lib/flatpak-bundle-ref.c
+
+lib/libflatpak_la-flatpak-related-ref.lo: lib/flatpak-related-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-related-ref.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-related-ref.Tpo -c -o lib/libflatpak_la-flatpak-related-ref.lo `test -f 'lib/flatpak-related-ref.c' || echo '$(srcdir)/'`lib/flatpak-related-ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-related-ref.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-related-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-related-ref.c' object='lib/libflatpak_la-flatpak-related-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-related-ref.lo `test -f 'lib/flatpak-related-ref.c' || echo '$(srcdir)/'`lib/flatpak-related-ref.c
+
+lib/libflatpak_la-flatpak-remote.lo: lib/flatpak-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-remote.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-remote.Tpo -c -o lib/libflatpak_la-flatpak-remote.lo `test -f 'lib/flatpak-remote.c' || echo '$(srcdir)/'`lib/flatpak-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-remote.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-remote.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-remote.c' object='lib/libflatpak_la-flatpak-remote.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-remote.lo `test -f 'lib/flatpak-remote.c' || echo '$(srcdir)/'`lib/flatpak-remote.c
+
+lib/libflatpak_la-flatpak-error.lo: lib/flatpak-error.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-error.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-error.Tpo -c -o lib/libflatpak_la-flatpak-error.lo `test -f 'lib/flatpak-error.c' || echo '$(srcdir)/'`lib/flatpak-error.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-error.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-error.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-error.c' object='lib/libflatpak_la-flatpak-error.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-error.lo `test -f 'lib/flatpak-error.c' || echo '$(srcdir)/'`lib/flatpak-error.c
+
+lib/libflatpak_la-flatpak-installation.lo: lib/flatpak-installation.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-installation.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-installation.Tpo -c -o lib/libflatpak_la-flatpak-installation.lo `test -f 'lib/flatpak-installation.c' || echo '$(srcdir)/'`lib/flatpak-installation.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-installation.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-installation.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-installation.c' object='lib/libflatpak_la-flatpak-installation.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-installation.lo `test -f 'lib/flatpak-installation.c' || echo '$(srcdir)/'`lib/flatpak-installation.c
+
+lib/libflatpak_la-flatpak-enum-types.lo: lib/flatpak-enum-types.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -MT lib/libflatpak_la-flatpak-enum-types.lo -MD -MP -MF lib/$(DEPDIR)/libflatpak_la-flatpak-enum-types.Tpo -c -o lib/libflatpak_la-flatpak-enum-types.lo `test -f 'lib/flatpak-enum-types.c' || echo '$(srcdir)/'`lib/flatpak-enum-types.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libflatpak_la-flatpak-enum-types.Tpo lib/$(DEPDIR)/libflatpak_la-flatpak-enum-types.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-enum-types.c' object='lib/libflatpak_la-flatpak-enum-types.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libflatpak_la_CFLAGS) $(CFLAGS) -c -o lib/libflatpak_la-flatpak-enum-types.lo `test -f 'lib/flatpak-enum-types.c' || echo '$(srcdir)/'`lib/flatpak-enum-types.c
+
+libglnx/libglnx_la-glnx-backports.lo: libglnx/glnx-backports.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-backports.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-backports.Tpo -c -o libglnx/libglnx_la-glnx-backports.lo `test -f 'libglnx/glnx-backports.c' || echo '$(srcdir)/'`libglnx/glnx-backports.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-backports.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-backports.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-backports.c' object='libglnx/libglnx_la-glnx-backports.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-backports.lo `test -f 'libglnx/glnx-backports.c' || echo '$(srcdir)/'`libglnx/glnx-backports.c
+
+libglnx/libglnx_la-glnx-local-alloc.lo: libglnx/glnx-local-alloc.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-local-alloc.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-local-alloc.Tpo -c -o libglnx/libglnx_la-glnx-local-alloc.lo `test -f 'libglnx/glnx-local-alloc.c' || echo '$(srcdir)/'`libglnx/glnx-local-alloc.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-local-alloc.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-local-alloc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-local-alloc.c' object='libglnx/libglnx_la-glnx-local-alloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-local-alloc.lo `test -f 'libglnx/glnx-local-alloc.c' || echo '$(srcdir)/'`libglnx/glnx-local-alloc.c
+
+libglnx/libglnx_la-glnx-errors.lo: libglnx/glnx-errors.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-errors.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-errors.Tpo -c -o libglnx/libglnx_la-glnx-errors.lo `test -f 'libglnx/glnx-errors.c' || echo '$(srcdir)/'`libglnx/glnx-errors.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-errors.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-errors.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-errors.c' object='libglnx/libglnx_la-glnx-errors.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-errors.lo `test -f 'libglnx/glnx-errors.c' || echo '$(srcdir)/'`libglnx/glnx-errors.c
+
+libglnx/libglnx_la-glnx-console.lo: libglnx/glnx-console.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-console.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-console.Tpo -c -o libglnx/libglnx_la-glnx-console.lo `test -f 'libglnx/glnx-console.c' || echo '$(srcdir)/'`libglnx/glnx-console.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-console.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-console.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-console.c' object='libglnx/libglnx_la-glnx-console.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-console.lo `test -f 'libglnx/glnx-console.c' || echo '$(srcdir)/'`libglnx/glnx-console.c
+
+libglnx/libglnx_la-glnx-dirfd.lo: libglnx/glnx-dirfd.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-dirfd.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-dirfd.Tpo -c -o libglnx/libglnx_la-glnx-dirfd.lo `test -f 'libglnx/glnx-dirfd.c' || echo '$(srcdir)/'`libglnx/glnx-dirfd.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-dirfd.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-dirfd.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-dirfd.c' object='libglnx/libglnx_la-glnx-dirfd.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-dirfd.lo `test -f 'libglnx/glnx-dirfd.c' || echo '$(srcdir)/'`libglnx/glnx-dirfd.c
+
+libglnx/libglnx_la-glnx-fdio.lo: libglnx/glnx-fdio.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-fdio.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-fdio.Tpo -c -o libglnx/libglnx_la-glnx-fdio.lo `test -f 'libglnx/glnx-fdio.c' || echo '$(srcdir)/'`libglnx/glnx-fdio.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-fdio.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-fdio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-fdio.c' object='libglnx/libglnx_la-glnx-fdio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-fdio.lo `test -f 'libglnx/glnx-fdio.c' || echo '$(srcdir)/'`libglnx/glnx-fdio.c
+
+libglnx/libglnx_la-glnx-lockfile.lo: libglnx/glnx-lockfile.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-lockfile.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-lockfile.Tpo -c -o libglnx/libglnx_la-glnx-lockfile.lo `test -f 'libglnx/glnx-lockfile.c' || echo '$(srcdir)/'`libglnx/glnx-lockfile.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-lockfile.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-lockfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-lockfile.c' object='libglnx/libglnx_la-glnx-lockfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-lockfile.lo `test -f 'libglnx/glnx-lockfile.c' || echo '$(srcdir)/'`libglnx/glnx-lockfile.c
+
+libglnx/libglnx_la-glnx-xattrs.lo: libglnx/glnx-xattrs.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-xattrs.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-xattrs.Tpo -c -o libglnx/libglnx_la-glnx-xattrs.lo `test -f 'libglnx/glnx-xattrs.c' || echo '$(srcdir)/'`libglnx/glnx-xattrs.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-xattrs.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-xattrs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-xattrs.c' object='libglnx/libglnx_la-glnx-xattrs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-xattrs.lo `test -f 'libglnx/glnx-xattrs.c' || echo '$(srcdir)/'`libglnx/glnx-xattrs.c
+
+libglnx/libglnx_la-glnx-shutil.lo: libglnx/glnx-shutil.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -MT libglnx/libglnx_la-glnx-shutil.lo -MD -MP -MF libglnx/$(DEPDIR)/libglnx_la-glnx-shutil.Tpo -c -o libglnx/libglnx_la-glnx-shutil.lo `test -f 'libglnx/glnx-shutil.c' || echo '$(srcdir)/'`libglnx/glnx-shutil.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/$(DEPDIR)/libglnx_la-glnx-shutil.Tpo libglnx/$(DEPDIR)/libglnx_la-glnx-shutil.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/glnx-shutil.c' object='libglnx/libglnx_la-glnx-shutil.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libglnx_la_CFLAGS) $(CFLAGS) -c -o libglnx/libglnx_la-glnx-shutil.lo `test -f 'libglnx/glnx-shutil.c' || echo '$(srcdir)/'`libglnx/glnx-shutil.c
+
+app/flatpak-flatpak-main.o: app/flatpak-main.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-main.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-main.Tpo -c -o app/flatpak-flatpak-main.o `test -f 'app/flatpak-main.c' || echo '$(srcdir)/'`app/flatpak-main.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-main.Tpo app/$(DEPDIR)/flatpak-flatpak-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-main.c' object='app/flatpak-flatpak-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-main.o `test -f 'app/flatpak-main.c' || echo '$(srcdir)/'`app/flatpak-main.c
+
+app/flatpak-flatpak-main.obj: app/flatpak-main.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-main.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-main.Tpo -c -o app/flatpak-flatpak-main.obj `if test -f 'app/flatpak-main.c'; then $(CYGPATH_W) 'app/flatpak-main.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-main.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-main.Tpo app/$(DEPDIR)/flatpak-flatpak-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-main.c' object='app/flatpak-flatpak-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-main.obj `if test -f 'app/flatpak-main.c'; then $(CYGPATH_W) 'app/flatpak-main.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-main.c'; fi`
+
+app/flatpak-flatpak-builtins-utils.o: app/flatpak-builtins-utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-utils.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Tpo -c -o app/flatpak-flatpak-builtins-utils.o `test -f 'app/flatpak-builtins-utils.c' || echo '$(srcdir)/'`app/flatpak-builtins-utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-utils.c' object='app/flatpak-flatpak-builtins-utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-utils.o `test -f 'app/flatpak-builtins-utils.c' || echo '$(srcdir)/'`app/flatpak-builtins-utils.c
+
+app/flatpak-flatpak-builtins-utils.obj: app/flatpak-builtins-utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-utils.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Tpo -c -o app/flatpak-flatpak-builtins-utils.obj `if test -f 'app/flatpak-builtins-utils.c'; then $(CYGPATH_W) 'app/flatpak-builtins-utils.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-utils.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-utils.c' object='app/flatpak-flatpak-builtins-utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-utils.obj `if test -f 'app/flatpak-builtins-utils.c'; then $(CYGPATH_W) 'app/flatpak-builtins-utils.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-utils.c'; fi`
+
+app/flatpak-flatpak-transaction.o: app/flatpak-transaction.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-transaction.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-transaction.Tpo -c -o app/flatpak-flatpak-transaction.o `test -f 'app/flatpak-transaction.c' || echo '$(srcdir)/'`app/flatpak-transaction.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-transaction.Tpo app/$(DEPDIR)/flatpak-flatpak-transaction.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-transaction.c' object='app/flatpak-flatpak-transaction.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-transaction.o `test -f 'app/flatpak-transaction.c' || echo '$(srcdir)/'`app/flatpak-transaction.c
+
+app/flatpak-flatpak-transaction.obj: app/flatpak-transaction.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-transaction.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-transaction.Tpo -c -o app/flatpak-flatpak-transaction.obj `if test -f 'app/flatpak-transaction.c'; then $(CYGPATH_W) 'app/flatpak-transaction.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-transaction.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-transaction.Tpo app/$(DEPDIR)/flatpak-flatpak-transaction.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-transaction.c' object='app/flatpak-flatpak-transaction.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-transaction.obj `if test -f 'app/flatpak-transaction.c'; then $(CYGPATH_W) 'app/flatpak-transaction.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-transaction.c'; fi`
+
+app/flatpak-flatpak-builtins-add-remote.o: app/flatpak-builtins-add-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-add-remote.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Tpo -c -o app/flatpak-flatpak-builtins-add-remote.o `test -f 'app/flatpak-builtins-add-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-add-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-add-remote.c' object='app/flatpak-flatpak-builtins-add-remote.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-add-remote.o `test -f 'app/flatpak-builtins-add-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-add-remote.c
+
+app/flatpak-flatpak-builtins-add-remote.obj: app/flatpak-builtins-add-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-add-remote.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Tpo -c -o app/flatpak-flatpak-builtins-add-remote.obj `if test -f 'app/flatpak-builtins-add-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-add-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-add-remote.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-add-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-add-remote.c' object='app/flatpak-flatpak-builtins-add-remote.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-add-remote.obj `if test -f 'app/flatpak-builtins-add-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-add-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-add-remote.c'; fi`
+
+app/flatpak-flatpak-builtins-delete-remote.o: app/flatpak-builtins-delete-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-delete-remote.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Tpo -c -o app/flatpak-flatpak-builtins-delete-remote.o `test -f 'app/flatpak-builtins-delete-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-delete-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-delete-remote.c' object='app/flatpak-flatpak-builtins-delete-remote.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-delete-remote.o `test -f 'app/flatpak-builtins-delete-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-delete-remote.c
+
+app/flatpak-flatpak-builtins-delete-remote.obj: app/flatpak-builtins-delete-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-delete-remote.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Tpo -c -o app/flatpak-flatpak-builtins-delete-remote.obj `if test -f 'app/flatpak-builtins-delete-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-delete-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-delete-remote.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-delete-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-delete-remote.c' object='app/flatpak-flatpak-builtins-delete-remote.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-delete-remote.obj `if test -f 'app/flatpak-builtins-delete-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-delete-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-delete-remote.c'; fi`
+
+app/flatpak-flatpak-builtins-list-remotes.o: app/flatpak-builtins-list-remotes.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-list-remotes.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Tpo -c -o app/flatpak-flatpak-builtins-list-remotes.o `test -f 'app/flatpak-builtins-list-remotes.c' || echo '$(srcdir)/'`app/flatpak-builtins-list-remotes.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-list-remotes.c' object='app/flatpak-flatpak-builtins-list-remotes.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-list-remotes.o `test -f 'app/flatpak-builtins-list-remotes.c' || echo '$(srcdir)/'`app/flatpak-builtins-list-remotes.c
+
+app/flatpak-flatpak-builtins-list-remotes.obj: app/flatpak-builtins-list-remotes.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-list-remotes.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Tpo -c -o app/flatpak-flatpak-builtins-list-remotes.obj `if test -f 'app/flatpak-builtins-list-remotes.c'; then $(CYGPATH_W) 'app/flatpak-builtins-list-remotes.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-list-remotes.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-list-remotes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-list-remotes.c' object='app/flatpak-flatpak-builtins-list-remotes.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-list-remotes.obj `if test -f 'app/flatpak-builtins-list-remotes.c'; then $(CYGPATH_W) 'app/flatpak-builtins-list-remotes.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-list-remotes.c'; fi`
+
+app/flatpak-flatpak-builtins-ls-remote.o: app/flatpak-builtins-ls-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-ls-remote.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Tpo -c -o app/flatpak-flatpak-builtins-ls-remote.o `test -f 'app/flatpak-builtins-ls-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-ls-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-ls-remote.c' object='app/flatpak-flatpak-builtins-ls-remote.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-ls-remote.o `test -f 'app/flatpak-builtins-ls-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-ls-remote.c
+
+app/flatpak-flatpak-builtins-ls-remote.obj: app/flatpak-builtins-ls-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-ls-remote.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Tpo -c -o app/flatpak-flatpak-builtins-ls-remote.obj `if test -f 'app/flatpak-builtins-ls-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-ls-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-ls-remote.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-ls-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-ls-remote.c' object='app/flatpak-flatpak-builtins-ls-remote.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-ls-remote.obj `if test -f 'app/flatpak-builtins-ls-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-ls-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-ls-remote.c'; fi`
+
+app/flatpak-flatpak-builtins-info-remote.o: app/flatpak-builtins-info-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-info-remote.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Tpo -c -o app/flatpak-flatpak-builtins-info-remote.o `test -f 'app/flatpak-builtins-info-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-info-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-info-remote.c' object='app/flatpak-flatpak-builtins-info-remote.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-info-remote.o `test -f 'app/flatpak-builtins-info-remote.c' || echo '$(srcdir)/'`app/flatpak-builtins-info-remote.c
+
+app/flatpak-flatpak-builtins-info-remote.obj: app/flatpak-builtins-info-remote.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-info-remote.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Tpo -c -o app/flatpak-flatpak-builtins-info-remote.obj `if test -f 'app/flatpak-builtins-info-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-info-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-info-remote.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-info-remote.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-info-remote.c' object='app/flatpak-flatpak-builtins-info-remote.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-info-remote.obj `if test -f 'app/flatpak-builtins-info-remote.c'; then $(CYGPATH_W) 'app/flatpak-builtins-info-remote.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-info-remote.c'; fi`
+
+app/flatpak-flatpak-builtins-install.o: app/flatpak-builtins-install.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-install.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-install.Tpo -c -o app/flatpak-flatpak-builtins-install.o `test -f 'app/flatpak-builtins-install.c' || echo '$(srcdir)/'`app/flatpak-builtins-install.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-install.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-install.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-install.c' object='app/flatpak-flatpak-builtins-install.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-install.o `test -f 'app/flatpak-builtins-install.c' || echo '$(srcdir)/'`app/flatpak-builtins-install.c
+
+app/flatpak-flatpak-builtins-install.obj: app/flatpak-builtins-install.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-install.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-install.Tpo -c -o app/flatpak-flatpak-builtins-install.obj `if test -f 'app/flatpak-builtins-install.c'; then $(CYGPATH_W) 'app/flatpak-builtins-install.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-install.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-install.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-install.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-install.c' object='app/flatpak-flatpak-builtins-install.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-install.obj `if test -f 'app/flatpak-builtins-install.c'; then $(CYGPATH_W) 'app/flatpak-builtins-install.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-install.c'; fi`
+
+app/flatpak-flatpak-builtins-override.o: app/flatpak-builtins-override.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-override.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-override.Tpo -c -o app/flatpak-flatpak-builtins-override.o `test -f 'app/flatpak-builtins-override.c' || echo '$(srcdir)/'`app/flatpak-builtins-override.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-override.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-override.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-override.c' object='app/flatpak-flatpak-builtins-override.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-override.o `test -f 'app/flatpak-builtins-override.c' || echo '$(srcdir)/'`app/flatpak-builtins-override.c
+
+app/flatpak-flatpak-builtins-override.obj: app/flatpak-builtins-override.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-override.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-override.Tpo -c -o app/flatpak-flatpak-builtins-override.obj `if test -f 'app/flatpak-builtins-override.c'; then $(CYGPATH_W) 'app/flatpak-builtins-override.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-override.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-override.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-override.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-override.c' object='app/flatpak-flatpak-builtins-override.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-override.obj `if test -f 'app/flatpak-builtins-override.c'; then $(CYGPATH_W) 'app/flatpak-builtins-override.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-override.c'; fi`
+
+app/flatpak-flatpak-builtins-make-current.o: app/flatpak-builtins-make-current.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-make-current.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Tpo -c -o app/flatpak-flatpak-builtins-make-current.o `test -f 'app/flatpak-builtins-make-current.c' || echo '$(srcdir)/'`app/flatpak-builtins-make-current.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-make-current.c' object='app/flatpak-flatpak-builtins-make-current.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-make-current.o `test -f 'app/flatpak-builtins-make-current.c' || echo '$(srcdir)/'`app/flatpak-builtins-make-current.c
+
+app/flatpak-flatpak-builtins-make-current.obj: app/flatpak-builtins-make-current.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-make-current.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Tpo -c -o app/flatpak-flatpak-builtins-make-current.obj `if test -f 'app/flatpak-builtins-make-current.c'; then $(CYGPATH_W) 'app/flatpak-builtins-make-current.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-make-current.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-make-current.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-make-current.c' object='app/flatpak-flatpak-builtins-make-current.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-make-current.obj `if test -f 'app/flatpak-builtins-make-current.c'; then $(CYGPATH_W) 'app/flatpak-builtins-make-current.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-make-current.c'; fi`
+
+app/flatpak-flatpak-builtins-update.o: app/flatpak-builtins-update.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-update.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-update.Tpo -c -o app/flatpak-flatpak-builtins-update.o `test -f 'app/flatpak-builtins-update.c' || echo '$(srcdir)/'`app/flatpak-builtins-update.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-update.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-update.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-update.c' object='app/flatpak-flatpak-builtins-update.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-update.o `test -f 'app/flatpak-builtins-update.c' || echo '$(srcdir)/'`app/flatpak-builtins-update.c
+
+app/flatpak-flatpak-builtins-update.obj: app/flatpak-builtins-update.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-update.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-update.Tpo -c -o app/flatpak-flatpak-builtins-update.obj `if test -f 'app/flatpak-builtins-update.c'; then $(CYGPATH_W) 'app/flatpak-builtins-update.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-update.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-update.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-update.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-update.c' object='app/flatpak-flatpak-builtins-update.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-update.obj `if test -f 'app/flatpak-builtins-update.c'; then $(CYGPATH_W) 'app/flatpak-builtins-update.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-update.c'; fi`
+
+app/flatpak-flatpak-builtins-uninstall.o: app/flatpak-builtins-uninstall.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-uninstall.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Tpo -c -o app/flatpak-flatpak-builtins-uninstall.o `test -f 'app/flatpak-builtins-uninstall.c' || echo '$(srcdir)/'`app/flatpak-builtins-uninstall.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-uninstall.c' object='app/flatpak-flatpak-builtins-uninstall.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-uninstall.o `test -f 'app/flatpak-builtins-uninstall.c' || echo '$(srcdir)/'`app/flatpak-builtins-uninstall.c
+
+app/flatpak-flatpak-builtins-uninstall.obj: app/flatpak-builtins-uninstall.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-uninstall.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Tpo -c -o app/flatpak-flatpak-builtins-uninstall.obj `if test -f 'app/flatpak-builtins-uninstall.c'; then $(CYGPATH_W) 'app/flatpak-builtins-uninstall.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-uninstall.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-uninstall.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-uninstall.c' object='app/flatpak-flatpak-builtins-uninstall.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-uninstall.obj `if test -f 'app/flatpak-builtins-uninstall.c'; then $(CYGPATH_W) 'app/flatpak-builtins-uninstall.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-uninstall.c'; fi`
+
+app/flatpak-flatpak-builtins-list.o: app/flatpak-builtins-list.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-list.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-list.Tpo -c -o app/flatpak-flatpak-builtins-list.o `test -f 'app/flatpak-builtins-list.c' || echo '$(srcdir)/'`app/flatpak-builtins-list.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-list.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-list.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-list.c' object='app/flatpak-flatpak-builtins-list.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-list.o `test -f 'app/flatpak-builtins-list.c' || echo '$(srcdir)/'`app/flatpak-builtins-list.c
+
+app/flatpak-flatpak-builtins-list.obj: app/flatpak-builtins-list.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-list.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-list.Tpo -c -o app/flatpak-flatpak-builtins-list.obj `if test -f 'app/flatpak-builtins-list.c'; then $(CYGPATH_W) 'app/flatpak-builtins-list.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-list.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-list.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-list.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-list.c' object='app/flatpak-flatpak-builtins-list.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-list.obj `if test -f 'app/flatpak-builtins-list.c'; then $(CYGPATH_W) 'app/flatpak-builtins-list.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-list.c'; fi`
+
+app/flatpak-flatpak-builtins-info.o: app/flatpak-builtins-info.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-info.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-info.Tpo -c -o app/flatpak-flatpak-builtins-info.o `test -f 'app/flatpak-builtins-info.c' || echo '$(srcdir)/'`app/flatpak-builtins-info.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-info.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-info.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-info.c' object='app/flatpak-flatpak-builtins-info.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-info.o `test -f 'app/flatpak-builtins-info.c' || echo '$(srcdir)/'`app/flatpak-builtins-info.c
+
+app/flatpak-flatpak-builtins-info.obj: app/flatpak-builtins-info.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-info.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-info.Tpo -c -o app/flatpak-flatpak-builtins-info.obj `if test -f 'app/flatpak-builtins-info.c'; then $(CYGPATH_W) 'app/flatpak-builtins-info.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-info.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-info.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-info.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-info.c' object='app/flatpak-flatpak-builtins-info.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-info.obj `if test -f 'app/flatpak-builtins-info.c'; then $(CYGPATH_W) 'app/flatpak-builtins-info.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-info.c'; fi`
+
+app/flatpak-flatpak-builtins-config.o: app/flatpak-builtins-config.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-config.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-config.Tpo -c -o app/flatpak-flatpak-builtins-config.o `test -f 'app/flatpak-builtins-config.c' || echo '$(srcdir)/'`app/flatpak-builtins-config.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-config.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-config.c' object='app/flatpak-flatpak-builtins-config.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-config.o `test -f 'app/flatpak-builtins-config.c' || echo '$(srcdir)/'`app/flatpak-builtins-config.c
+
+app/flatpak-flatpak-builtins-config.obj: app/flatpak-builtins-config.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-config.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-config.Tpo -c -o app/flatpak-flatpak-builtins-config.obj `if test -f 'app/flatpak-builtins-config.c'; then $(CYGPATH_W) 'app/flatpak-builtins-config.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-config.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-config.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-config.c' object='app/flatpak-flatpak-builtins-config.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-config.obj `if test -f 'app/flatpak-builtins-config.c'; then $(CYGPATH_W) 'app/flatpak-builtins-config.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-config.c'; fi`
+
+app/flatpak-flatpak-builtins-run.o: app/flatpak-builtins-run.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-run.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-run.Tpo -c -o app/flatpak-flatpak-builtins-run.o `test -f 'app/flatpak-builtins-run.c' || echo '$(srcdir)/'`app/flatpak-builtins-run.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-run.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-run.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-run.c' object='app/flatpak-flatpak-builtins-run.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-run.o `test -f 'app/flatpak-builtins-run.c' || echo '$(srcdir)/'`app/flatpak-builtins-run.c
+
+app/flatpak-flatpak-builtins-run.obj: app/flatpak-builtins-run.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-run.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-run.Tpo -c -o app/flatpak-flatpak-builtins-run.obj `if test -f 'app/flatpak-builtins-run.c'; then $(CYGPATH_W) 'app/flatpak-builtins-run.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-run.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-run.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-run.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-run.c' object='app/flatpak-flatpak-builtins-run.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-run.obj `if test -f 'app/flatpak-builtins-run.c'; then $(CYGPATH_W) 'app/flatpak-builtins-run.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-run.c'; fi`
+
+app/flatpak-flatpak-builtins-enter.o: app/flatpak-builtins-enter.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-enter.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Tpo -c -o app/flatpak-flatpak-builtins-enter.o `test -f 'app/flatpak-builtins-enter.c' || echo '$(srcdir)/'`app/flatpak-builtins-enter.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-enter.c' object='app/flatpak-flatpak-builtins-enter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-enter.o `test -f 'app/flatpak-builtins-enter.c' || echo '$(srcdir)/'`app/flatpak-builtins-enter.c
+
+app/flatpak-flatpak-builtins-enter.obj: app/flatpak-builtins-enter.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-enter.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Tpo -c -o app/flatpak-flatpak-builtins-enter.obj `if test -f 'app/flatpak-builtins-enter.c'; then $(CYGPATH_W) 'app/flatpak-builtins-enter.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-enter.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-enter.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-enter.c' object='app/flatpak-flatpak-builtins-enter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-enter.obj `if test -f 'app/flatpak-builtins-enter.c'; then $(CYGPATH_W) 'app/flatpak-builtins-enter.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-enter.c'; fi`
+
+app/flatpak-flatpak-builtins-build-init.o: app/flatpak-builtins-build-init.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-init.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Tpo -c -o app/flatpak-flatpak-builtins-build-init.o `test -f 'app/flatpak-builtins-build-init.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-init.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-init.c' object='app/flatpak-flatpak-builtins-build-init.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-init.o `test -f 'app/flatpak-builtins-build-init.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-init.c
+
+app/flatpak-flatpak-builtins-build-init.obj: app/flatpak-builtins-build-init.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-init.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Tpo -c -o app/flatpak-flatpak-builtins-build-init.obj `if test -f 'app/flatpak-builtins-build-init.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-init.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-init.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-init.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-init.c' object='app/flatpak-flatpak-builtins-build-init.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-init.obj `if test -f 'app/flatpak-builtins-build-init.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-init.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-init.c'; fi`
+
+app/flatpak-flatpak-builtins-build.o: app/flatpak-builtins-build.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build.Tpo -c -o app/flatpak-flatpak-builtins-build.o `test -f 'app/flatpak-builtins-build.c' || echo '$(srcdir)/'`app/flatpak-builtins-build.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build.c' object='app/flatpak-flatpak-builtins-build.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build.o `test -f 'app/flatpak-builtins-build.c' || echo '$(srcdir)/'`app/flatpak-builtins-build.c
+
+app/flatpak-flatpak-builtins-build.obj: app/flatpak-builtins-build.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build.Tpo -c -o app/flatpak-flatpak-builtins-build.obj `if test -f 'app/flatpak-builtins-build.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build.c' object='app/flatpak-flatpak-builtins-build.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build.obj `if test -f 'app/flatpak-builtins-build.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build.c'; fi`
+
+app/flatpak-flatpak-builtins-build-finish.o: app/flatpak-builtins-build-finish.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-finish.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Tpo -c -o app/flatpak-flatpak-builtins-build-finish.o `test -f 'app/flatpak-builtins-build-finish.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-finish.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-finish.c' object='app/flatpak-flatpak-builtins-build-finish.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-finish.o `test -f 'app/flatpak-builtins-build-finish.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-finish.c
+
+app/flatpak-flatpak-builtins-build-finish.obj: app/flatpak-builtins-build-finish.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-finish.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Tpo -c -o app/flatpak-flatpak-builtins-build-finish.obj `if test -f 'app/flatpak-builtins-build-finish.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-finish.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-finish.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-finish.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-finish.c' object='app/flatpak-flatpak-builtins-build-finish.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-finish.obj `if test -f 'app/flatpak-builtins-build-finish.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-finish.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-finish.c'; fi`
+
+app/flatpak-flatpak-builtins-build-export.o: app/flatpak-builtins-build-export.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-export.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Tpo -c -o app/flatpak-flatpak-builtins-build-export.o `test -f 'app/flatpak-builtins-build-export.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-export.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-export.c' object='app/flatpak-flatpak-builtins-build-export.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-export.o `test -f 'app/flatpak-builtins-build-export.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-export.c
+
+app/flatpak-flatpak-builtins-build-export.obj: app/flatpak-builtins-build-export.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-export.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Tpo -c -o app/flatpak-flatpak-builtins-build-export.obj `if test -f 'app/flatpak-builtins-build-export.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-export.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-export.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-export.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-export.c' object='app/flatpak-flatpak-builtins-build-export.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-export.obj `if test -f 'app/flatpak-builtins-build-export.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-export.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-export.c'; fi`
+
+app/flatpak-flatpak-builtins-build-bundle.o: app/flatpak-builtins-build-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-bundle.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Tpo -c -o app/flatpak-flatpak-builtins-build-bundle.o `test -f 'app/flatpak-builtins-build-bundle.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-bundle.c' object='app/flatpak-flatpak-builtins-build-bundle.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-bundle.o `test -f 'app/flatpak-builtins-build-bundle.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-bundle.c
+
+app/flatpak-flatpak-builtins-build-bundle.obj: app/flatpak-builtins-build-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-bundle.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Tpo -c -o app/flatpak-flatpak-builtins-build-bundle.obj `if test -f 'app/flatpak-builtins-build-bundle.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-bundle.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-bundle.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-bundle.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-bundle.c' object='app/flatpak-flatpak-builtins-build-bundle.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-bundle.obj `if test -f 'app/flatpak-builtins-build-bundle.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-bundle.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-bundle.c'; fi`
+
+app/flatpak-flatpak-builtins-build-import-bundle.o: app/flatpak-builtins-build-import-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-import-bundle.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Tpo -c -o app/flatpak-flatpak-builtins-build-import-bundle.o `test -f 'app/flatpak-builtins-build-import-bundle.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-import-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-import-bundle.c' object='app/flatpak-flatpak-builtins-build-import-bundle.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-import-bundle.o `test -f 'app/flatpak-builtins-build-import-bundle.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-import-bundle.c
+
+app/flatpak-flatpak-builtins-build-import-bundle.obj: app/flatpak-builtins-build-import-bundle.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-import-bundle.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Tpo -c -o app/flatpak-flatpak-builtins-build-import-bundle.obj `if test -f 'app/flatpak-builtins-build-import-bundle.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-import-bundle.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-import-bundle.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-import-bundle.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-import-bundle.c' object='app/flatpak-flatpak-builtins-build-import-bundle.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-import-bundle.obj `if test -f 'app/flatpak-builtins-build-import-bundle.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-import-bundle.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-import-bundle.c'; fi`
+
+app/flatpak-flatpak-builtins-build-commit-from.o: app/flatpak-builtins-build-commit-from.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-commit-from.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Tpo -c -o app/flatpak-flatpak-builtins-build-commit-from.o `test -f 'app/flatpak-builtins-build-commit-from.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-commit-from.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-commit-from.c' object='app/flatpak-flatpak-builtins-build-commit-from.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-commit-from.o `test -f 'app/flatpak-builtins-build-commit-from.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-commit-from.c
+
+app/flatpak-flatpak-builtins-build-commit-from.obj: app/flatpak-builtins-build-commit-from.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-commit-from.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Tpo -c -o app/flatpak-flatpak-builtins-build-commit-from.obj `if test -f 'app/flatpak-builtins-build-commit-from.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-commit-from.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-commit-from.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-commit-from.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-commit-from.c' object='app/flatpak-flatpak-builtins-build-commit-from.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-commit-from.obj `if test -f 'app/flatpak-builtins-build-commit-from.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-commit-from.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-commit-from.c'; fi`
+
+app/flatpak-flatpak-builtins-build-sign.o: app/flatpak-builtins-build-sign.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-sign.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Tpo -c -o app/flatpak-flatpak-builtins-build-sign.o `test -f 'app/flatpak-builtins-build-sign.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-sign.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-sign.c' object='app/flatpak-flatpak-builtins-build-sign.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-sign.o `test -f 'app/flatpak-builtins-build-sign.c' || echo '$(srcdir)/'`app/flatpak-builtins-build-sign.c
+
+app/flatpak-flatpak-builtins-build-sign.obj: app/flatpak-builtins-build-sign.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-build-sign.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Tpo -c -o app/flatpak-flatpak-builtins-build-sign.obj `if test -f 'app/flatpak-builtins-build-sign.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-sign.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-sign.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-build-sign.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-build-sign.c' object='app/flatpak-flatpak-builtins-build-sign.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-build-sign.obj `if test -f 'app/flatpak-builtins-build-sign.c'; then $(CYGPATH_W) 'app/flatpak-builtins-build-sign.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-build-sign.c'; fi`
+
+app/flatpak-flatpak-builtins-repo-update.o: app/flatpak-builtins-repo-update.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-repo-update.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Tpo -c -o app/flatpak-flatpak-builtins-repo-update.o `test -f 'app/flatpak-builtins-repo-update.c' || echo '$(srcdir)/'`app/flatpak-builtins-repo-update.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-repo-update.c' object='app/flatpak-flatpak-builtins-repo-update.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-repo-update.o `test -f 'app/flatpak-builtins-repo-update.c' || echo '$(srcdir)/'`app/flatpak-builtins-repo-update.c
+
+app/flatpak-flatpak-builtins-repo-update.obj: app/flatpak-builtins-repo-update.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-repo-update.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Tpo -c -o app/flatpak-flatpak-builtins-repo-update.obj `if test -f 'app/flatpak-builtins-repo-update.c'; then $(CYGPATH_W) 'app/flatpak-builtins-repo-update.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-repo-update.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-repo-update.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-repo-update.c' object='app/flatpak-flatpak-builtins-repo-update.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-repo-update.obj `if test -f 'app/flatpak-builtins-repo-update.c'; then $(CYGPATH_W) 'app/flatpak-builtins-repo-update.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-repo-update.c'; fi`
+
+app/flatpak-flatpak-builtins-repo.o: app/flatpak-builtins-repo.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-repo.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Tpo -c -o app/flatpak-flatpak-builtins-repo.o `test -f 'app/flatpak-builtins-repo.c' || echo '$(srcdir)/'`app/flatpak-builtins-repo.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-repo.c' object='app/flatpak-flatpak-builtins-repo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-repo.o `test -f 'app/flatpak-builtins-repo.c' || echo '$(srcdir)/'`app/flatpak-builtins-repo.c
+
+app/flatpak-flatpak-builtins-repo.obj: app/flatpak-builtins-repo.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-repo.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Tpo -c -o app/flatpak-flatpak-builtins-repo.obj `if test -f 'app/flatpak-builtins-repo.c'; then $(CYGPATH_W) 'app/flatpak-builtins-repo.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-repo.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-repo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-repo.c' object='app/flatpak-flatpak-builtins-repo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-repo.obj `if test -f 'app/flatpak-builtins-repo.c'; then $(CYGPATH_W) 'app/flatpak-builtins-repo.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-repo.c'; fi`
+
+app/flatpak-flatpak-builtins-document-export.o: app/flatpak-builtins-document-export.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-export.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Tpo -c -o app/flatpak-flatpak-builtins-document-export.o `test -f 'app/flatpak-builtins-document-export.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-export.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-export.c' object='app/flatpak-flatpak-builtins-document-export.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-export.o `test -f 'app/flatpak-builtins-document-export.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-export.c
+
+app/flatpak-flatpak-builtins-document-export.obj: app/flatpak-builtins-document-export.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-export.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Tpo -c -o app/flatpak-flatpak-builtins-document-export.obj `if test -f 'app/flatpak-builtins-document-export.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-export.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-export.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-export.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-export.c' object='app/flatpak-flatpak-builtins-document-export.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-export.obj `if test -f 'app/flatpak-builtins-document-export.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-export.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-export.c'; fi`
+
+app/flatpak-flatpak-builtins-document-unexport.o: app/flatpak-builtins-document-unexport.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-unexport.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Tpo -c -o app/flatpak-flatpak-builtins-document-unexport.o `test -f 'app/flatpak-builtins-document-unexport.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-unexport.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-unexport.c' object='app/flatpak-flatpak-builtins-document-unexport.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-unexport.o `test -f 'app/flatpak-builtins-document-unexport.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-unexport.c
+
+app/flatpak-flatpak-builtins-document-unexport.obj: app/flatpak-builtins-document-unexport.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-unexport.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Tpo -c -o app/flatpak-flatpak-builtins-document-unexport.obj `if test -f 'app/flatpak-builtins-document-unexport.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-unexport.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-unexport.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-unexport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-unexport.c' object='app/flatpak-flatpak-builtins-document-unexport.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-unexport.obj `if test -f 'app/flatpak-builtins-document-unexport.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-unexport.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-unexport.c'; fi`
+
+app/flatpak-flatpak-builtins-document-info.o: app/flatpak-builtins-document-info.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-info.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Tpo -c -o app/flatpak-flatpak-builtins-document-info.o `test -f 'app/flatpak-builtins-document-info.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-info.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-info.c' object='app/flatpak-flatpak-builtins-document-info.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-info.o `test -f 'app/flatpak-builtins-document-info.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-info.c
+
+app/flatpak-flatpak-builtins-document-info.obj: app/flatpak-builtins-document-info.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-info.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Tpo -c -o app/flatpak-flatpak-builtins-document-info.obj `if test -f 'app/flatpak-builtins-document-info.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-info.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-info.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-info.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-info.c' object='app/flatpak-flatpak-builtins-document-info.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-info.obj `if test -f 'app/flatpak-builtins-document-info.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-info.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-info.c'; fi`
+
+app/flatpak-flatpak-builtins-document-list.o: app/flatpak-builtins-document-list.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-list.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Tpo -c -o app/flatpak-flatpak-builtins-document-list.o `test -f 'app/flatpak-builtins-document-list.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-list.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-list.c' object='app/flatpak-flatpak-builtins-document-list.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-list.o `test -f 'app/flatpak-builtins-document-list.c' || echo '$(srcdir)/'`app/flatpak-builtins-document-list.c
+
+app/flatpak-flatpak-builtins-document-list.obj: app/flatpak-builtins-document-list.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-document-list.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Tpo -c -o app/flatpak-flatpak-builtins-document-list.obj `if test -f 'app/flatpak-builtins-document-list.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-list.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-list.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-document-list.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-document-list.c' object='app/flatpak-flatpak-builtins-document-list.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-document-list.obj `if test -f 'app/flatpak-builtins-document-list.c'; then $(CYGPATH_W) 'app/flatpak-builtins-document-list.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-document-list.c'; fi`
+
+app/flatpak-flatpak-builtins-search.o: app/flatpak-builtins-search.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-search.o -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-search.Tpo -c -o app/flatpak-flatpak-builtins-search.o `test -f 'app/flatpak-builtins-search.c' || echo '$(srcdir)/'`app/flatpak-builtins-search.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-search.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-search.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-search.c' object='app/flatpak-flatpak-builtins-search.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-search.o `test -f 'app/flatpak-builtins-search.c' || echo '$(srcdir)/'`app/flatpak-builtins-search.c
+
+app/flatpak-flatpak-builtins-search.obj: app/flatpak-builtins-search.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -MT app/flatpak-flatpak-builtins-search.obj -MD -MP -MF app/$(DEPDIR)/flatpak-flatpak-builtins-search.Tpo -c -o app/flatpak-flatpak-builtins-search.obj `if test -f 'app/flatpak-builtins-search.c'; then $(CYGPATH_W) 'app/flatpak-builtins-search.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-search.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) app/$(DEPDIR)/flatpak-flatpak-builtins-search.Tpo app/$(DEPDIR)/flatpak-flatpak-builtins-search.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='app/flatpak-builtins-search.c' object='app/flatpak-flatpak-builtins-search.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_CFLAGS) $(CFLAGS) -c -o app/flatpak-flatpak-builtins-search.obj `if test -f 'app/flatpak-builtins-search.c'; then $(CYGPATH_W) 'app/flatpak-builtins-search.c'; else $(CYGPATH_W) '$(srcdir)/app/flatpak-builtins-search.c'; fi`
+
+bubblewrap/flatpak_bwrap-bubblewrap.o: bubblewrap/bubblewrap.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-bubblewrap.o -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Tpo -c -o bubblewrap/flatpak_bwrap-bubblewrap.o `test -f 'bubblewrap/bubblewrap.c' || echo '$(srcdir)/'`bubblewrap/bubblewrap.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/bubblewrap.c' object='bubblewrap/flatpak_bwrap-bubblewrap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-bubblewrap.o `test -f 'bubblewrap/bubblewrap.c' || echo '$(srcdir)/'`bubblewrap/bubblewrap.c
+
+bubblewrap/flatpak_bwrap-bubblewrap.obj: bubblewrap/bubblewrap.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-bubblewrap.obj -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Tpo -c -o bubblewrap/flatpak_bwrap-bubblewrap.obj `if test -f 'bubblewrap/bubblewrap.c'; then $(CYGPATH_W) 'bubblewrap/bubblewrap.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/bubblewrap.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-bubblewrap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/bubblewrap.c' object='bubblewrap/flatpak_bwrap-bubblewrap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-bubblewrap.obj `if test -f 'bubblewrap/bubblewrap.c'; then $(CYGPATH_W) 'bubblewrap/bubblewrap.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/bubblewrap.c'; fi`
+
+bubblewrap/flatpak_bwrap-bind-mount.o: bubblewrap/bind-mount.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-bind-mount.o -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Tpo -c -o bubblewrap/flatpak_bwrap-bind-mount.o `test -f 'bubblewrap/bind-mount.c' || echo '$(srcdir)/'`bubblewrap/bind-mount.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/bind-mount.c' object='bubblewrap/flatpak_bwrap-bind-mount.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-bind-mount.o `test -f 'bubblewrap/bind-mount.c' || echo '$(srcdir)/'`bubblewrap/bind-mount.c
+
+bubblewrap/flatpak_bwrap-bind-mount.obj: bubblewrap/bind-mount.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-bind-mount.obj -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Tpo -c -o bubblewrap/flatpak_bwrap-bind-mount.obj `if test -f 'bubblewrap/bind-mount.c'; then $(CYGPATH_W) 'bubblewrap/bind-mount.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/bind-mount.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-bind-mount.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/bind-mount.c' object='bubblewrap/flatpak_bwrap-bind-mount.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-bind-mount.obj `if test -f 'bubblewrap/bind-mount.c'; then $(CYGPATH_W) 'bubblewrap/bind-mount.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/bind-mount.c'; fi`
+
+bubblewrap/flatpak_bwrap-network.o: bubblewrap/network.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-network.o -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Tpo -c -o bubblewrap/flatpak_bwrap-network.o `test -f 'bubblewrap/network.c' || echo '$(srcdir)/'`bubblewrap/network.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/network.c' object='bubblewrap/flatpak_bwrap-network.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-network.o `test -f 'bubblewrap/network.c' || echo '$(srcdir)/'`bubblewrap/network.c
+
+bubblewrap/flatpak_bwrap-network.obj: bubblewrap/network.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-network.obj -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Tpo -c -o bubblewrap/flatpak_bwrap-network.obj `if test -f 'bubblewrap/network.c'; then $(CYGPATH_W) 'bubblewrap/network.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/network.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-network.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/network.c' object='bubblewrap/flatpak_bwrap-network.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-network.obj `if test -f 'bubblewrap/network.c'; then $(CYGPATH_W) 'bubblewrap/network.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/network.c'; fi`
+
+bubblewrap/flatpak_bwrap-utils.o: bubblewrap/utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-utils.o -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Tpo -c -o bubblewrap/flatpak_bwrap-utils.o `test -f 'bubblewrap/utils.c' || echo '$(srcdir)/'`bubblewrap/utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/utils.c' object='bubblewrap/flatpak_bwrap-utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-utils.o `test -f 'bubblewrap/utils.c' || echo '$(srcdir)/'`bubblewrap/utils.c
+
+bubblewrap/flatpak_bwrap-utils.obj: bubblewrap/utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -MT bubblewrap/flatpak_bwrap-utils.obj -MD -MP -MF bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Tpo -c -o bubblewrap/flatpak_bwrap-utils.obj `if test -f 'bubblewrap/utils.c'; then $(CYGPATH_W) 'bubblewrap/utils.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/utils.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Tpo bubblewrap/$(DEPDIR)/flatpak_bwrap-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='bubblewrap/utils.c' object='bubblewrap/flatpak_bwrap-utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_bwrap_CFLAGS) $(CFLAGS) -c -o bubblewrap/flatpak_bwrap-utils.obj `if test -f 'bubblewrap/utils.c'; then $(CYGPATH_W) 'bubblewrap/utils.c'; else $(CYGPATH_W) '$(srcdir)/bubblewrap/utils.c'; fi`
+
+dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.o: dbus-proxy/flatpak-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -MT dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.o -MD -MP -MF dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Tpo -c -o dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.o `test -f 'dbus-proxy/flatpak-proxy.c' || echo '$(srcdir)/'`dbus-proxy/flatpak-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Tpo dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='dbus-proxy/flatpak-proxy.c' object='dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -c -o dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.o `test -f 'dbus-proxy/flatpak-proxy.c' || echo '$(srcdir)/'`dbus-proxy/flatpak-proxy.c
+
+dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.obj: dbus-proxy/flatpak-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -MT dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.obj -MD -MP -MF dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Tpo -c -o dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.obj `if test -f 'dbus-proxy/flatpak-proxy.c'; then $(CYGPATH_W) 'dbus-proxy/flatpak-proxy.c'; else $(CYGPATH_W) '$(srcdir)/dbus-proxy/flatpak-proxy.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Tpo dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-flatpak-proxy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='dbus-proxy/flatpak-proxy.c' object='dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -c -o dbus-proxy/flatpak_dbus_proxy-flatpak-proxy.obj `if test -f 'dbus-proxy/flatpak-proxy.c'; then $(CYGPATH_W) 'dbus-proxy/flatpak-proxy.c'; else $(CYGPATH_W) '$(srcdir)/dbus-proxy/flatpak-proxy.c'; fi`
+
+dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o: dbus-proxy/dbus-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -MT dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o -MD -MP -MF dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Tpo -c -o dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o `test -f 'dbus-proxy/dbus-proxy.c' || echo '$(srcdir)/'`dbus-proxy/dbus-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Tpo dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='dbus-proxy/dbus-proxy.c' object='dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -c -o dbus-proxy/flatpak_dbus_proxy-dbus-proxy.o `test -f 'dbus-proxy/dbus-proxy.c' || echo '$(srcdir)/'`dbus-proxy/dbus-proxy.c
+
+dbus-proxy/flatpak_dbus_proxy-dbus-proxy.obj: dbus-proxy/dbus-proxy.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -MT dbus-proxy/flatpak_dbus_proxy-dbus-proxy.obj -MD -MP -MF dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Tpo -c -o dbus-proxy/flatpak_dbus_proxy-dbus-proxy.obj `if test -f 'dbus-proxy/dbus-proxy.c'; then $(CYGPATH_W) 'dbus-proxy/dbus-proxy.c'; else $(CYGPATH_W) '$(srcdir)/dbus-proxy/dbus-proxy.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Tpo dbus-proxy/$(DEPDIR)/flatpak_dbus_proxy-dbus-proxy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='dbus-proxy/dbus-proxy.c' object='dbus-proxy/flatpak_dbus_proxy-dbus-proxy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_dbus_proxy_CFLAGS) $(CFLAGS) -c -o dbus-proxy/flatpak_dbus_proxy-dbus-proxy.obj `if test -f 'dbus-proxy/dbus-proxy.c'; then $(CYGPATH_W) 'dbus-proxy/dbus-proxy.c'; else $(CYGPATH_W) '$(srcdir)/dbus-proxy/dbus-proxy.c'; fi`
+
+session-helper/flatpak_session_helper-flatpak-session-helper.o: session-helper/flatpak-session-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_session_helper_CFLAGS) $(CFLAGS) -MT session-helper/flatpak_session_helper-flatpak-session-helper.o -MD -MP -MF session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Tpo -c -o session-helper/flatpak_session_helper-flatpak-session-helper.o `test -f 'session-helper/flatpak-session-helper.c' || echo '$(srcdir)/'`session-helper/flatpak-session-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Tpo session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='session-helper/flatpak-session-helper.c' object='session-helper/flatpak_session_helper-flatpak-session-helper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_session_helper_CFLAGS) $(CFLAGS) -c -o session-helper/flatpak_session_helper-flatpak-session-helper.o `test -f 'session-helper/flatpak-session-helper.c' || echo '$(srcdir)/'`session-helper/flatpak-session-helper.c
+
+session-helper/flatpak_session_helper-flatpak-session-helper.obj: session-helper/flatpak-session-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_session_helper_CFLAGS) $(CFLAGS) -MT session-helper/flatpak_session_helper-flatpak-session-helper.obj -MD -MP -MF session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Tpo -c -o session-helper/flatpak_session_helper-flatpak-session-helper.obj `if test -f 'session-helper/flatpak-session-helper.c'; then $(CYGPATH_W) 'session-helper/flatpak-session-helper.c'; else $(CYGPATH_W) '$(srcdir)/session-helper/flatpak-session-helper.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Tpo session-helper/$(DEPDIR)/flatpak_session_helper-flatpak-session-helper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='session-helper/flatpak-session-helper.c' object='session-helper/flatpak_session_helper-flatpak-session-helper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_session_helper_CFLAGS) $(CFLAGS) -c -o session-helper/flatpak_session_helper-flatpak-session-helper.obj `if test -f 'session-helper/flatpak-session-helper.c'; then $(CYGPATH_W) 'session-helper/flatpak-session-helper.c'; else $(CYGPATH_W) '$(srcdir)/session-helper/flatpak-session-helper.c'; fi`
+
+system-helper/flatpak_system_helper-flatpak-system-helper.o: system-helper/flatpak-system-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -MT system-helper/flatpak_system_helper-flatpak-system-helper.o -MD -MP -MF system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Tpo -c -o system-helper/flatpak_system_helper-flatpak-system-helper.o `test -f 'system-helper/flatpak-system-helper.c' || echo '$(srcdir)/'`system-helper/flatpak-system-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Tpo system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='system-helper/flatpak-system-helper.c' object='system-helper/flatpak_system_helper-flatpak-system-helper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -c -o system-helper/flatpak_system_helper-flatpak-system-helper.o `test -f 'system-helper/flatpak-system-helper.c' || echo '$(srcdir)/'`system-helper/flatpak-system-helper.c
+
+system-helper/flatpak_system_helper-flatpak-system-helper.obj: system-helper/flatpak-system-helper.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -MT system-helper/flatpak_system_helper-flatpak-system-helper.obj -MD -MP -MF system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Tpo -c -o system-helper/flatpak_system_helper-flatpak-system-helper.obj `if test -f 'system-helper/flatpak-system-helper.c'; then $(CYGPATH_W) 'system-helper/flatpak-system-helper.c'; else $(CYGPATH_W) '$(srcdir)/system-helper/flatpak-system-helper.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Tpo system-helper/$(DEPDIR)/flatpak_system_helper-flatpak-system-helper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='system-helper/flatpak-system-helper.c' object='system-helper/flatpak_system_helper-flatpak-system-helper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -c -o system-helper/flatpak_system_helper-flatpak-system-helper.obj `if test -f 'system-helper/flatpak-system-helper.c'; then $(CYGPATH_W) 'system-helper/flatpak-system-helper.c'; else $(CYGPATH_W) '$(srcdir)/system-helper/flatpak-system-helper.c'; fi`
+
+lib/flatpak_system_helper-flatpak-error.o: lib/flatpak-error.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -MT lib/flatpak_system_helper-flatpak-error.o -MD -MP -MF lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Tpo -c -o lib/flatpak_system_helper-flatpak-error.o `test -f 'lib/flatpak-error.c' || echo '$(srcdir)/'`lib/flatpak-error.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Tpo lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-error.c' object='lib/flatpak_system_helper-flatpak-error.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -c -o lib/flatpak_system_helper-flatpak-error.o `test -f 'lib/flatpak-error.c' || echo '$(srcdir)/'`lib/flatpak-error.c
+
+lib/flatpak_system_helper-flatpak-error.obj: lib/flatpak-error.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -MT lib/flatpak_system_helper-flatpak-error.obj -MD -MP -MF lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Tpo -c -o lib/flatpak_system_helper-flatpak-error.obj `if test -f 'lib/flatpak-error.c'; then $(CYGPATH_W) 'lib/flatpak-error.c'; else $(CYGPATH_W) '$(srcdir)/lib/flatpak-error.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Tpo lib/$(DEPDIR)/flatpak_system_helper-flatpak-error.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/flatpak-error.c' object='lib/flatpak_system_helper-flatpak-error.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flatpak_system_helper_CFLAGS) $(CFLAGS) -c -o lib/flatpak_system_helper-flatpak-error.obj `if test -f 'lib/flatpak-error.c'; then $(CYGPATH_W) 'lib/flatpak-error.c'; else $(CYGPATH_W) '$(srcdir)/lib/flatpak-error.c'; fi`
+
+tests/test_doc_portal-test-doc-portal.o: tests/test-doc-portal.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -MT tests/test_doc_portal-test-doc-portal.o -MD -MP -MF tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Tpo -c -o tests/test_doc_portal-test-doc-portal.o `test -f 'tests/test-doc-portal.c' || echo '$(srcdir)/'`tests/test-doc-portal.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Tpo tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/test-doc-portal.c' object='tests/test_doc_portal-test-doc-portal.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -c -o tests/test_doc_portal-test-doc-portal.o `test -f 'tests/test-doc-portal.c' || echo '$(srcdir)/'`tests/test-doc-portal.c
+
+tests/test_doc_portal-test-doc-portal.obj: tests/test-doc-portal.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -MT tests/test_doc_portal-test-doc-portal.obj -MD -MP -MF tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Tpo -c -o tests/test_doc_portal-test-doc-portal.obj `if test -f 'tests/test-doc-portal.c'; then $(CYGPATH_W) 'tests/test-doc-portal.c'; else $(CYGPATH_W) '$(srcdir)/tests/test-doc-portal.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Tpo tests/$(DEPDIR)/test_doc_portal-test-doc-portal.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/test-doc-portal.c' object='tests/test_doc_portal-test-doc-portal.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -c -o tests/test_doc_portal-test-doc-portal.obj `if test -f 'tests/test-doc-portal.c'; then $(CYGPATH_W) 'tests/test-doc-portal.c'; else $(CYGPATH_W) '$(srcdir)/tests/test-doc-portal.c'; fi`
+
+document-portal/test_doc_portal-xdp-dbus.o: document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -MT document-portal/test_doc_portal-xdp-dbus.o -MD -MP -MF document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Tpo -c -o document-portal/test_doc_portal-xdp-dbus.o `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Tpo document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-dbus.c' object='document-portal/test_doc_portal-xdp-dbus.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -c -o document-portal/test_doc_portal-xdp-dbus.o `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+
+document-portal/test_doc_portal-xdp-dbus.obj: document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -MT document-portal/test_doc_portal-xdp-dbus.obj -MD -MP -MF document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Tpo -c -o document-portal/test_doc_portal-xdp-dbus.obj `if test -f 'document-portal/xdp-dbus.c'; then $(CYGPATH_W) 'document-portal/xdp-dbus.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-dbus.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Tpo document-portal/$(DEPDIR)/test_doc_portal-xdp-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-dbus.c' object='document-portal/test_doc_portal-xdp-dbus.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_doc_portal_CFLAGS) $(CFLAGS) -c -o document-portal/test_doc_portal-xdp-dbus.obj `if test -f 'document-portal/xdp-dbus.c'; then $(CYGPATH_W) 'document-portal/xdp-dbus.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-dbus.c'; fi`
+
+lib/test_libflatpak-test-lib.o: lib/test-lib.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libflatpak_CFLAGS) $(CFLAGS) -MT lib/test_libflatpak-test-lib.o -MD -MP -MF lib/$(DEPDIR)/test_libflatpak-test-lib.Tpo -c -o lib/test_libflatpak-test-lib.o `test -f 'lib/test-lib.c' || echo '$(srcdir)/'`lib/test-lib.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/test_libflatpak-test-lib.Tpo lib/$(DEPDIR)/test_libflatpak-test-lib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/test-lib.c' object='lib/test_libflatpak-test-lib.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libflatpak_CFLAGS) $(CFLAGS) -c -o lib/test_libflatpak-test-lib.o `test -f 'lib/test-lib.c' || echo '$(srcdir)/'`lib/test-lib.c
+
+lib/test_libflatpak-test-lib.obj: lib/test-lib.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libflatpak_CFLAGS) $(CFLAGS) -MT lib/test_libflatpak-test-lib.obj -MD -MP -MF lib/$(DEPDIR)/test_libflatpak-test-lib.Tpo -c -o lib/test_libflatpak-test-lib.obj `if test -f 'lib/test-lib.c'; then $(CYGPATH_W) 'lib/test-lib.c'; else $(CYGPATH_W) '$(srcdir)/lib/test-lib.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/test_libflatpak-test-lib.Tpo lib/$(DEPDIR)/test_libflatpak-test-lib.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/test-lib.c' object='lib/test_libflatpak-test-lib.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libflatpak_CFLAGS) $(CFLAGS) -c -o lib/test_libflatpak-test-lib.obj `if test -f 'lib/test-lib.c'; then $(CYGPATH_W) 'lib/test-lib.c'; else $(CYGPATH_W) '$(srcdir)/lib/test-lib.c'; fi`
+
+libglnx/tests/test_libglnx_errors-test-libglnx-errors.o: libglnx/tests/test-libglnx-errors.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_errors_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_errors-test-libglnx-errors.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Tpo -c -o libglnx/tests/test_libglnx_errors-test-libglnx-errors.o `test -f 'libglnx/tests/test-libglnx-errors.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-errors.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-errors.c' object='libglnx/tests/test_libglnx_errors-test-libglnx-errors.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_errors_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_errors-test-libglnx-errors.o `test -f 'libglnx/tests/test-libglnx-errors.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-errors.c
+
+libglnx/tests/test_libglnx_errors-test-libglnx-errors.obj: libglnx/tests/test-libglnx-errors.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_errors_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_errors-test-libglnx-errors.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Tpo -c -o libglnx/tests/test_libglnx_errors-test-libglnx-errors.obj `if test -f 'libglnx/tests/test-libglnx-errors.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-errors.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-errors.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_errors-test-libglnx-errors.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-errors.c' object='libglnx/tests/test_libglnx_errors-test-libglnx-errors.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_errors_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_errors-test-libglnx-errors.obj `if test -f 'libglnx/tests/test-libglnx-errors.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-errors.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-errors.c'; fi`
+
+libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.o: libglnx/tests/test-libglnx-fdio.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_fdio_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Tpo -c -o libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.o `test -f 'libglnx/tests/test-libglnx-fdio.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-fdio.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-fdio.c' object='libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_fdio_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.o `test -f 'libglnx/tests/test-libglnx-fdio.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-fdio.c
+
+libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.obj: libglnx/tests/test-libglnx-fdio.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_fdio_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Tpo -c -o libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.obj `if test -f 'libglnx/tests/test-libglnx-fdio.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-fdio.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-fdio.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_fdio-test-libglnx-fdio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-fdio.c' object='libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_fdio_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_fdio-test-libglnx-fdio.obj `if test -f 'libglnx/tests/test-libglnx-fdio.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-fdio.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-fdio.c'; fi`
+
+libglnx/tests/test_libglnx_macros-test-libglnx-macros.o: libglnx/tests/test-libglnx-macros.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_macros_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_macros-test-libglnx-macros.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Tpo -c -o libglnx/tests/test_libglnx_macros-test-libglnx-macros.o `test -f 'libglnx/tests/test-libglnx-macros.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-macros.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-macros.c' object='libglnx/tests/test_libglnx_macros-test-libglnx-macros.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_macros_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_macros-test-libglnx-macros.o `test -f 'libglnx/tests/test-libglnx-macros.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-macros.c
+
+libglnx/tests/test_libglnx_macros-test-libglnx-macros.obj: libglnx/tests/test-libglnx-macros.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_macros_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_macros-test-libglnx-macros.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Tpo -c -o libglnx/tests/test_libglnx_macros-test-libglnx-macros.obj `if test -f 'libglnx/tests/test-libglnx-macros.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-macros.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-macros.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_macros-test-libglnx-macros.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-macros.c' object='libglnx/tests/test_libglnx_macros-test-libglnx-macros.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_macros_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_macros-test-libglnx-macros.obj `if test -f 'libglnx/tests/test-libglnx-macros.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-macros.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-macros.c'; fi`
+
+libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.o: libglnx/tests/test-libglnx-shutil.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_shutil_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Tpo -c -o libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.o `test -f 'libglnx/tests/test-libglnx-shutil.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-shutil.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-shutil.c' object='libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_shutil_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.o `test -f 'libglnx/tests/test-libglnx-shutil.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-shutil.c
+
+libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.obj: libglnx/tests/test-libglnx-shutil.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_shutil_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Tpo -c -o libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.obj `if test -f 'libglnx/tests/test-libglnx-shutil.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-shutil.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-shutil.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_shutil-test-libglnx-shutil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-shutil.c' object='libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_shutil_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_shutil-test-libglnx-shutil.obj `if test -f 'libglnx/tests/test-libglnx-shutil.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-shutil.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-shutil.c'; fi`
+
+libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o: libglnx/tests/test-libglnx-xattrs.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o `test -f 'libglnx/tests/test-libglnx-xattrs.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-xattrs.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-xattrs.c' object='libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.o `test -f 'libglnx/tests/test-libglnx-xattrs.c' || echo '$(srcdir)/'`libglnx/tests/test-libglnx-xattrs.c
+
+libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj: libglnx/tests/test-libglnx-xattrs.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -MT libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj -MD -MP -MF libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj `if test -f 'libglnx/tests/test-libglnx-xattrs.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-xattrs.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-xattrs.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Tpo libglnx/tests/$(DEPDIR)/test_libglnx_xattrs-test-libglnx-xattrs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libglnx/tests/test-libglnx-xattrs.c' object='libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj `if test -f 'libglnx/tests/test-libglnx-xattrs.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-xattrs.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-xattrs.c'; fi`
+
+tests/testdb-testdb.o: tests/testdb.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testdb_CFLAGS) $(CFLAGS) -MT tests/testdb-testdb.o -MD -MP -MF tests/$(DEPDIR)/testdb-testdb.Tpo -c -o tests/testdb-testdb.o `test -f 'tests/testdb.c' || echo '$(srcdir)/'`tests/testdb.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/testdb-testdb.Tpo tests/$(DEPDIR)/testdb-testdb.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/testdb.c' object='tests/testdb-testdb.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testdb_CFLAGS) $(CFLAGS) -c -o tests/testdb-testdb.o `test -f 'tests/testdb.c' || echo '$(srcdir)/'`tests/testdb.c
+
+tests/testdb-testdb.obj: tests/testdb.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testdb_CFLAGS) $(CFLAGS) -MT tests/testdb-testdb.obj -MD -MP -MF tests/$(DEPDIR)/testdb-testdb.Tpo -c -o tests/testdb-testdb.obj `if test -f 'tests/testdb.c'; then $(CYGPATH_W) 'tests/testdb.c'; else $(CYGPATH_W) '$(srcdir)/tests/testdb.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/testdb-testdb.Tpo tests/$(DEPDIR)/testdb-testdb.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/testdb.c' object='tests/testdb-testdb.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testdb_CFLAGS) $(CFLAGS) -c -o tests/testdb-testdb.obj `if test -f 'tests/testdb.c'; then $(CYGPATH_W) 'tests/testdb.c'; else $(CYGPATH_W) '$(srcdir)/tests/testdb.c'; fi`
+
+tests/testlibrary-testlibrary.o: tests/testlibrary.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testlibrary_CFLAGS) $(CFLAGS) -MT tests/testlibrary-testlibrary.o -MD -MP -MF tests/$(DEPDIR)/testlibrary-testlibrary.Tpo -c -o tests/testlibrary-testlibrary.o `test -f 'tests/testlibrary.c' || echo '$(srcdir)/'`tests/testlibrary.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/testlibrary-testlibrary.Tpo tests/$(DEPDIR)/testlibrary-testlibrary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/testlibrary.c' object='tests/testlibrary-testlibrary.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testlibrary_CFLAGS) $(CFLAGS) -c -o tests/testlibrary-testlibrary.o `test -f 'tests/testlibrary.c' || echo '$(srcdir)/'`tests/testlibrary.c
+
+tests/testlibrary-testlibrary.obj: tests/testlibrary.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testlibrary_CFLAGS) $(CFLAGS) -MT tests/testlibrary-testlibrary.obj -MD -MP -MF tests/$(DEPDIR)/testlibrary-testlibrary.Tpo -c -o tests/testlibrary-testlibrary.obj `if test -f 'tests/testlibrary.c'; then $(CYGPATH_W) 'tests/testlibrary.c'; else $(CYGPATH_W) '$(srcdir)/tests/testlibrary.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) tests/$(DEPDIR)/testlibrary-testlibrary.Tpo tests/$(DEPDIR)/testlibrary-testlibrary.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tests/testlibrary.c' object='tests/testlibrary-testlibrary.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testlibrary_CFLAGS) $(CFLAGS) -c -o tests/testlibrary-testlibrary.obj `if test -f 'tests/testlibrary.c'; then $(CYGPATH_W) 'tests/testlibrary.c'; else $(CYGPATH_W) '$(srcdir)/tests/testlibrary.c'; fi`
+
+document-portal/xdg_document_portal-xdp-main.o: document-portal/xdp-main.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-main.o -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Tpo -c -o document-portal/xdg_document_portal-xdp-main.o `test -f 'document-portal/xdp-main.c' || echo '$(srcdir)/'`document-portal/xdp-main.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-main.c' object='document-portal/xdg_document_portal-xdp-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-main.o `test -f 'document-portal/xdp-main.c' || echo '$(srcdir)/'`document-portal/xdp-main.c
+
+document-portal/xdg_document_portal-xdp-main.obj: document-portal/xdp-main.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-main.obj -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Tpo -c -o document-portal/xdg_document_portal-xdp-main.obj `if test -f 'document-portal/xdp-main.c'; then $(CYGPATH_W) 'document-portal/xdp-main.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-main.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-main.c' object='document-portal/xdg_document_portal-xdp-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-main.obj `if test -f 'document-portal/xdp-main.c'; then $(CYGPATH_W) 'document-portal/xdp-main.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-main.c'; fi`
+
+document-portal/xdg_document_portal-xdp-util.o: document-portal/xdp-util.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-util.o -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Tpo -c -o document-portal/xdg_document_portal-xdp-util.o `test -f 'document-portal/xdp-util.c' || echo '$(srcdir)/'`document-portal/xdp-util.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-util.c' object='document-portal/xdg_document_portal-xdp-util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-util.o `test -f 'document-portal/xdp-util.c' || echo '$(srcdir)/'`document-portal/xdp-util.c
+
+document-portal/xdg_document_portal-xdp-util.obj: document-portal/xdp-util.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-util.obj -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Tpo -c -o document-portal/xdg_document_portal-xdp-util.obj `if test -f 'document-portal/xdp-util.c'; then $(CYGPATH_W) 'document-portal/xdp-util.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-util.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-util.c' object='document-portal/xdg_document_portal-xdp-util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-util.obj `if test -f 'document-portal/xdp-util.c'; then $(CYGPATH_W) 'document-portal/xdp-util.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-util.c'; fi`
+
+document-portal/xdg_document_portal-xdp-fuse.o: document-portal/xdp-fuse.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-fuse.o -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Tpo -c -o document-portal/xdg_document_portal-xdp-fuse.o `test -f 'document-portal/xdp-fuse.c' || echo '$(srcdir)/'`document-portal/xdp-fuse.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-fuse.c' object='document-portal/xdg_document_portal-xdp-fuse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-fuse.o `test -f 'document-portal/xdp-fuse.c' || echo '$(srcdir)/'`document-portal/xdp-fuse.c
+
+document-portal/xdg_document_portal-xdp-fuse.obj: document-portal/xdp-fuse.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-fuse.obj -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Tpo -c -o document-portal/xdg_document_portal-xdp-fuse.obj `if test -f 'document-portal/xdp-fuse.c'; then $(CYGPATH_W) 'document-portal/xdp-fuse.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-fuse.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-fuse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-fuse.c' object='document-portal/xdg_document_portal-xdp-fuse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-fuse.obj `if test -f 'document-portal/xdp-fuse.c'; then $(CYGPATH_W) 'document-portal/xdp-fuse.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-fuse.c'; fi`
+
+document-portal/xdg_document_portal-xdp-dbus.o: document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-dbus.o -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Tpo -c -o document-portal/xdg_document_portal-xdp-dbus.o `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-dbus.c' object='document-portal/xdg_document_portal-xdp-dbus.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-dbus.o `test -f 'document-portal/xdp-dbus.c' || echo '$(srcdir)/'`document-portal/xdp-dbus.c
+
+document-portal/xdg_document_portal-xdp-dbus.obj: document-portal/xdp-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT document-portal/xdg_document_portal-xdp-dbus.obj -MD -MP -MF document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Tpo -c -o document-portal/xdg_document_portal-xdp-dbus.obj `if test -f 'document-portal/xdp-dbus.c'; then $(CYGPATH_W) 'document-portal/xdp-dbus.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-dbus.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Tpo document-portal/$(DEPDIR)/xdg_document_portal-xdp-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='document-portal/xdp-dbus.c' object='document-portal/xdg_document_portal-xdp-dbus.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o document-portal/xdg_document_portal-xdp-dbus.obj `if test -f 'document-portal/xdp-dbus.c'; then $(CYGPATH_W) 'document-portal/xdp-dbus.c'; else $(CYGPATH_W) '$(srcdir)/document-portal/xdp-dbus.c'; fi`
+
+permission-store/xdg_document_portal-permission-store-dbus.o: permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT permission-store/xdg_document_portal-permission-store-dbus.o -MD -MP -MF permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Tpo -c -o permission-store/xdg_document_portal-permission-store-dbus.o `test -f 'permission-store/permission-store-dbus.c' || echo '$(srcdir)/'`permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Tpo permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store-dbus.c' object='permission-store/xdg_document_portal-permission-store-dbus.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_document_portal-permission-store-dbus.o `test -f 'permission-store/permission-store-dbus.c' || echo '$(srcdir)/'`permission-store/permission-store-dbus.c
+
+permission-store/xdg_document_portal-permission-store-dbus.obj: permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -MT permission-store/xdg_document_portal-permission-store-dbus.obj -MD -MP -MF permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Tpo -c -o permission-store/xdg_document_portal-permission-store-dbus.obj `if test -f 'permission-store/permission-store-dbus.c'; then $(CYGPATH_W) 'permission-store/permission-store-dbus.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store-dbus.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Tpo permission-store/$(DEPDIR)/xdg_document_portal-permission-store-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store-dbus.c' object='permission-store/xdg_document_portal-permission-store-dbus.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_document_portal_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_document_portal-permission-store-dbus.obj `if test -f 'permission-store/permission-store-dbus.c'; then $(CYGPATH_W) 'permission-store/permission-store-dbus.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store-dbus.c'; fi`
+
+permission-store/xdg_permission_store-permission-store.o: permission-store/permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-permission-store.o -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Tpo -c -o permission-store/xdg_permission_store-permission-store.o `test -f 'permission-store/permission-store.c' || echo '$(srcdir)/'`permission-store/permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Tpo permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store.c' object='permission-store/xdg_permission_store-permission-store.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-permission-store.o `test -f 'permission-store/permission-store.c' || echo '$(srcdir)/'`permission-store/permission-store.c
+
+permission-store/xdg_permission_store-permission-store.obj: permission-store/permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-permission-store.obj -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Tpo -c -o permission-store/xdg_permission_store-permission-store.obj `if test -f 'permission-store/permission-store.c'; then $(CYGPATH_W) 'permission-store/permission-store.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Tpo permission-store/$(DEPDIR)/xdg_permission_store-permission-store.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store.c' object='permission-store/xdg_permission_store-permission-store.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-permission-store.obj `if test -f 'permission-store/permission-store.c'; then $(CYGPATH_W) 'permission-store/permission-store.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store.c'; fi`
+
+permission-store/xdg_permission_store-xdg-permission-store.o: permission-store/xdg-permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-xdg-permission-store.o -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Tpo -c -o permission-store/xdg_permission_store-xdg-permission-store.o `test -f 'permission-store/xdg-permission-store.c' || echo '$(srcdir)/'`permission-store/xdg-permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Tpo permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/xdg-permission-store.c' object='permission-store/xdg_permission_store-xdg-permission-store.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-xdg-permission-store.o `test -f 'permission-store/xdg-permission-store.c' || echo '$(srcdir)/'`permission-store/xdg-permission-store.c
+
+permission-store/xdg_permission_store-xdg-permission-store.obj: permission-store/xdg-permission-store.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-xdg-permission-store.obj -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Tpo -c -o permission-store/xdg_permission_store-xdg-permission-store.obj `if test -f 'permission-store/xdg-permission-store.c'; then $(CYGPATH_W) 'permission-store/xdg-permission-store.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/xdg-permission-store.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Tpo permission-store/$(DEPDIR)/xdg_permission_store-xdg-permission-store.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/xdg-permission-store.c' object='permission-store/xdg_permission_store-xdg-permission-store.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-xdg-permission-store.obj `if test -f 'permission-store/xdg-permission-store.c'; then $(CYGPATH_W) 'permission-store/xdg-permission-store.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/xdg-permission-store.c'; fi`
+
+permission-store/xdg_permission_store-permission-store-dbus.o: permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-permission-store-dbus.o -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Tpo -c -o permission-store/xdg_permission_store-permission-store-dbus.o `test -f 'permission-store/permission-store-dbus.c' || echo '$(srcdir)/'`permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Tpo permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store-dbus.c' object='permission-store/xdg_permission_store-permission-store-dbus.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-permission-store-dbus.o `test -f 'permission-store/permission-store-dbus.c' || echo '$(srcdir)/'`permission-store/permission-store-dbus.c
+
+permission-store/xdg_permission_store-permission-store-dbus.obj: permission-store/permission-store-dbus.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -MT permission-store/xdg_permission_store-permission-store-dbus.obj -MD -MP -MF permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Tpo -c -o permission-store/xdg_permission_store-permission-store-dbus.obj `if test -f 'permission-store/permission-store-dbus.c'; then $(CYGPATH_W) 'permission-store/permission-store-dbus.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store-dbus.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Tpo permission-store/$(DEPDIR)/xdg_permission_store-permission-store-dbus.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='permission-store/permission-store-dbus.c' object='permission-store/xdg_permission_store-permission-store-dbus.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdg_permission_store_CFLAGS) $(CFLAGS) -c -o permission-store/xdg_permission_store-permission-store-dbus.obj `if test -f 'permission-store/permission-store-dbus.c'; then $(CYGPATH_W) 'permission-store/permission-store-dbus.c'; else $(CYGPATH_W) '$(srcdir)/permission-store/permission-store-dbus.c'; fi`
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+       -rm -rf common/.libs common/_libs
+       -rm -rf common/gvdb/.libs common/gvdb/_libs
+       -rm -rf document-portal/.libs document-portal/_libs
+       -rm -rf lib/.libs lib/_libs
+       -rm -rf libglnx/.libs libglnx/_libs
+
+distclean-libtool:
+       -rm -f libtool config.lt
+install-completionDATA: $(completion_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(completion_DATA)'; test -n "$(completiondir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(completiondir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(completiondir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(completiondir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(completiondir)" || exit $$?; \
+       done
+
+uninstall-completionDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(completion_DATA)'; test -n "$(completiondir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(completiondir)'; $(am__uninstall_files_from_dir)
+install-dbus_serviceDATA: $(dbus_service_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dbus_service_DATA)'; test -n "$(dbus_servicedir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(dbus_servicedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(dbus_servicedir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbus_servicedir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(dbus_servicedir)" || exit $$?; \
+       done
+
+uninstall-dbus_serviceDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dbus_service_DATA)'; test -n "$(dbus_servicedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(dbus_servicedir)'; $(am__uninstall_files_from_dir)
+install-dbussnippetDATA: $(dbussnippet_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dbussnippet_DATA)'; test -n "$(dbussnippetdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(dbussnippetdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(dbussnippetdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbussnippetdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(dbussnippetdir)" || exit $$?; \
+       done
+
+uninstall-dbussnippetDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dbussnippet_DATA)'; test -n "$(dbussnippetdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(dbussnippetdir)'; $(am__uninstall_files_from_dir)
+install-dbussystemserviceDATA: $(dbussystemservice_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dbussystemservice_DATA)'; test -n "$(dbussystemservicedir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(dbussystemservicedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(dbussystemservicedir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbussystemservicedir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(dbussystemservicedir)" || exit $$?; \
+       done
+
+uninstall-dbussystemserviceDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dbussystemservice_DATA)'; test -n "$(dbussystemservicedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(dbussystemservicedir)'; $(am__uninstall_files_from_dir)
+install-dist_dbusconfDATA: $(dist_dbusconf_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_dbusconf_DATA)'; test -n "$(dbusconfdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(dbusconfdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(dbusconfdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusconfdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusconfdir)" || exit $$?; \
+       done
+
+uninstall-dist_dbusconfDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_dbusconf_DATA)'; test -n "$(dbusconfdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(dbusconfdir)'; $(am__uninstall_files_from_dir)
+install-dist_installed_test_dbsDATA: $(dist_installed_test_dbs_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_installed_test_dbs_DATA)'; test -n "$(installed_test_dbsdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_test_dbsdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_test_dbsdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_test_dbsdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_test_dbsdir)" || exit $$?; \
+       done
+
+uninstall-dist_installed_test_dbsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_installed_test_dbs_DATA)'; test -n "$(installed_test_dbsdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(installed_test_dbsdir)'; $(am__uninstall_files_from_dir)
+install-dist_installed_test_keyringDATA: $(dist_installed_test_keyring_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_installed_test_keyring_DATA)'; test -n "$(installed_test_keyringdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_test_keyringdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_test_keyringdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_test_keyringdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_test_keyringdir)" || exit $$?; \
+       done
+
+uninstall-dist_installed_test_keyringDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_installed_test_keyring_DATA)'; test -n "$(installed_test_keyringdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(installed_test_keyringdir)'; $(am__uninstall_files_from_dir)
+install-dist_installed_test_keyring2DATA: $(dist_installed_test_keyring2_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_installed_test_keyring2_DATA)'; test -n "$(installed_test_keyring2dir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_test_keyring2dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_test_keyring2dir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_test_keyring2dir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_test_keyring2dir)" || exit $$?; \
+       done
+
+uninstall-dist_installed_test_keyring2DATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_installed_test_keyring2_DATA)'; test -n "$(installed_test_keyring2dir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(installed_test_keyring2dir)'; $(am__uninstall_files_from_dir)
+install-envDATA: $(env_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(env_DATA)'; test -n "$(envdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(envdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(envdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(envdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(envdir)" || exit $$?; \
+       done
+
+uninstall-envDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(env_DATA)'; test -n "$(envdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(envdir)'; $(am__uninstall_files_from_dir)
+install-installed_testDATA: $(installed_test_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_testdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_testdir)" || exit $$?; \
+       done
+
+uninstall-installed_testDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(installed_testdir)'; $(am__uninstall_files_from_dir)
+install-installed_test_metaDATA: $(installed_test_meta_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(installed_test_meta_DATA)'; test -n "$(installed_test_metadir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_test_metadir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_test_metadir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_test_metadir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_test_metadir)" || exit $$?; \
+       done
+
+uninstall-installed_test_metaDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(installed_test_meta_DATA)'; test -n "$(installed_test_metadir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(installed_test_metadir)'; $(am__uninstall_files_from_dir)
+install-introspectionDATA: $(introspection_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(introspection_DATA)'; test -n "$(introspectiondir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(introspectiondir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(introspectiondir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(introspectiondir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(introspectiondir)" || exit $$?; \
+       done
+
+uninstall-introspectionDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(introspection_DATA)'; test -n "$(introspectiondir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(introspectiondir)'; $(am__uninstall_files_from_dir)
+install-nobase_installed_testDATA: $(nobase_installed_test_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(nobase_installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \
+       fi; \
+       $(am__nobase_list) | while read dir files; do \
+         xfiles=; for file in $$files; do \
+           if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+           else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+         test -z "$$xfiles" || { \
+           test "x$$dir" = x. || { \
+             echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)/$$dir'"; \
+             $(MKDIR_P) "$(DESTDIR)$(installed_testdir)/$$dir"; }; \
+           echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(installed_testdir)/$$dir'"; \
+           $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(installed_testdir)/$$dir" || exit $$?; }; \
+       done
+
+uninstall-nobase_installed_testDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nobase_installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \
+       $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+       dir='$(DESTDIR)$(installed_testdir)'; $(am__uninstall_files_from_dir)
+install-nodist_girDATA: $(nodist_gir_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(nodist_gir_DATA)'; test -n "$(girdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \
+       done
+
+uninstall-nodist_girDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_gir_DATA)'; test -n "$(girdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir)
+install-nodist_typelibDATA: $(nodist_typelib_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(nodist_typelib_DATA)'; test -n "$(typelibdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \
+       done
+
+uninstall-nodist_typelibDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_typelib_DATA)'; test -n "$(typelibdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir)
+install-pkgconfigDATA: $(pkgconfig_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+       done
+
+uninstall-pkgconfigDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
+install-polkit_policyDATA: $(polkit_policy_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(polkit_policydir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(polkit_policydir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(polkit_policydir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(polkit_policydir)" || exit $$?; \
+       done
+
+uninstall-polkit_policyDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(polkit_policydir)'; $(am__uninstall_files_from_dir)
+install-polkit_rulesDATA: $(polkit_rules_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(polkit_rules_DATA)'; test -n "$(polkit_rulesdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(polkit_rulesdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(polkit_rulesdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(polkit_rulesdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(polkit_rulesdir)" || exit $$?; \
+       done
+
+uninstall-polkit_rulesDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(polkit_rules_DATA)'; test -n "$(polkit_rulesdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(polkit_rulesdir)'; $(am__uninstall_files_from_dir)
+install-profileDATA: $(profile_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(profiledir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(profiledir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(profiledir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(profiledir)" || exit $$?; \
+       done
+
+uninstall-profileDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(profile_DATA)'; test -n "$(profiledir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(profiledir)'; $(am__uninstall_files_from_dir)
+install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \
+       done
+
+uninstall-systemdsystemunitDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
+install-systemduserunitDATA: $(systemduserunit_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(systemduserunit_DATA)'; test -n "$(systemduserunitdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(systemduserunitdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(systemduserunitdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemduserunitdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(systemduserunitdir)" || exit $$?; \
+       done
+
+uninstall-systemduserunitDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(systemduserunit_DATA)'; test -n "$(systemduserunitdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(systemduserunitdir)'; $(am__uninstall_files_from_dir)
+install-flatpakincludeHEADERS: $(flatpakinclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       @list='$(flatpakinclude_HEADERS)'; test -n "$(flatpakincludedir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(flatpakincludedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(flatpakincludedir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(flatpakincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(flatpakincludedir)" || exit $$?; \
+       done
+
+uninstall-flatpakincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(flatpakinclude_HEADERS)'; test -n "$(flatpakincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(flatpakincludedir)'; $(am__uninstall_files_from_dir)
+install-nodist_flatpakincludeHEADERS: $(nodist_flatpakinclude_HEADERS)
+       @$(NORMAL_INSTALL)
+       @list='$(nodist_flatpakinclude_HEADERS)'; test -n "$(flatpakincludedir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(flatpakincludedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(flatpakincludedir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(flatpakincludedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(flatpakincludedir)" || exit $$?; \
+       done
+
+uninstall-nodist_flatpakincludeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_flatpakinclude_HEADERS)'; test -n "$(flatpakincludedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(flatpakincludedir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+       @fail=; \
+       if $(am__make_keepgoing); then \
+         failcom='fail=yes'; \
+       else \
+         failcom='exit 1'; \
+       fi; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+       $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+       set x; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       $(am__define_uniq_tagged_files); \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+       $(am__define_uniq_tagged_files); \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+       test ! -s cscope.files \
+         || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+       -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+       list='$(am__tagged_files)'; \
+       case "$(srcdir)" in \
+         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+         *) sdir=$(subdir)/$(srcdir) ;; \
+       esac; \
+       for i in $$list; do \
+         if test -f "$$i"; then \
+           echo "$(subdir)/$$i"; \
+         else \
+           echo "$$sdir/$$i"; \
+         fi; \
+       done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+       -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+       rm -f $< $@
+       $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+       @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+       @$(am__set_TESTS_bases); \
+       am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+       redo_bases=`for i in $$bases; do \
+                     am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+                   done`; \
+       if test -n "$$redo_bases"; then \
+         redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+         redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+         if $(am__make_dryrun); then :; else \
+           rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+         fi; \
+       fi; \
+       if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       elif test -n "$$redo_logs"; then \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi; \
+       if $(am__make_dryrun); then :; else \
+         st=0;  \
+         errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+         for i in $$redo_bases; do \
+           test -f $$i.trs && test -r $$i.trs \
+             || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+           test -f $$i.log && test -r $$i.log \
+             || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+         done; \
+         test $$st -eq 0 || exit 1; \
+       fi
+       @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+       ws='[   ]'; \
+       results=`for b in $$bases; do echo $$b.trs; done`; \
+       test -n "$$results" || results=/dev/null; \
+       all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
+       pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
+       fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
+       skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
+       xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+       xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+       error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+       if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+         success=true; \
+       else \
+         success=false; \
+       fi; \
+       br='==================='; br=$$br$$br$$br$$br; \
+       result_count () \
+       { \
+           if test x"$$1" = x"--maybe-color"; then \
+             maybe_colorize=yes; \
+           elif test x"$$1" = x"--no-color"; then \
+             maybe_colorize=no; \
+           else \
+             echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+           fi; \
+           shift; \
+           desc=$$1 count=$$2; \
+           if test $$maybe_colorize = yes && test $$count -gt 0; then \
+             color_start=$$3 color_end=$$std; \
+           else \
+             color_start= color_end=; \
+           fi; \
+           echo "$${color_start}# $$desc $$count$${color_end}"; \
+       }; \
+       create_testsuite_report () \
+       { \
+         result_count $$1 "TOTAL:" $$all   "$$brg"; \
+         result_count $$1 "PASS: " $$pass  "$$grn"; \
+         result_count $$1 "SKIP: " $$skip  "$$blu"; \
+         result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+         result_count $$1 "FAIL: " $$fail  "$$red"; \
+         result_count $$1 "XPASS:" $$xpass "$$red"; \
+         result_count $$1 "ERROR:" $$error "$$mgn"; \
+       }; \
+       {                                                               \
+         echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
+           $(am__rst_title);                                           \
+         create_testsuite_report --no-color;                           \
+         echo;                                                         \
+         echo ".. contents:: :depth: 2";                               \
+         echo;                                                         \
+         for b in $$bases; do echo $$b; done                           \
+           | $(am__create_global_log);                                 \
+       } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
+       mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
+       if $$success; then                                              \
+         col="$$grn";                                                  \
+        else                                                           \
+         col="$$red";                                                  \
+         test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
+       fi;                                                             \
+       echo "$${col}$$br$${std}";                                      \
+       echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
+       echo "$${col}$$br$${std}";                                      \
+       create_testsuite_report --maybe-color;                          \
+       echo "$$col$$br$$std";                                          \
+       if $$success; then :; else                                      \
+         echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
+         if test -n "$(PACKAGE_BUGREPORT)"; then                       \
+           echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+         fi;                                                           \
+         echo "$$col$$br$$std";                                        \
+       fi;                                                             \
+       $$success || exit 1
+
+check-TESTS:
+       @list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
+       @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+       @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+       @set +e; $(am__set_TESTS_bases); \
+       log_list=`for i in $$bases; do echo $$i.log; done`; \
+       trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+       log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+       exit $$?;
+recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) $(check_SCRIPTS) $(check_DATA)
+       @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+       @set +e; $(am__set_TESTS_bases); \
+       bases=`for i in $$bases; do echo $$i; done \
+                | $(am__list_recheck_tests)` || exit 1; \
+       log_list=`for i in $$bases; do echo $$i.log; done`; \
+       log_list=`echo $$log_list`; \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+               am__force_recheck=am--force-recheck \
+               TEST_LOGS="$$log_list"; \
+       exit $$?
+testdb.log: testdb$(EXEEXT)
+       @p='testdb$(EXEEXT)'; \
+       b='testdb'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-doc-portal.log: test-doc-portal$(EXEEXT)
+       @p='test-doc-portal$(EXEEXT)'; \
+       b='test-doc-portal'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+testlibrary.log: testlibrary$(EXEEXT)
+       @p='testlibrary$(EXEEXT)'; \
+       b='testlibrary'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-basic.sh.log: tests/test-basic.sh
+       @p='tests/test-basic.sh'; \
+       b='tests/test-basic.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-run.sh.log: tests/test-run.sh
+       @p='tests/test-run.sh'; \
+       b='tests/test-run.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-run-system.sh.log: tests/test-run-system.sh
+       @p='tests/test-run-system.sh'; \
+       b='tests/test-run-system.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-run-deltas.sh.log: tests/test-run-deltas.sh
+       @p='tests/test-run-deltas.sh'; \
+       b='tests/test-run-deltas.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-run-system-deltas.sh.log: tests/test-run-system-deltas.sh
+       @p='tests/test-run-system-deltas.sh'; \
+       b='tests/test-run-system-deltas.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-repo.sh.log: tests/test-repo.sh
+       @p='tests/test-repo.sh'; \
+       b='tests/test-repo.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-repo-collections.sh.log: tests/test-repo-collections.sh
+       @p='tests/test-repo-collections.sh'; \
+       b='tests/test-repo-collections.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-repo-collections-server-only.sh.log: tests/test-repo-collections-server-only.sh
+       @p='tests/test-repo-collections-server-only.sh'; \
+       b='tests/test-repo-collections-server-only.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-repo-system.sh.log: tests/test-repo-system.sh
+       @p='tests/test-repo-system.sh'; \
+       b='tests/test-repo-system.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-extensions.sh.log: tests/test-extensions.sh
+       @p='tests/test-extensions.sh'; \
+       b='tests/test-extensions.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-bundle.sh.log: tests/test-bundle.sh
+       @p='tests/test-bundle.sh'; \
+       b='tests/test-bundle.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-bundle-system.sh.log: tests/test-bundle-system.sh
+       @p='tests/test-bundle-system.sh'; \
+       b='tests/test-bundle-system.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-oci.sh.log: tests/test-oci.sh
+       @p='tests/test-oci.sh'; \
+       b='tests/test-oci.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-unsigned-summaries.sh.log: tests/test-unsigned-summaries.sh
+       @p='tests/test-unsigned-summaries.sh'; \
+       b='tests/test-unsigned-summaries.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+tests/test-update-remote-configuration.sh.log: tests/test-update-remote-configuration.sh
+       @p='tests/test-update-remote-configuration.sh'; \
+       b='tests/test-update-remote-configuration.sh'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-libglnx-xattrs.log: test-libglnx-xattrs$(EXEEXT)
+       @p='test-libglnx-xattrs$(EXEEXT)'; \
+       b='test-libglnx-xattrs'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-libglnx-fdio.log: test-libglnx-fdio$(EXEEXT)
+       @p='test-libglnx-fdio$(EXEEXT)'; \
+       b='test-libglnx-fdio'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-libglnx-errors.log: test-libglnx-errors$(EXEEXT)
+       @p='test-libglnx-errors$(EXEEXT)'; \
+       b='test-libglnx-errors'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-libglnx-macros.log: test-libglnx-macros$(EXEEXT)
+       @p='test-libglnx-macros$(EXEEXT)'; \
+       b='test-libglnx-macros'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-libglnx-shutil.log: test-libglnx-shutil$(EXEEXT)
+       @p='test-libglnx-shutil$(EXEEXT)'; \
+       b='test-libglnx-shutil'; \
+       $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+       @p='$<'; \
+       $(am__set_b); \
+       $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@      @p='$<'; \
+@am__EXEEXT_TRUE@      $(am__set_b); \
+@am__EXEEXT_TRUE@      $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@      --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@      $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@      "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       test -d "$(distdir)" || mkdir "$(distdir)"
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           $(am__make_dryrun) \
+             || test -d "$(distdir)/$$subdir" \
+             || $(MKDIR_P) "$(distdir)/$$subdir" \
+             || exit 1; \
+           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+           $(am__relativize); \
+           new_distdir=$$reldir; \
+           dir1=$$subdir; dir2="$(top_distdir)"; \
+           $(am__relativize); \
+           new_top_distdir=$$reldir; \
+           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+           ($(am__cd) $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$new_top_distdir" \
+               distdir="$$new_distdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               am__skip_mode_fix=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       -test -n "$(am__skip_mode_fix)" \
+       || find "$(distdir)" -type d ! -perm -755 \
+               -exec chmod u+rwx,go+rx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
+       $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+       $(am__post_remove_distdir)
+
+dist-lzip: distdir
+       tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+       $(am__post_remove_distdir)
+dist-xz: distdir
+       tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+       $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+       @echo WARNING: "Support for distribution archives compressed with" \
+                      "legacy program 'compress' is deprecated." >&2
+       @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__post_remove_distdir)
+
+dist-shar: distdir
+       @echo WARNING: "Support for shar distribution archives is" \
+                      "deprecated." >&2
+       @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
+       $(am__post_remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__post_remove_distdir)
+
+dist dist-all:
+       $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+       $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.lz*) \
+         lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+       *.tar.xz*) \
+         xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir)
+       chmod u+w $(distdir)
+       mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
+       chmod a-w $(distdir)
+       test -d $(distdir)/_build || exit 0; \
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && am__cwd=`pwd` \
+         && $(am__cd) $(distdir)/_build/sub \
+         && ../../configure \
+           $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+           --srcdir=../.. --prefix="$$dc_install_base" \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+         && cd "$$am__cwd" \
+         || exit 1
+       $(am__post_remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+       @test -n '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: trying to run $@ with an empty' \
+              '$$(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       $(am__cd) '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) \
+         $(check_SCRIPTS) $(check_DATA)
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \
+               $(HEADERS) config.h
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bwrapdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(triggersdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(scriptsdir)" "$(DESTDIR)$(completiondir)" "$(DESTDIR)$(dbus_servicedir)" "$(DESTDIR)$(dbussnippetdir)" "$(DESTDIR)$(dbussystemservicedir)" "$(DESTDIR)$(dbusconfdir)" "$(DESTDIR)$(installed_test_dbsdir)" "$(DESTDIR)$(installed_test_keyringdir)" "$(DESTDIR)$(installed_test_keyring2dir)" "$(DESTDIR)$(envdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_test_metadir)" "$(DESTDIR)$(introspectiondir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(polkit_policydir)" "$(DESTDIR)$(polkit_rulesdir)" "$(DESTDIR)$(profiledir)" "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(systemduserunitdir)" "$(DESTDIR)$(flatpakincludedir)" "$(DESTDIR)$(flatpakincludedir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+       -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+       -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+       -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+       -rm -f app/$(DEPDIR)/$(am__dirstamp)
+       -rm -f app/$(am__dirstamp)
+       -rm -f bubblewrap/$(DEPDIR)/$(am__dirstamp)
+       -rm -f bubblewrap/$(am__dirstamp)
+       -rm -f common/$(DEPDIR)/$(am__dirstamp)
+       -rm -f common/$(am__dirstamp)
+       -rm -f common/gvdb/$(DEPDIR)/$(am__dirstamp)
+       -rm -f common/gvdb/$(am__dirstamp)
+       -rm -f dbus-proxy/$(DEPDIR)/$(am__dirstamp)
+       -rm -f dbus-proxy/$(am__dirstamp)
+       -rm -f document-portal/$(DEPDIR)/$(am__dirstamp)
+       -rm -f document-portal/$(am__dirstamp)
+       -rm -f lib/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/$(am__dirstamp)
+       -rm -f libglnx/$(DEPDIR)/$(am__dirstamp)
+       -rm -f libglnx/$(am__dirstamp)
+       -rm -f libglnx/tests/$(DEPDIR)/$(am__dirstamp)
+       -rm -f libglnx/tests/$(am__dirstamp)
+       -rm -f permission-store/$(DEPDIR)/$(am__dirstamp)
+       -rm -f permission-store/$(am__dirstamp)
+       -rm -f session-helper/$(DEPDIR)/$(am__dirstamp)
+       -rm -f session-helper/$(am__dirstamp)
+       -rm -f system-helper/$(DEPDIR)/$(am__dirstamp)
+       -rm -f system-helper/$(am__dirstamp)
+       -rm -f tests/$(DEPDIR)/$(am__dirstamp)
+       -rm -f tests/$(am__dirstamp)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-bwrapPROGRAMS clean-checkLTLIBRARIES \
+       clean-checkPROGRAMS clean-generic \
+       clean-installed_testLTLIBRARIES clean-installed_testPROGRAMS \
+       clean-libLTLIBRARIES clean-libexecPROGRAMS clean-libtool \
+       clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf app/$(DEPDIR) bubblewrap/$(DEPDIR) common/$(DEPDIR) common/gvdb/$(DEPDIR) dbus-proxy/$(DEPDIR) document-portal/$(DEPDIR) lib/$(DEPDIR) libglnx/$(DEPDIR) libglnx/tests/$(DEPDIR) permission-store/$(DEPDIR) session-helper/$(DEPDIR) system-helper/$(DEPDIR) tests/$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-bwrapPROGRAMS install-completionDATA \
+       install-dbus_serviceDATA install-dbussnippetDATA \
+       install-dbussystemserviceDATA install-dist_dbusconfDATA \
+       install-dist_installed_test_dbsDATA \
+       install-dist_installed_test_keyring2DATA \
+       install-dist_installed_test_keyringDATA \
+       install-dist_triggersSCRIPTS install-envDATA \
+       install-flatpakincludeHEADERS install-installed_testDATA \
+       install-installed_testLTLIBRARIES \
+       install-installed_testPROGRAMS install-installed_testSCRIPTS \
+       install-installed_test_metaDATA install-introspectionDATA \
+       install-nobase_installed_testDATA \
+       install-nodist_flatpakincludeHEADERS install-nodist_girDATA \
+       install-nodist_typelibDATA install-pkgconfigDATA \
+       install-polkit_policyDATA install-polkit_rulesDATA \
+       install-profileDATA install-scriptsSCRIPTS \
+       install-systemdsystemunitDATA install-systemduserunitDATA
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES \
+       install-libexecPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -rf app/$(DEPDIR) bubblewrap/$(DEPDIR) common/$(DEPDIR) common/gvdb/$(DEPDIR) dbus-proxy/$(DEPDIR) document-portal/$(DEPDIR) lib/$(DEPDIR) libglnx/$(DEPDIR) libglnx/tests/$(DEPDIR) permission-store/$(DEPDIR) session-helper/$(DEPDIR) system-helper/$(DEPDIR) tests/$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-bwrapPROGRAMS \
+       uninstall-completionDATA uninstall-dbus_serviceDATA \
+       uninstall-dbussnippetDATA uninstall-dbussystemserviceDATA \
+       uninstall-dist_dbusconfDATA \
+       uninstall-dist_installed_test_dbsDATA \
+       uninstall-dist_installed_test_keyring2DATA \
+       uninstall-dist_installed_test_keyringDATA \
+       uninstall-dist_triggersSCRIPTS uninstall-envDATA \
+       uninstall-flatpakincludeHEADERS uninstall-installed_testDATA \
+       uninstall-installed_testLTLIBRARIES \
+       uninstall-installed_testPROGRAMS \
+       uninstall-installed_testSCRIPTS \
+       uninstall-installed_test_metaDATA uninstall-introspectionDATA \
+       uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
+       uninstall-nobase_installed_testDATA \
+       uninstall-nodist_flatpakincludeHEADERS \
+       uninstall-nodist_girDATA uninstall-nodist_typelibDATA \
+       uninstall-pkgconfigDATA uninstall-polkit_policyDATA \
+       uninstall-polkit_rulesDATA uninstall-profileDATA \
+       uninstall-scriptsSCRIPTS uninstall-systemdsystemunitDATA \
+       uninstall-systemduserunitDATA
+
+.MAKE: $(am__recursive_targets) all check check-am install install-am \
+       install-data-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+       am--refresh check check-TESTS check-am clean clean-binPROGRAMS \
+       clean-bwrapPROGRAMS clean-checkLTLIBRARIES clean-checkPROGRAMS \
+       clean-cscope clean-generic clean-installed_testLTLIBRARIES \
+       clean-installed_testPROGRAMS clean-libLTLIBRARIES \
+       clean-libexecPROGRAMS clean-libtool clean-noinstLTLIBRARIES \
+       clean-noinstPROGRAMS cscope cscopelist-am ctags ctags-am dist \
+       dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+       dist-xz dist-zip distcheck distclean distclean-compile \
+       distclean-generic distclean-hdr distclean-libtool \
+       distclean-tags distcleancheck distdir distuninstallcheck dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-bwrapPROGRAMS \
+       install-completionDATA install-data install-data-am \
+       install-data-hook install-dbus_serviceDATA \
+       install-dbussnippetDATA install-dbussystemserviceDATA \
+       install-dist_dbusconfDATA install-dist_installed_test_dbsDATA \
+       install-dist_installed_test_keyring2DATA \
+       install-dist_installed_test_keyringDATA \
+       install-dist_triggersSCRIPTS install-dvi install-dvi-am \
+       install-envDATA install-exec install-exec-am \
+       install-flatpakincludeHEADERS install-html install-html-am \
+       install-info install-info-am install-installed_testDATA \
+       install-installed_testLTLIBRARIES \
+       install-installed_testPROGRAMS install-installed_testSCRIPTS \
+       install-installed_test_metaDATA install-introspectionDATA \
+       install-libLTLIBRARIES install-libexecPROGRAMS install-man \
+       install-nobase_installed_testDATA \
+       install-nodist_flatpakincludeHEADERS install-nodist_girDATA \
+       install-nodist_typelibDATA install-pdf install-pdf-am \
+       install-pkgconfigDATA install-polkit_policyDATA \
+       install-polkit_rulesDATA install-profileDATA install-ps \
+       install-ps-am install-scriptsSCRIPTS install-strip \
+       install-systemdsystemunitDATA install-systemduserunitDATA \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am recheck tags tags-am uninstall \
+       uninstall-am uninstall-binPROGRAMS uninstall-bwrapPROGRAMS \
+       uninstall-completionDATA uninstall-dbus_serviceDATA \
+       uninstall-dbussnippetDATA uninstall-dbussystemserviceDATA \
+       uninstall-dist_dbusconfDATA \
+       uninstall-dist_installed_test_dbsDATA \
+       uninstall-dist_installed_test_keyring2DATA \
+       uninstall-dist_installed_test_keyringDATA \
+       uninstall-dist_triggersSCRIPTS uninstall-envDATA \
+       uninstall-flatpakincludeHEADERS uninstall-installed_testDATA \
+       uninstall-installed_testLTLIBRARIES \
+       uninstall-installed_testPROGRAMS \
+       uninstall-installed_testSCRIPTS \
+       uninstall-installed_test_metaDATA uninstall-introspectionDATA \
+       uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \
+       uninstall-nobase_installed_testDATA \
+       uninstall-nodist_flatpakincludeHEADERS \
+       uninstall-nodist_girDATA uninstall-nodist_typelibDATA \
+       uninstall-pkgconfigDATA uninstall-polkit_policyDATA \
+       uninstall-polkit_rulesDATA uninstall-profileDATA \
+       uninstall-scriptsSCRIPTS uninstall-systemdsystemunitDATA \
+       uninstall-systemduserunitDATA
+
+.PRECIOUS: Makefile
+
+
+@ENABLE_INSTALLED_TESTS_TRUE@%.test: %$(EXEEXT) Makefile
+@ENABLE_INSTALLED_TESTS_TRUE@  $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
+@ENABLE_INSTALLED_TESTS_TRUE@  echo 'Type=session' >> $@.tmp; \
+@ENABLE_INSTALLED_TESTS_TRUE@  echo 'Exec=env G_TEST_SRCDIR=$(installed_testdir) G_TEST_BUILDDIR=$(installed_testdir)  $(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
+@ENABLE_INSTALLED_TESTS_TRUE@  echo 'Output=TAP' >> $@.tmp; \
+@ENABLE_INSTALLED_TESTS_TRUE@  mv $@.tmp $@)
+
+%.service: %.service.in config.log
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" \
+               -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@extraargs\@||" $< > $@
+
+common/flatpak-dbus.c: data/org.freedesktop.Flatpak.xml Makefile
+       mkdir -p $(builddir)/common
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.Flatpak.     \
+               --c-namespace Flatpak                           \
+               --generate-c-code $(builddir)/common/flatpak-dbus       \
+               $(srcdir)/data/org.freedesktop.Flatpak.xml      \
+               $(NULL)
+
+common/flatpak-systemd-dbus.c: data/org.freedesktop.systemd1.xml Makefile
+       mkdir -p $(builddir)/common
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.systemd1.    \
+               --c-namespace Systemd                           \
+               --generate-c-code $(builddir)/common/flatpak-systemd-dbus       \
+               $(srcdir)/data/org.freedesktop.systemd1.xml     \
+               $(NULL)
+
+common/%-dbus.h: common/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+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
+
+# gobject-introspection rules
+-include $(INTROSPECTION_MAKEFILE)
+
+@HAVE_INTROSPECTION_TRUE@Flatpak-1.0.gir: libflatpak.la Makefile
+
+@BUILD_SYSTEM_HELPER_TRUE@system-helper/org.freedesktop.Flatpak.rules: system-helper/org.freedesktop.Flatpak.rules.in
+@BUILD_SYSTEM_HELPER_TRUE@     $(AM_V_GEN) $(SED) -e "s|\@privileged_group\@|$(PRIVILEGED_GROUP)|" $< > $@
+
+@BUILD_SYSTEM_HELPER_TRUE@%.policy: %.policy.in
+@BUILD_SYSTEM_HELPER_TRUE@     $(AM_V_GEN) $(MSGFMT) --xml -d $(top_srcdir)/po --template $< -o $@ || cp $< $@
+
+permission-store/permission-store-dbus.c: data/org.freedesktop.impl.portal.PermissionStore.xml Makefile
+       mkdir -p $(builddir)/permission-store
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.impl.portal. \
+               --c-namespace Xdg                               \
+               --generate-c-code $(builddir)/permission-store/permission-store-dbus    \
+               $(srcdir)/data/org.freedesktop.impl.portal.PermissionStore.xml  \
+               $(NULL)
+
+permission-store/%-dbus.h: permission-store/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+document-portal/xdp-dbus.c: data/org.freedesktop.portal.Documents.xml Makefile
+       mkdir -p $(builddir)/document-portal
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.portal.      \
+               --c-namespace XdpDbus                           \
+               --generate-c-code $(builddir)/document-portal/xdp-dbus  \
+                --annotate "org.freedesktop.portal.Documents.Add()" org.gtk.GDBus.C.UnixFD "yes" \
+                --annotate "org.freedesktop.portal.Documents.AddFull()" org.gtk.GDBus.C.UnixFD "yes" \
+               $(srcdir)/data/org.freedesktop.portal.Documents.xml     \
+               $(NULL)
+
+document-portal/%-dbus.h: document-portal/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+tests/services/org.freedesktop.portal.Documents.service: document-portal/org.freedesktop.portal.Documents.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.impl.portal.PermissionStore.service: permission-store/org.freedesktop.impl.portal.PermissionStore.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.Flatpak.service: session-helper/org.freedesktop.Flatpak.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.Flatpak.SystemHelper.service: system-helper/org.freedesktop.Flatpak.SystemHelper.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $< > $@
+
+tests/libtest.sh: tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service  tests/services/org.freedesktop.Flatpak.service
+
+install-test-data-hook:
+@ENABLE_INSTALLED_TESTS_TRUE@  mkdir -p $(DESTDIR)$(installed_testdir)/services
+@ENABLE_INSTALLED_TESTS_TRUE@  ln -sf $(dbus_servicedir)/org.freedesktop.Flatpak.service $(DESTDIR)$(installed_testdir)/services/
+@ENABLE_INSTALLED_TESTS_TRUE@  ln -sf $(dbus_servicedir)/org.freedesktop.portal.Documents.service $(DESTDIR)$(installed_testdir)/services/
+@ENABLE_INSTALLED_TESTS_TRUE@  ln -sf $(dbus_servicedir)/org.freedesktop.impl.portal.PermissionStore.service $(DESTDIR)$(installed_testdir)/services/
+@ENABLE_INSTALLED_TESTS_TRUE@  $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $(top_srcdir)/system-helper/org.freedesktop.Flatpak.SystemHelper.service.in > $(DESTDIR)$(installed_testdir)/services/org.freedesktop.Flatpak.SystemHelper.service
+
+tests/package_version.txt: Makefile
+       echo $(PACKAGE_VERSION) > tests/package_version.txt
+
+tests/test-basic.sh: tests/package_version.txt
+
+@VALGRIND_CHECK_RULES@
+
+# NOTE: bwrap is install-bwrapPROGS which is run from install-data, not install-exec, this data-hook is used
+install-data-hook:
+       $(MAKE) $(AM_MAKEFLAGS) install-test-data-hook
+@PRIV_MODE_SETUID_TRUE@@WITH_SYSTEM_BWRAP_FALSE@       $(SUDO_BIN) chown root $(DESTDIR)$(libexecdir)/flatpak-bwrap
+@PRIV_MODE_SETUID_TRUE@@WITH_SYSTEM_BWRAP_FALSE@       $(SUDO_BIN) chmod u+s $(DESTDIR)$(libexecdir)/flatpak-bwrap
+
+flatpak.sh: profile/flatpak.sh.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+flatpak.env: env.d/flatpak.env.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+flatpak.conf: dbus.service.d/flatpak.conf.in
+       $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \
+               -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..b771f4e
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,1225 @@
+Major changes in 0.10.2
+=======================
+
+ * Flatpak now requires OSTree 2017.14
+ * flatpak update now updates from both system and user installations
+   by default.
+ * flatpak update is less noisy when updating appstream info.
+ * All the remote-* commands now by default automatically decide to use
+   --user or --system based on the given remote name.
+ * flatpak remote-ls with no remote lists the content of all remotes
+ * Fixed regression that made xdg-user-dirs and theme selection
+   for kde apps break.
+ * flatpak override with no argument now overrides globally, i.e. for
+   all apps.
+ * flatpak override now supports --nofilesystem properly. For example
+   flatpak override --nofilesystem=~/.ssh hides the ssh dir for all
+   apps, even those who have homedir access.
+ * flatpak install now takes a --reinstall argument which uninstalls
+   a previously installed version if necessary. This is very useful
+   when you want to install a new version from a different source.
+ * flatpak install now allows you to pass an absolute pathname as
+   remote name, which will create a temporary remote and install
+   from that. The remote will be removed when the app is uninstalled.
+   This is very useful during development and testing.
+ * Flatpak now creates CLI wrappers for all installed apps, so if you
+   add /var/lib/flatpak/exports/bin or ~/.local/share/flatpak/exports/bin
+   to your PATH you can easily  start flatpak apps by their application id.
+
+Major changes in 0.10.1
+=======================
+
+ * New command "flatpak remote-info" shows information about applications
+   in a remote. In particular the --log operation shows the history and
+   can be used in combination with flatpak upate --commit=XYZ to roll
+   back to a previous version.
+ * New command "flatpak search" which allows you to search the appstream
+   data from the commandline.
+ * flatpak update now upates appstream data for all confured remotes, which
+   is important for search to work.
+ * Allow automatic installation of gtk themes matching the active theme.
+ * Handle the case when /etc/resolv.conf is a symlink
+ * /usr an /etc are now expose in /run/host in the app if the app has
+   full filesystem access.
+ * flatpak remote-add now works as a user when /var/lib/flatpak is empty,
+   allowing flatpak to work on stateless systems.
+ * Add support for flatpak build --log-session/system-bus, similar to
+   what flatpak run already does.
+ * flatpak build --readonly runs with the target directory (normally /app)
+   mounted read-only.
+ * Fall back to LD_LIBRARY_PATH if a runtime doesn't have /usr/bin/ldconfig.
+ * Updated the support for OCI remotes. This is work in progress and still
+   disabled by default though.
+
+Major changes in 0.10
+=====================
+
+This is the first release in a new series of stable releases called
+0.10.x. New features will be added to 0.11.x, and bugfixes will be
+backported to 0.10.x. During the early phase of the 0.10.x series we
+may also backport minor features, but we guarantee backwards
+compatibility.
+
+Changes since 0.9.99
+ * Added the flatpak config option which can set the language settings
+ * Fix issue where sometimes ld.so.conf were not generated
+ * /dev/mali0 is added to --device=dri
+ * Work around ostree static delta issues in some cases
+
+Major changes in 0.9.99
+=======================
+
+ * Requires ostree 2017.12 for important pull stability fix
+ * New libflatpak API: flatpak_dir_cleanup_undeployed_refs, flatpak_installation_prune_local_repo,
+    flatpak_installation_remove_local_ref_sync, flatpak_installation_cleanup_local_refs_sync
+ * build: FLATPAK_ID and FLATPAK_ARCH are now set in the environment when building
+ * update: Don't fail the entire update if some remote fails to update its metadata
+ * run: /.flatpak-info now lists exact commits and extensions in use
+ * run: We now use a per-app ld.so.cache file whenn running. This should speed things up,
+   and allows ldconfig to report the correct results.
+ * The verbose mode was changed into two levels, use -vv to show the more detailed info, which
+   currently only contains the full bubblewrap argument lists.
+ * run: Some common problematic host environment variables are now unset in the sandbox
+   (PYTHONPATH, PERLLIB, PERL5LIB and XCURSOR_PATH)
+ * run: Fixed failure when a higher prio extensions depended on a lower prio one.
+ * run: The extension ld path order is now: app extensions, app, runtime extension, runtime.
+   This was previously incorrect in that the app could override app extensions.
+ * Extensions are now not downloaded if a matching unmaintained extension is already installed
+ * Preemptive changes to handle new bubblewrap change which doesn't user /newroot
+ * document portal: Disable debug spew that was accidentally enabled
+ * build-finish: New --extension-priority option
+ * run: Fix regression in --persist in 0.9.98
+ * run: Use sealed memfds (instead of just temporary files) when passing data to bubblewrap
+
+Major changes in 0.9.98.2
+=========================
+
+ * Fix permission denied when using the system-helper
+
+Major changes in 0.9.98.1
+=========================
+
+ * run: Fix homedir access if the app has --filesystem=host access
+ * build-update: Fix appstream update in case one arch didn't change
+
+Major changes in 0.9.98
+=======================
+
+ * libflatpak now correctly finds metadata for subset installations (like locale data)
+ * flatpak build now supports --appdir which exposes the per-app directory in the
+   user homedir. This is useful when testing builds.
+ * The host fontconfig caches are exposed to the sandbox, next to the fonts in /run/host.
+   This will (pending fontconfig work) allow sharing host fontconfig caches, allowing
+   much faster initial startup for flatpak apps.
+ * flatpak install now supports --no-pull
+ * Added new extension property "locale-subset", which makes the extension point
+   act like a locale extension (i.e. only install the subset configured by the
+   locale).
+ * flatpak remote-add --oci is disabled for now, as this is not up to date with
+   the latest OCI work, and we don't want to break existing deployments if this
+   has to change when this lands.
+ * Parallel installation/updates are now safe because we take a filesystem lock
+   whenever we prune the local ostree repo.
+ * Flatpak run now works when important paths like $HOME, etc, are symlinks.
+ * The ostree min-free-space property is is set to zero by default for the
+   flatpak repos. This was causing a lot of problems for people, but the feature
+   is still there if you manually enable it.
+
+Major changes in 0.9.12
+=======================
+
+ * Fixed a regression in extra-data installation
+ * Don't expose the a11y bus in flatpak build
+
+Major changes in 0.9.11
+=======================
+
+ * You can now show all outstanding updates with: flatpak remote-ls --updates
+ * The dbus filter "org.name.*" now means all subnames of org.name, not just
+   the first level. This matches how dbus arg0namespace works, and how the
+   comming dbus container support will work.
+ * Fixed segfauld on update
+ * Better commandline tab completion
+ * Flatpak now exposes host icons readonly as /run/host/share/icons to the sandbox.
+
+Major changes in 0.9.10
+=======================
+
+ Fix regression in dbus proxy that causes some apps to not
+ work in 0.9.9.
+
+Major changes in 0.9.9
+======================
+
+flatpak-builder was split out into its own module:
+  https://github.com/flatpak/flatpak-builder
+
+ * When downloading to a temporary directory for later install to the
+   system repo we now write to /var/tmp instead of $HOME. This is more
+   likely to be the same filesystem as /var/lib/flatpak, and thus will
+   not run into issues with e.g. filesystem full.
+ * We now get the default language list from AccountService if possible.
+ * A regression that made --devel crash was fixed.
+ * New feature for flatpakrefs, SuggestRemoteName=remotename will cause
+   flatpak to ask if you want to create a generic (not app specific)
+   remote for the repo url.
+ * flatpak build now does not die with the parent by default, you have
+   to pass --die-with-parent. This was done because die-with-parent
+   uses PR_SET_PDEATHSIG which does not work well if the parent is
+   threaded, like e.g. gnome-software is.
+ * We now always re-set the personality in the sandboxed process
+   in order to avoid inheriting weird settings.
+ * We now share a single dbus proxy instance for all proxies for a sandbox.
+ * dbus-proxy now properly disallows old-style eavesdropping.
+ * We now support accessibility by starting a customized dbus proxy for the
+   a11y bus.
+
+Major changes in 0.9.8
+======================
+
+Core:
+
+ * Experimental support for peer2peer installation, enable with --enable-p2p
+ * Add default language setting to flatpak config. Defaults to all locales for
+   system installs and the users locale for per-user installs.
+ * build-update-repo: Now always keeps the *two* latest deltas around to avoid
+   race conditions with outstanding downloads at the time or running the update.
+ * Support loading extra data from local lookaside cache.
+
+Flatpak-builder:
+
+ * Set terminal title to the currently building module
+ * Added ability to specify http url for sources mirror with --extra-sources-url.
+ * --install-deps-from=REMOTE installs the dependencies needed for the
+   manifest.
+ * New option --delete-build-dirs to always delete build directories,
+   even on a failed build.
+ * New property "add-extension" makes it nicer to create extension points.
+
+Major changes in 0.9.7
+======================
+
+ * Don't re-download git repo when bundling sources
+ * Build modules with no source if buildsystem is "simple"
+ * Build cleanups
+
+Major changes in 0.9.6
+======================
+
+This version requires the latest ostree version (2017.7) because it
+uses a new feature that hardens the security of flatpak. Previously,
+if you installed to a system-wide repository, the files created for an
+application were as specified by the remote repo, but owned by root,
+which could include problematic permissions like setuid or
+world-writable. We now never create such problematic files or
+directories on disk. Flatpak export was also changed to never
+create problematic files in new apps.
+
+Related to this, newly created flatpak installations also use the
+new "bare-user-only" mode for the repositories, which means you
+can now install applications even if your filesystem does not
+support extended attributes.
+
+Other changes:
+
+ * flatpak info --show-metadata now only shows the metadata, in
+   a machine parseable way.
+ * build-export now records the flatpak version in the commit message
+ * builder: The .pyc timestamp fixer now allows .pyc files with no
+   corresponding .py file.
+ * builder: New feature 'inherit-extensions' lets you copy extension
+   info from the parent runtime.
+ * builder: Set ExtensionOf in auto-created extensions (like Locale
+   and Debug)
+ * builder: Setting CPPFLAGS now works
+
+Major changes in 0.9.5
+======================
+
+ Changes in flatpak:
+
+ * Fix installation of installed tests
+ * Don't show an error when updating if a remote is disabled
+ * Store the app id in the X-Flatpak key when exporting a
+   desktop file.
+ * flatpak run: Handle paths when rewriting %u urls during
+   file forwarding.
+ * builder: Always assume separate builddir when using meson, as
+   meson only works with this.
+ * document-portal: The app-specific directory is always accessible
+   to the app, take this into consideration for AddFull.
+ * builder: Don't warn for unknown keys if they start with x-
+ * Fix a race condition whe restarting the document portal
+ * build-update-repo: Don't list removed deltas in the summary
+ * list: Don't show .Locale/.Debug/.Sources by default. Show with -a.
+ * remote-ls: Don't show .Locale/.Debug/.Sources, or non-primary
+   arches (unless the primary does not exist) by default.
+   Show with -a.
+ * dbus-portal: Fix handling of NameHasOwner
+ * builder: Add --export-only to export a previous build.
+ * run: Allow regular files for --filesystem=xdg-config/path
+ * run: Allow --filesystem=xdg-config/subdir:ro (previously
+   it needed to be writable).
+ * build-commit-from: Properly handle xa.ref when rewriting
+   refnames.
+
+Major changes in 0.9.4
+======================
+
+ Changes in flatpak:
+
+ * Now requires ostree 2017.6 and bubblewrap 0.1.8
+ * Better progress reporting in CLI and UI
+ * Improved output from commands info, list, remotes,
+   remote-ls: More detail, colors, nicer table formating.
+ * New command flatpak repo that lets you show information
+   about local repositories.
+ * When launching exported desktop files, the paths
+   passed to it are automatically created as documents
+   to allow access to the arguments, if needed.
+ * Flatpak install of an already installed application is
+   now a warning, not an error.
+ * flatpak build now kills all the processes in the
+   sandbox when it exits.
+ * flatpak update --subpath=... now updates the app event
+   if there is no new upstream version, but the subpath is
+   different from what is currently installed.
+ * Exports are now whitelisted, and the only thing you can
+   export are:
+     desktop files, icons, dbus services, mime definitions, and
+     gnome-shell search providers
+ * Exported gnome-shell search providers are automatically
+   disabled by default.
+ * Exported mimetypes are rewritten to only allow globs, and to
+   make the globs have a low priority vs system mime info.
+ * A remote can now redirect to a new URL and/or a new GPG key, by
+   using build-update-repo --redirect-url=URL --gpg-import=FILE.
+   When clients see this they permanently change the local configuration.
+   This is very useful when migrating official repositories.
+ * flatpak caches in the homedir are now stored in ~/.cache
+   (or $XDG_CACHE_HOME) instead of ~/.local/share/flatpak/system-cache.
+ * Added version field to all exported dbus interfaces.
+ * New AddFull method in the Document Portal, which allows
+   exporting multiple files, as-needed by a particular target
+   app. This is useful for implementations of dbus activation
+   for desktop files.
+ * New flag --no-static-deltas for install/update without
+   using static deltas. Mostly useful for debugging.
+ * TMPDIR is now unset in the sandbox, if set on the
+   host. Each sandbox has a personal /tmp that is used.
+ * Flatpak run now works if /tmp is a symlink on the
+   host.
+ * /etc/hosts and /etc/hosts.conf from the host are now exposed
+   in the sandbox in addition to /etc/resolv.conf.
+ * Titles and default branches are now automatically updated from
+   the remote unless they are explicitly set. You no longer have
+   to run flatpak remote-modify --update.
+ * Some performance inprovements when installing apps.
+ * When exporting a build, the commit objects now always include
+   the branchname, the metadata and install/download size.
+   The sizes are reused for faster summary building, and the
+   others changes are for future use. The fields are verified
+   against the deployed metadata during installation, so it
+   is trusted.
+ * Fixed minor race condition in portal application identification.
+ * lib: New  flatpak_installation_update_appstream_full_sync method
+   that allows progress reporting.
+ * bash-completion: Fix out-of-bounds read that could produce
+   weird completion at times.
+
+ Changes in flatpak-builder:
+
+ * Added support for appdata screenshot mirroring.
+ * New property "install-rule" lets you change what Makefile rule to
+   use in the install phase.
+ * The git "commit" property can now specify both a tag object and the
+   commit object it refers to.
+ * New cppflags property, similar to e.g. cflags.
+ * The "env" property now overrides the cflags/cxxflags/ldflags
+   properties, to allow these to be reset.
+ * Initial checkout of git/bzr to a temporary directory so that errors
+   during checkout do not persist.
+ * Properly take the "buildsystem" field into account when calculating
+   cache freshness.
+ * Don't crash if appstream-compose fails.
+ * "ldflags" property now works  correctly.
+
+Major changes in 0.9.3
+======================
+ Changes in flatpak-builder:
+
+ * "rename-icon" renames in translated icons too
+ * Moved manifest format docs to own manpage, "flatpak-manifest".
+ * "bootstrap.sh" is now recognized as an autogen.sh alternative
+ * Fall back to not using rofiles-fuse if it is not available.
+ * Make sure flatpak-builder --run grants the app access to dbus.
+ * Make paths paths for module includes and module dependencies
+   relative to the included module rather than the "base" json file.
+ * When cross-compiling 32bit apps on 64bit arches (like i386 on x86-64)
+   then we automatically set a linux32 personallity.
+ * Print warnings for unhandled json properties.
+ * Make sure flatpak-builder --run works if --extra-data is in the
+   finish args.
+ * Take build-commands into consideration when considering if the
+   build cache is stale.
+ * Support for --extra-sources= to pre-seed downloaded sources.
+ * Support for --bundle-sources which creates a runtime with the sources
+   that were used to build the app.
+ * Handle trailing whitespace in git submodule uris
+ * Progress reporting while downloading files.
+
+ Other changes:
+ * build-export now always exports directories as readable and executable.
+ * build-update-repo --generate-static-deltas now fork the work process
+   rather than using threads, which avoids problems with this using
+   a lot of memory in a single process in some cases.
+ * Report flatpak version in HTTP request user agent.
+ * New "flatpak repo" command added that has some options for maintaining
+   a repository.
+ * flatpak info can now report more information and handles multiple
+   installed branches better.
+ * Support non-default WAYLAND_DISPLAY environment var.
+ * Handle application ids that end with .desktop when generating
+   appstream data.
+ * Documentation updates
+
+Major changes in 0.9.2
+======================
+
+ * Fixed a use-after-free and some leaks in the dbus-proxy. This
+   is not currently believed to be exploitable, but the proxy is a
+   security boundary, so we still  recommend to update.
+ * Regular updates now never allow updates to an older version
+   than what is currently installed (unless you explicitly specify
+   an old commit id). This closes a hole where a MITM attacker can
+   force clients to downgrade to an earlier (gpg-signed) version of
+   the application.
+ * The automatic detection of --from in flatpak install now detects
+   flatpakref extensions even in URIs that end in a query string such as
+   https://git.gnome.org/browse/gnome-apps-nightly/plain/gedit.flatpakref?h=stable
+ * OCI support now supports GPG signatures
+ * OCI support now works with the system-helper for unprivileged systemwide
+   installation.
+ * Experimental support for the new ostree bare-user-only repo mode that
+   allows flatpak to run on filesytems without xattrs. Set
+   FLATPAK_OSTREE_REPO_MODE=user-only in the environment to use this.
+ * builder: New property disable-fsckobjects for git sources
+ * builder: New property commit for git sources. This lets you specify
+   both a tag (for readability) and a commit id (to ensure the tag doesn't
+   change).
+ * builder: The manifest file format docs have been split out into its
+   own manpage.
+ * builder: App manifests now support specifying sdk-extensions that has
+   to be installed for the app to build.
+ * builder: When creating the platform, remove all sdk-specific extensions,
+   allowing creation of sdk-specific extensions.
+ * builder: Correctly handle absolute pathnames in the specified
+   command.
+ * builder: Support --default-branch which defined the branch to build in
+   case the manifest doesn't specify one.
+ * When exporting builds to ostree we now use the canonical permissions
+   for bare-user files, which means the resulting builds can safely
+   be used with the new ostree bare-user-only repository type.
+ * The detection of "unmaintained" system extensions was broken, and
+   in some cases these extensions were not found. This now always
+   works.
+ * Flatpak now builds with latest OSTree. This required some fixing for
+   multiple definitions of the g_auto* macros as OSTree now exports
+   those.
+ * We no longer rely on ostree trivial-httpd for the tests, because
+   this is optional in later versions of ostree. Instead we use
+   they python SimpleHTTPServer.
+ * The minimum glib version has been corrected to 2.44.
+ * The minumum automake version has been increased to 1.13.4
+   because some older version didn't work.
+
+Major changes in 0.9.1
+======================
+
+This release mostly has changes to flatpak-builder and the build
+machinery. All flatpaks built with this version can run
+on flatpak 0.8.x, but there has been additions and minor
+changes in flatpak-builder that may require minor changes
+to existing builder manifests, see below.
+
+The flatpak-builder build cache now uses an ostree feature called
+rofiles-fuse. This allows the build to work directly against
+hardlinked checkouts of the cache, because rofiles-fuse disallows
+writes to the hardlinked files (but allows replacing them). This makes
+cache commits and checkouts much faster. However, it also means that
+installation cannot do in-place modification of files in the
+installation directory. There is a new per-module property called
+"ensure-writable" that takes a list of patterns and ensures all files
+matching them are writable (by manually breaking the hardlinks). This
+may need to be added to some manifests to keep them building in the new
+version.
+
+The cflags and cxxflags module properties now work by appending,
+rather that replacing, when there are multiple values specified. For
+instance, the per-arch or per-module cflags will be appended to the
+base cflags. This may cause old json files do duplicate cflags in
+some cases. Normally compiler flags are repeatable without problems
+though, so it is unlikely to cause problems.
+
+Here are a short summary of the rest of the flatpak-builder changes:
+
+ * The build cache was changed so that it is not invalidated if
+   the installed version of the SDK changed. This means that the app
+   will not rebuilt if you updated the SDK. This is generally the right
+   thing to do, as SDKs are meant to be compatible.  If you want
+   to avoid this (for instance when building against an unstable sdk)
+   you can use the --rebuild-on-sdk-change argument.
+ * The build cache is now per-arch, so building on one arch doesn't
+   invalidate the cache for another arch.
+ * New buildsystem "cmake-ninja" which works like "cmake", but builds
+   using ninja, rather than make.
+ * New buildsystem "simple" which doesn't use configure or make, it
+   just runs a set of shell commands specified in the "build-commands"
+   property. Note: build-commands is also available to other buildsystems
+   and are run between make and make install.
+ * flatpak-builder now has build-runtime and build-extension properties that
+   makes it easier to build runtimes and extensions.
+ * FLATPAK_DEST is set in the build environment to the installation
+   destination (i.e. typically /app). It is particularly useful when
+   building an extension where the destination is more complex.
+ * flatpak-builder now supports --from-git=URL which pulls the
+   json manifest and related files directly from a git repo.
+ * modules have a new no-make-install property which skips
+   the make install step.
+ * Modules and sources have only-arches and skip-arches properties,
+   which lets you enable/disable them based on the build architecture.
+ * build-options has a new property ldflags, which is similar
+   to cflags and cxxflags.
+ * flatpak build (and thus flatpak-builder --run) now supports
+    dbus proxies when needed.
+ * All git repos are cloned with fsckObjects=true, which means
+   we verify that the repos are valid.
+ * New flatpak-builder argument --build-shell=MODULE extracts and
+   prepares the sources for a specified module and then starts
+   a build sandbox inside it.
+
+There are also some other changes:
+
+ * build-export: Now supports --timestamp=ISO-8601-TIMESTAMP, which
+   allows you to create reproducible commits.
+ * The OCI support has been updated to the latest version of the
+   OCI image specification format.
+ * There is a new flatpak-bisect script that can be used to bisect
+   flatpak applications, looking for regressions.
+ * flatpak list got a revamp. It now shows more information, and
+   shows both apps and runtimes by default.
+ * flatpak remote-list was renamed flatpak remotes in order
+   to minimize confusion with flatpak remote-ls. The old name
+   is deprecated but still works.
+
+Major changes in 0.8.4
+======================
+
+In addition to the regular list of bugfixes this stable release
+include backports of one more feature required for making OpenGL work
+well. Now extra-data using extensions (such as the nvidia driver) can
+specify that it doesn't need a runtime to run its apply script. We use
+this in the nvidia driver by making the script a static binary, which
+lets us use the nvidia driver for multiple runtimes without requering
+that a particular one is installed. We also support an extension point
+supporting multiple versions, which will be use for sharing the
+nvidia driver between different runtime versions.
+
+Additional fixes:
+ * Documentation fixes
+ * Crash fixes
+ * Fix xauth propagation in some cases
+ * Don't remove origin remotes on uninstall if some other app
+   is installed from it.
+ * Don't reset what locales are installed when updating a locale
+   extension
+ * Disable splice for the documentation portal as it seems
+   to be broken in fuse
+ * Append, don't override XDG_DATA_DIRS in profile script
+ * Fix progress reporting in libflatpak to go from 0 to
+   100% once, merging the various phases.
+
+Major changes in 0.8.3
+======================
+
+In addition to the regular list of bugfixes this stable release
+include backports of a the updated OpenGL support from master.  This,
+in combination with the work in the runtime allows flatpak to work out
+of the box with out-of-tree OpenGL drivers, including the nvidia
+driver.
+
+Additionally, due to some complicated issues wrt ptrace and user
+namespaces this version disables the use of user namespaces if
+bubblewrap is setuid, as it cause problems for the way flatpak
+portals identifies applications. (See issue #557 for details)
+
+ * Better handling of errors for extra-data
+ * Handle extra-data properly for runtimes (as well as apps)
+ * Respect required version for runtimes (as well as apps)
+ * flatpak list: Don't break if some local ref is not deployed
+ * builder: Look for appstream data in /app/share/metadata also
+ * builder: Fix buildsystem=cmake builds
+ * Add progress reporting to extra-data download
+ * Fix uid/gid for directories in document portal
+
+Major changes in 0.8.2
+======================
+
+This is a bugfix and security update.
+
+Some of the bind-mounts that flatpak sets up were not read-only as
+they should have. This includes: extensions, system fonts,
+resolv.conf, localtime and machine-id. Many of thse are typically only
+writable by root, but some, like the user-specific fonts and
+user-installed extensions could be modified from the sandbox.
+
+Everyone using 0.8.x is recommended to update to this version.
+
+Other fixes:
+
+ * There are new configure options for where to install dbus configuration
+ * Broken symlinks in the root directory no longer break flatpak run
+ * flatpak run with HOME in /var now works
+ * dri access now also handles mali devices
+ * install handles --arch when installing flatpakrefs
+ * system-helper activation fixed on systemd-less setups
+ * dbus-proxy now works without /run
+ * During installation, failing to update a dependency is now not
+   fatal.
+ * /etc is now fully writable when building runtimes
+ * --filesystem=xdg-config/foo now sets up the bind-mount from the host dir
+   even when not using :create.
+
+Major changes in 0.8.1
+======================
+
+This is a bugfix and security update (CVE-2017-5226).
+
+Flatpak now uses seccomp to disallow the TIOCSTI ioctl in the sandbox,
+which works around the possibility to inject text on the controlling
+tty (CVE-2017-5226).
+
+This was previously fixed in bubblewrap in 0.1.6, but that change has
+now been reverted as it introduced other problems for flatpak.
+
+ * Update bundled bubblewrap to 0.1.7
+ * Fix writing new file with O_EXCL in the document portal.
+ * Allow appstream data that doesn't have .desktop in the component id,
+   such as data for runtimes.
+ * Drop json-glib dependency from 1.2 to 1.0
+ * Builder: Fail if unable to read included file
+ * OCI: Ensure exported layers are readable by everyone
+ * Fix extra-data download in gnome-software
+ * Fix update-mime-database trigger when installing via
+   the system helper.
+ * Updating an app by installing a newer bundle now works
+   again.
+ * Make /var/tmp not be on a tmpfs (it is now in
+   ~/.var/app/$appid/cache/tmp).
+ * Documentation / translation updates
+
+Major changes in 0.8.0
+======================
+
+This is the first release in a new series of stable releases called
+0.8.x. New features will be added to 0.9.x, and only bugfixes will be
+backported to 0.8.x. The featureset of this release is a good base to
+target if you're creating flatpaks that should be widely usable.
+
+This release technically requires only OSTree 2016.14, and it build
+fine with this, but we recommend using OSTree 2016.15, because of the
+change in how it verifies the checksums of commits in delta files.
+
+ * Flatpakrepo files now support a RuntimeRepo= key which points to
+   a flatpakrepo file. This means the user don't have to manually
+   configure a remote for the runtime, just reply to the prompt
+   to automatically do this when installing the app.
+ * We now support dependencies when installing bundles. This includes
+   required runtimes, related refs, and the equivalent of RuntimeRepo.
+ * The support for OCI in flatpak has been updated to the latest
+   OCI spec version, and support has been added to directly install
+   flatpak applications from an OCI image.
+ * In flatpak install, the --from and --bundle options are now optional
+   if the argument has the correct suffix (.flatpakref and .flatpak)
+ * Flatpak install now supports -y to let you avoid interactive prompts.
+ * build-finish: We now export mime type files with the right name.
+ * build-finish: New --require-version option let you specify a particular
+   version of flatpak, and older version of flatpak will not install
+   or update to the new version.
+ * build-sign: Allow signing all apps by omitting the id.
+ * Fix regression in the document portal when adding named files.
+ * build-import-bundle now signs the commit if you specify a gpg key.
+ * Flatpak now reads configuration from /etc/flatpak/installations.d
+   which lets you support multiple system-level installation paths.
+   These can be accessed with new --installation=... arguments to
+   most of the commands.
+ * flatpak-builder: Support --jobs=N to limit parallel builds
+ * flatpak-builder: Patch source got new options property that lets
+   you pass arguments to patch.
+ * flatpak-builder: New generic "buildsystem: type" option that
+   replace the (now deprecated) "cmake: true" option. This
+   supports "autotools", "cmake" and "meson".
+
+Major changes in 0.6.14
+=======================
+ * Update bundled bubblewrap to 0.1.4 which has some nice bugfixes.
+   If you are using an external bubblewrap it is recommended, but
+   not required to update.
+ * Requires OSTree 2016.14, which allows us to drop some old
+   workarounds.
+ * When installing an application system-wide, don't consider
+   dependencies that are installed for the user only.
+ * Flatpak install --from now tries to re-use existing remotes to
+   avoid creating unnecessary origin remotes.
+ * Using --filesystem=$dir when $dir is a symlink-to-directory now works.
+ * Using --filesystem=$file to expose unix sockets to the app is now
+   allowed.
+ * By default all the directories in ~/.var/app (except the app), as
+   well as ~/.local/share/flatpak are hidden in the sandbox.
+ * New option --filesystem=$dir:create which will create the destination
+   if it did not previously exist.
+ * --filesystem= now supports for xdg-[config|cache|data]. This
+   allows you access to the host versions of these xdg dirs. Additionally
+   if you use these with a subdirectory, like:
+     --filesystem=xdg-config/subdir
+   then that subdirectory on the host will be shared with the per-app
+   instance of the xdg-dir.
+ * Builder now correctly handles app-ids that have dashes in them.
+   Previously this generated invalid ids for the debuginfo and locale
+   extensions.
+ * The experimental OCI file format support was changed from creating an
+   OCI container to creating an OCI image.
+ * Fix regression where "flatpak update --appstream remotename" broke
+
+Major changes in 0.6.13
+=======================
+ * The command line arguments for install/update/uninstall changed
+
+   These used to take an application id and an optional branch name as
+   two arguments. This meant you could not specify multiple apps
+   to install in a single command. So, instead of having the branch
+   as a separate argument we now support partial references.
+   If you only specify an id we try to match the rest as best we
+   can depending on what is installed/available, but if this
+   matches multiple things you have to specify more details.
+
+   For example you can use:
+     * org.my.App//stable - Any compatible arch, stable branch
+     * org.my.App/x86_64 - x86-64, look for available branch
+     * org.my.App/x86_64/stable - exact reference
+
+   This means install/update/uninstall can now install multiple apps
+   in a single operation.
+
+ * Application runtime depencenies are checked/downloaded
+
+   Whenever you install or update an application we check that the
+   required runtime is installed. If not, we check if it is available
+   in any configured remote, and if found asks the user if/where to
+   install it from. If it is not found, the install/update fails.
+
+   You can mark remotes as --no-use-for-deps, which means flatpak will
+   never search for runtime dependencies in such remotes. This makes
+   the dependency search faster if you have app-only remotes.
+   It is recommended that app-only .flatpakrepo file define this
+   by specifying NoDeps=true.
+
+ * remote-add and install --from now supports uris
+
+   This means you can install flatpakrefs and flatpakrepos in a
+   single command like so:
+
+    * flatpak remote-add --from gnome https://sdk.gnome.org/gnome.flatpakrepo
+    * flatpak install --from https://sdk.gnome.org/gedit.flatpakref
+
+ * flatpak run can now launch a runtime directly
+
+   For example, "flatpak run org.gnome.Platform//3.22" will launch a shell
+   inside a sandboxy with the gnome 3.22 runtime and an empty /app.
+   This is useful for development and testing.
+
+ * included bubblewrap was bumped to 0.1.3 which has a security fix
+ * Support for defining the default branch per remote
+ * remote-add/modify: --update-metadata pulls current title and default branch
+   from remote summary file
+ * Applications can now list a set of URIs that will be downloaded with the
+   application. The app can then extract these and use as a part of the
+   application data. This is useful for applications using freely downloadable
+   parts that can't be redistributed elsewhere.
+ * flatpak-builder: Support --finish-only and --allow-missing-runtimes
+ * flatpak-builder: Support app layering
+
+   An app can define a "base" application which is used for the initial
+   content before the application is built. This way applications can
+   be built in a layered fashion.
+
+ * dbus proxy: The filtering has been tightened up
+ * build-finish: Now exports icons for themes other than hicolor too
+ * There is support in the app metadata for generic policies.
+
+   These are read and propagated and supports overriding, but are
+   not otherwise interpreted by flatpak. They can be used by other
+   host services as static permissions for the application.
+
+ * Support for extensions directories
+
+   In addition to using flatpak maintained runtime as an extensions
+   flatpak can now use raw directories in ~/.local/share/flatpak/extension
+   and /var/lib/flatpak/extension. For example, if you create a
+   directory called org.freedesktop.Platform.GStreamer.MyPlugins/x86_64/1.4
+   there it will be used as a source for gstreamer plugins for all
+   runtimes based on the freedesktop 1.4 runtime.
+
+Major changes in 0.6.12
+=======================
+ * Partial revert in application id rules. Application ids
+   can now only have dashes in the last element. This allows
+   apps to export files such as org.my.App-extra.desktop which
+   was used by the libreoffice builds.
+ * By default the kernel keyring is not accessable, as it is
+   not containable.
+ * Some robustness fixes for build-commit-from
+ * Better error messages
+ * flatpak update --appstream now updates for all remotes
+ * Made flatpak enter work, and you can now use any pid in the sandbox.
+   However, it requires root permissions.
+ * Support for --device=kvm for /dev/kvm access
+ * Support for --allow=multiarch to support non-primary arch support.
+   For example running i686 code in an x86_64 app.
+ * Add new default-branch setting for the remote configuration
+
+Major changes in 0.6.11
+=======================
+
+ * Dashes are now allowed in application ids. However, to still work  with
+   symbolic icon names, they may not end with "-symbolic".
+ * HostCommand now handles ptys correctly
+ * Various documentation updates
+ * New FLATPAK_CHECK_VERSION macro in libflatpak
+ * HostCommand now returns the real PID rather than a fake one.
+ * Fix regression in flatpak update --appstream
+ * Fix regression installing bundles without origin urls
+ * New flatpak-builder option --show-deps lists all the files
+   the manifest depends on.
+
+Major changes in 0.6.10
+=======================
+
+ * Dropped requirement for systemd --user.
+   The way we detect if an process we're talking to is sandboxed, and
+   what application id it has doesn't use cgroups anymore, which means
+   that the dependency on systemd in the user session is now optional.
+   This also means the --no-desktop argument is not needed any more.
+   (It is still accepted but does nothing.)
+ * Initial support has been added for .flatpakref files. These are simple key
+   value files similar to .flatpakrepo files, however they specify an application
+   to install in addition to the repo information. For example, gedit can be
+   installed by downloading https://sdk.gnome.org/gedit.flatpakref and running:
+     flatpak install --from gedit.flatpakref
+   There is also library support for this so it can be added to graphical
+   installers (such as gnome-software).
+ * Requires OSTree 2016.10. The change in how OSTree handles mtimes in
+   checkouts that was introduced in 2016.7 has been reverted, and
+   the required changes in Flatpak has been made. This means that
+   flatpak now depends on OSTree 2016.10.
+ * Requires Bubblewrap 0.1.2 for builds using the system bubblewrap.
+   Builds using the included copy need no changes.
+ * The $XDG_RUNTIME_DIR/flatpak-info file has added information
+   about the running application, and is now also securely available
+   for a running application from the host as "/proc/$fd/root/.flatpak-info".
+   This is what is used to identify remote apps instead of the cgroup
+   info.
+ * A new run permission --allow=devel has been added. An application with
+   this permission is allowed to use ptrace and perf. This was previously
+   only available during "flatpak build" and "flatpak run -d". This
+   is useful if you're packaging e.g. an IDE.
+ * When an application is updated or removed a /app/.updated or /app/.removed
+   file is created for running instances. This can be used by applications to
+   trigger e.g. a restart for the new version.
+ * A new dbus request "HostCommand" has been added to org.freedesktop.Flatpak.
+   This lets you run any command on the host, and is therefore clearly not
+   sandboxed, so access to this should be limited. However, it is very useful
+   if you're using flatpak mainly as a distribution mechanism, for a non-sandboxed
+   application.
+ * flatpak-builder now supports running from inside a flatpak, by auto-detecting
+   this and using the HostCommand service to run recursive flatpaks.
+ * Consecutive calls to flatpak build-update-repo has been speed up.
+ * The document portal now allows sandboxed applications to create references
+   to files in /app and /usr (in the app/runtime).
+ * The update process noew doesn't stop at the first failure.
+
+Major changes in 0.6.9
+======================
+
+ * Dropped dependency on libgsystem
+ * Allow passing partial refs whenever a CLI command takes
+   an app or runtime name.
+ * New command build-commit-from creates a new commit based
+   on the contents of another commit (optionally from another
+   local repo).
+ * The sandbox now contains $XDG_RUNTIME_DIR/app/$APPID from the
+   host (and the directory is created if needed).
+ * update: Better output, and faster for the no updates case
+ * build-export: Don't make most validation errors fail, instead
+   just print a warning.
+ * builder: Support local path references for git sources
+ * builder: Better handling of recursive git submodules
+ * builder: Fixed issues with the .pyc mtime rewriting
+ * builder: Handle symbolic icons for rename-icon
+ * builder: Add --stop-at=$module to do partial builds
+ * builder: Add --sandbox flag to disable the build from escaping
+   from the sandbox via build-args.
+
+Major changes in 0.6.8
+======================
+
+ * Requires OSTree 2016.7, allowing us to enable use of static delta
+   for system downloads again.
+ * Support --no-desktop which allows you to run a flatpak app outside
+   a desktop, with some loss of functionallity (for example, there
+   will be no systemd --user scope created for the app)..
+ * More documentation.
+ * Memory leak fixes.
+ * Initial support for rpms as flatpak-builder archive sources.
+ * Start work on translating the CLI.
+ * Install systemd config snippet to set the right XDG_DATA_DIRS path.
+ * Support --arch in flatpak list.
+ * Support access() in the document portal.
+ * Validate exported desktop files.
+
+Major changes in 0.6.7
+======================
+
+ * Automatically download and update related references such
+   as locales when using the CLI.
+ * lib: Support for getting related references
+ * Document metadata format
+ * Support build using system-installed bwrap
+ * Allow access to the journal socket in the sandbox
+ * builder: Support applying patches with git (useful for binary diffs)
+ * Require ostree 2016.6
+
+Major changes in 0.6.6
+======================
+
+ * Better support for multi-arch (for instance, will automatically install
+   i386-only app on x86_64 without user having to specify --arch).
+ * Support --device=all to access the full host /dev
+ * More command line support for managing exported documents
+ * Extended API for the document portal: Lookup, Info, List
+ * flatpak-builder: Support initializing /var from a runtime
+   extension.
+ * Disable static deltas when updating via the system helper to
+   work around bug in ostree.
+
+Major changes in 0.6.5
+======================
+
+ * Documentation improvements
+ * builder: Check that the specified command exists after build is done
+ * builder: Fix up mtime in headers for python precompiled files
+ * builder: Allow submodules and including modules from other json files
+ * system-helper builds are optional (--disable-system-helper)
+ * system-helper: Support installing from local remotes and bundles
+ * Improved support for --subpath installs, including libflatpak support
+ * Improved command line completion
+
+Major changes in 0.6.4
+======================
+
+ * Fix an issue where flatpak sometimes created empty "repo"
+   directories in the CWD
+
+Major changes in 0.6.3
+======================
+
+ * Fix resolv.conf regression in `flatpak build`
+ * Fix LD_LIBRARY_PATH override support in `flatpak build`
+ * Support forwarding app permissions in `flatpak-builder --run`
+ * Flatpak is now smarter about the default branch to use in most operations
+ * update will not fail on the first error if updating several things
+ * New much more complete bash completion system
+ * Faster installations
+ * Support new keyfile format for remote-add --from=file
+
+Major changes in 0.6.2
+======================
+
+ * Fixed no-network support regression in setuid mode.
+ * Fixed creation of root-owned file in home dir when using sudo in some cases
+ * New --with-privileged-group configure option
+
+Major changes in 0.6.1
+======================
+
+ * Fixed support for systems without user namespaces (default for Arch) or
+   unprivileged support for user namespaces (default for Debian).
+ * Fix memory leak during install/update.
+ * update: Fix support for --arch.
+ * Set the right location for the system directory in the environment.
+ * system-helper: Support updating without deploying (needed for
+   gnome-software support).
+ * lib: Fix support for updates
+
+Major changes in 0.6.0
+======================
+
+Renamed from xdg-app to Flatpak.  Existing repositories should keep
+working, and locally user installed apps/runtime will be migrated
+automatically. However, there are some things that you have to be
+aware of:
+ * The command names are now flatpak/flatpak-builder
+ * System-wide installed apps/runtimes need to be reinstalled
+ * flatpak-builder uses a ".flatpak-builder" subdirectory instead
+   of ".xdg-app-builder".
+ * The bus name and interface name for the permission
+   store is changed, it was in org.freedesktop.XdgApp, but is
+   now in org.freedesktop.impl.portal.DesktopPortal.
+ * The installation migration is a one-time operation so you can't
+   go back to xdg-app after updating.
+ * The library API (and name) changed due to the rename.
+
+Other changes:
+ * Flatpak now hard-requires ostree 2016.5
+ * Switch from using xdg-app-helper to an included version of bubblewrap:
+   https://github.com/projectatomic/bubblewrap
+ * Added a policykit-based system helper that allows you to authenticate
+   via polkit to install into the system repository.
+ * Added an experimental command to export/import applications and runtimes
+   as an OCI tarball.
+ * builder: Fix creation of locale extensions if there was no locale data in the
+   build.
+ * Its now possible to disable/enable configured remotes.
+ * A lot of new tests where added, and we now support installed tests.
+ * builder now has an optional --arch argument for multiarch building.
+ * Builder modules can be disabled with "disabled": true.
+ * Using --filesystem=/tmp now hides the system X11 sockets.
+
+
+Major changes in 0.5.2
+======================
+
+* The way locale extensions work has changed. Now we build a single extension
+  for all locales, but we allow you to specify a subset of it during installation
+  and update time using the --subpath commandline flag.
+  The main reason for this is that the many extensions didn't scale, both in
+  technical terms (large ostree summary file size), but also in terms of the
+  UI listing hundreds of uninteresting things.
+* We no longer use sizes in the commit objects to get installed and download size,
+  instead we store some extra metadata in the summary file. This allows us
+  to get much faster access to these, as with recent ostree versions we can
+  cache the summary file.
+* New command xdg-app build-sign that lets you sign a commit at any time.
+* New argument xdg-app build --force-clean that removes pre-existing build dirs.
+* xdg-app run now uses the "current" version as the default if you specify no
+  branch or arch. It used to default to the "master" branch. This will default
+  to the last installed version, but can be changed with xdg-app make-current.
+* Added config-opts to the build-options in xdg-app-builder. This allows you
+  to extend the configure flags in an arch dependent way.
+* Documentation updates
+
+Major changes in 0.5.1
+=======================
+* Make xdg-app-builder --build-only not export the results
+* Create all-in-one Locale extension that combines all the locale extensions
+* Extract icons for all appdata nodes when creating appstream
+* Documentation updates
+* Better handling of metadata in xdg-app-builder cache
+* Respect the specified branch when exporting in xdg-app-builder
+* Fix support for multi-arch with i386 userspace and 64bit kernel
+* Avoid deprecated 32bit capabilities syscalls
+
+Major changes in 0.5.0
+=======================
+* Some libxdg-app API additions for handling bundles
+* Default to /bin/sh as user shell in sandbox
+* Fix detection of which apps are in use during uninstall
+* New implementation of fuse filesystem for document portal.
+  It is now cleaner and works on 32bit.
+* Honor the noenumerate flag on remotes in CLI and libxdg-app.
+* Add change notification for permissions store
+* Require signed summaries for gpg-signed remotes
+* Fix summary signatures of deltas in xdg-app build-update.
+
+Major changes in 0.4.13
+=======================
+* Fix misgeneration of appdata xml in some cases
+* Various improvements to bundles, and support in libxdgapp
+* Add sources to Debug extensions created by xdg-app-builder
+* Allow specifying subdirs of xdg-* dirs, for instance:
+   --filesystem=xdg-download/some-dir
+* Add support for --filesystem=xdg-run/subdir which means
+  XDG_RUNTIME_DIR dir, rather than xdg-user-dirs.
+* Add --generate-static-deltas option to build-update-repo.
+
+Major changes in 0.4.12
+=======================
+* Fix crashes.
+* Update exports when removing apps.
+* Remove appstream and repo refs when removing a remote.
+* Add some build options to make libxdg-app usable inside a sandbox.
+* xdg-app-builder builds are now in the .xdg-app-builder/build subdir.
+* Make system repo bare-user to avoid creating any setuid binaries.
+* Add xdg-app-builder --run operation that runs a command with the
+  build environment set up.
+* Support creating locale extensions with xdg-app-builder.
+* Add support for tags to metadata.
+* Put runtime info and tags in the appstream data
+
+Major changes in 0.4.11
+=======================
+* Fix assertion when installing runtime
+
+Major changes in 0.4.10
+=======================
+* App desktop files and icons were not being exported to the desktop
+
+Major changes in 0.4.9
+======================
+* Fix crash at end of runtime install.
+* xdg-app-builder has a new source type "shell" which lets you run arbitrary
+  shell commands.
+* Allow apps with writable homedir access to modify the xdg-app repos.
+* New xdg-app info command gives you status of an installed app or runtime.
+* The xdg-app-builder cache now contains the sdk commit id, so that a new
+  version of the sdk invalidates the cache.
+* Fixed a regression in the xdg-app install-app backwards compatibility
+  handling.
+* xdg-app now gives the application access to the deployment path, which can
+  be used to give host-side services access to app files (such as help
+  documents).
+* build-export no longer exports appstream files, and when generating appstream
+  files we don't need them to be.
+* The default architecture tag used by xdg-app is now made canonical when needed
+  (i.e. on arm/x86/mips).
+
+Major changes in 0.4.8
+======================
+* Changed global installation directory to /var/lib/xdg-app (not /var/xdg-app).
+* Add support for a dbus filtering on the system bus.
+* Choosing user namespaces or setuid is now a runtime option, not build time.
+* Fix xml-escaping in the appstream generation.
+* Various build fixes.
+* Added some more documentation for the library.
+* Disable support for running apps on systems without a systemd user session.
+* Fix uninitialized memory read in xdg-app-builder during git checkouts.
+* Correctly handle disabled git submodules in xdg-app-builder
+* Fix hiding of non-exported symbols in libxdgapp
+
+Major changes in 0.4.7
+======================
+* Enabled build of libxdg-app by default, now the API is stable
+  enough for e.g. gnome-software to use it.
+* Restructured the command line interface to xdg-app, it is now
+  more streamlined and easy to use. For instance, to install
+  both apps or runtimes, now use "xdg-app install $name".
+  The old commands still work, but are deprecated and not
+  in the docs.
+* xdg-app-builder has gotten a bunch of new features that
+  makes it easier to build apps, and some initial work to
+  make it possible to create runtimes using it
+* build-export now finds and export any app-info installed by
+  the app, and build-update-repo collects all such exports
+  into a per-repo branch for appstream and icons.
+* The client (and libs) support for locally mirroring the appstream
+  branch for each remote. This allows use to create graphical appstores
+  with user-readable information and icons.
+* On the client side one can now specify priorities for each
+  remote.
+
+Major changes in 0.4.6
+======================
+* Added an initial version of libxdg-app, a highlevel library
+  intended to be used by user interface frontends to xdg-app.
+  It is not yet API stable, so it is disabled by default.
+  Enable with --enable-libxdgapp
+* Added xdg-app-builder, a separate tool that makes it easier to build
+  applications with external dependencies.
+* Add support for single-file bundles, which can be a useful way
+  to distribute apps on e.g. a usb stick. Only works with the
+  latest version of ostree.
+* Always allow apps to talk to the built-in portals
+* Support granting read-only access to the filesystem with e.g. --filesystem=host:ro
+* Add /run/user/$uid/xdg-app-info file that contains the current permissions of the app
+* Add --writable-sdk option to xdg-app build-init
+* Add file locking to better handle concurrent xdg-app operations like update and install
+* Various fixes
+
+Major changes in 0.4.5
+======================
+* Support signing commits in build-export
+* Correctly handle symlinks in host root when app has host-fs access
+* Always regenerate summary after build-export
+* Make uninstall a bit more robust
+* Install the dbus introspection files
+* Add human readable size to build-export report
+* Add /dev/ptmx symlink in app
+* Fix apps not getting SIGCHILD
+* Only expose minimal /etc/[passwd|group] in app
+
+Major changes in 0.4.4
+======================
+* Fix race condition in fuse fs
+* Don't save uid/gid/xattrs in build-export
+* run: Handle existing mounts with spaces in them
+* propagate xauth cookies to sandbox
+
+Major changes in 0.4.3
+======================
+* Build with older ostree
+* Add --nofilesystem flag to e.g. xdg-app run
+* Add xdg-app dump-runtime command
+
+Major changes in 0.4.2.1
+======================
+* Fix dbus proxy
+
+Major changes in 0.4.2
+======================
+* Fix build with older versions of glib
+* Fix regression in filesystem access configuration
+* Make seccomp use optional (for arches without it)
+* Add xdg-app enter command to enter a running sandbox
+* Fix /var/cache being readonly
+* Add /var/data and /var/config shortcuts for per-app data
+* Minor fixes to bash completion
+
+Major changes in 0.4.1
+======================
+* Fixed a parallel build issue
+* Fixed a build issue where openat() didn't get a mode passed
+* Don't block ptrace and perf in debug and build runs
+* Put nvidia drivers in sandbox if DRI allowed
+* Support specifying a version for runtime extensions
+
+Major changes in 0.4.0
+======================
+* A new permissions store was added to the dbus api.
+  This can be used by portal implementations that want to store
+  per-app permissions for objects.
+* The document portal was added. This is a dbus api
+  which you can use to create document ids and assign
+  apps permissions to see these documents. The documents
+  themselves are accessed via a custom fuse filesystem.
+* perf and strace are now blocked via the seccomp filters
+* You can now override application metadata on a system
+  and per-user level, giving apps more or less access
+  than what they request.
+* New command modify-remote added which lets you change
+  configuration of a remote after it has been added with
+  add-remote.
+* Support for adding trusted gpg keys on a per-remote basis
+  has been added to add-remote and modify-remote.
+* The repo-contents command has been renamed to ls-remote
+  to better match the other commands.
+* The list-remotes command can now show more information
+  about the remotes.
+* The bash completion implementation has been improved.
+
+Major changes in 0.3.6
+======================
+
+* Fix a typo in the socket seccomp rules that made ipv6 not work
+* Export the users fonts (~/.local/share/fonts or ~/.fonts) in the sandbox
+* Fix seccomp rules to work on i386
+* Make exposing xdg user dirs work right
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..0c66d84
--- /dev/null
+++ b/README.md
@@ -0,0 +1,67 @@
+<p align="center">
+  <img src="https://github.com/flatpak/flatpak/blob/master/flatpak.png?raw=true" alt="Flatpak icon"/>
+</p>
+
+Flatpak is a system for building, distributing and running sandboxed
+desktop applications on Linux.
+
+See http://flatpak.org/ for more information.
+
+Read documentation for the flatpak [commandline tools](http://flatpak.github.io/flatpak/flatpak-docs.html) and for the libflatpak [library API](http://flatpak.github.io/flatpak/reference/html/index.html).
+
+# INSTALLATION
+
+Flatpak uses a traditional autoconf-style build mechanism. To build just do
+```
+ ./configure [args]
+ make
+ make install
+```
+
+Most configure arguments are documented in `./configure --help`. However,
+there are some options that are a bit more complicated.
+
+Flatpak relies on a project called
+[Bubblewrap](https://github.com/projectatomic/bubblewrap) for the
+low-level sandboxing.  By default, an in-tree copy of this is built
+(distributed in the tarball or using git submodules in the git
+tree). This will build a helper called flatpak-bwrap. If your system
+has a recent enough version of Bubblewrap already, you can use
+`--with-system-bubblewrap` to use that instead.
+
+Bubblewrap can run in two modes, either using unprivileged user
+namespaces or setuid mode. This requires that the kernel supports this,
+which some distributions disable. For instance, Arch completely
+disables user namespaces, while Debian supports unprivileged user
+namespaces, but only if you turn on the
+`kernel.unprivileged_userns_clone` sysctl.
+
+If unprivileged user namespaces are not available, then Bubblewrap must
+be built as setuid root. This is believed to be safe, as it is
+designed to do this. Any build of Bubblewrap supports both
+unprivileged and setuid mode, you just need to set the setuid bit for
+it to change mode.
+
+However, this does complicate the installation a bit. If you pass
+`--with-priv-mode=setuid` to configure (of Flatpak or Bubblewrap) then
+`make install` will try to set the setuid bit. However that means you
+have to run `make install` as root. Alternatively, you can pass
+`--enable-sudo` to configure and it will call `sudo` when setting the
+setuid bit. Alternatively you can enable setuid completely outside of
+the installation, which is common for example when packaging Bubblewrap
+in a .deb or .rpm.
+
+There are some complications when building Flatpak to a different
+prefix than the system-installed version. First of all, the newly
+built Flatpak will look for system-installed flatpaks in
+`$PREFIX/var/lib/flatpak`, which will not match existing installed
+flatpaks. You can use `--with-system-install-dir=/var/lib/flatpak`
+to make both installations use the same location.
+
+Secondly, Flatpak ships with a root-privileged policykit helper for
+system-installation, called `flatpak-system-helper`. This is dbus
+activated (on the system-bus) and if you install in a non-standard
+location it is likely that this will not be found by dbus and
+policykit. However, if the system installation is synchronized,
+you can often use the system installed helper instead - at least
+if the two versions are close in versions.
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..92ec398
--- /dev/null
@@ -0,0 +1,416 @@
+# Checks the location of the XML Catalog
+# Usage:
+#   JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
+AC_DEFUN([JH_PATH_XML_CATALOG],
+[
+  # check for the presence of the XML catalog
+  AC_ARG_WITH([xml-catalog],
+              AC_HELP_STRING([--with-xml-catalog=CATALOG],
+                             [path to xml catalog to use]),,
+              [with_xml_catalog=/etc/xml/catalog])
+  jh_found_xmlcatalog=true
+  XML_CATALOG_FILE="$with_xml_catalog"
+  AC_SUBST([XML_CATALOG_FILE])
+  AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
+  if test -f "$XML_CATALOG_FILE"; then
+    AC_MSG_RESULT([found])
+  else
+    jh_found_xmlcatalog=false
+    AC_MSG_RESULT([not found])
+  fi
+
+  # check for the xmlcatalog program
+  AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
+  if test "x$XMLCATALOG" = xno; then
+    jh_found_xmlcatalog=false
+  fi
+
+  if $jh_found_xmlcatalog; then
+    ifelse([$1],,[:],[$1])
+  else
+    ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
+  fi
+])
+
+# Checks if a particular URI appears in the XML catalog
+# Usage:
+#   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([JH_CHECK_XML_CATALOG],
+[
+  AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
+  AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
+  if $jh_found_xmlcatalog && \
+     AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
+    AC_MSG_RESULT([found])
+    ifelse([$3],,,[$3
+])dnl
+  else
+    AC_MSG_RESULT([not found])
+    ifelse([$4],,
+       [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
+       [$4])
+  fi
+])
+
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_VALGRIND_CHECK()
+#
+# DESCRIPTION
+#
+#   Checks whether Valgrind is present and, if so, allows running `make
+#   check` under a variety of Valgrind tools to check for memory and
+#   threading errors.
+#
+#   Defines VALGRIND_CHECK_RULES which should be substituted in your
+#   Makefile; and $enable_valgrind which can be used in subsequent configure
+#   output. VALGRIND_ENABLED is defined and substituted, and corresponds to
+#   the value of the --enable-valgrind option, which defaults to being
+#   enabled if Valgrind is installed and disabled otherwise.
+#
+#   If unit tests are written using a shell script and automake's
+#   LOG_COMPILER system, the $(VALGRIND) variable can be used within the
+#   shell scripts to enable Valgrind, as described here:
+#
+#     https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html
+#
+#   Usage example:
+#
+#   configure.ac:
+#
+#     AX_VALGRIND_CHECK
+#
+#   Makefile.am:
+#
+#     @VALGRIND_CHECK_RULES@
+#     VALGRIND_SUPPRESSIONS_FILES = my-project.supp
+#     EXTRA_DIST = my-project.supp
+#
+#   This results in a "check-valgrind" rule being added to any Makefile.am
+#   which includes "@VALGRIND_CHECK_RULES@" (assuming the module has been
+#   configured with --enable-valgrind). Running `make check-valgrind` in
+#   that directory will run the module's test suite (`make check`) once for
+#   each of the available Valgrind tools (out of memcheck, helgrind, drd and
+#   sgcheck), and will output results to test-suite-$toolname.log for each.
+#   The target will succeed if there are zero errors and fail otherwise.
+#
+#   The macro supports running with and without libtool.
+#
+# LICENSE
+#
+#   Copyright (c) 2014, 2015 Philip Withnall <philip.withnall@collabora.co.uk>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 4
+
+AC_DEFUN([AX_VALGRIND_CHECK],[
+       dnl Check for --enable-valgrind
+       AC_MSG_CHECKING([whether to enable Valgrind on the unit tests])
+       AC_ARG_ENABLE([valgrind],
+                     [AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])],
+                     [enable_valgrind=$enableval],[enable_valgrind=])
+
+       # Check for Valgrind.
+       AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind])
+
+       AS_IF([test "$enable_valgrind" = "yes" -a "$VALGRIND" = ""],[
+               AC_MSG_ERROR([Could not find valgrind; either install it or reconfigure with --disable-valgrind])
+       ])
+       AS_IF([test "$enable_valgrind" != "no"],[enable_valgrind=yes])
+
+       AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
+       AC_SUBST([VALGRIND_ENABLED],[$enable_valgrind])
+       AC_MSG_RESULT([$enable_valgrind])
+
+       # Check for Valgrind tools we care about.
+        #m4_define([valgrind_tool_list],[[memcheck], [helgrind], [drd], [exp-sgcheck]])
+        # I trimmed this, because we fail on all the thread stuff
+        m4_define([valgrind_tool_list],[[memcheck]])
+
+       AS_IF([test "$VALGRIND" != ""],[
+               m4_foreach([vgtool],[valgrind_tool_list],[
+                       m4_define([vgtooln],AS_TR_SH(vgtool))
+                       m4_define([ax_cv_var],[ax_cv_valgrind_tool_]vgtooln)
+                       AC_CACHE_CHECK([for Valgrind tool ]vgtool,ax_cv_var,[
+                               ax_cv_var=
+                               AS_IF([`$VALGRIND --tool=vgtool --help >/dev/null 2>&1`],[
+                                       ax_cv_var="vgtool"
+                               ])
+                       ])
+
+                       AC_SUBST([VALGRIND_HAVE_TOOL_]vgtooln,[$ax_cv_var])
+               ])
+       ])
+
+VALGRIND_CHECK_RULES='
+# Valgrind check
+#
+# Optional:
+#  - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions
+#    files to load. (Default: empty)
+#  - VALGRIND_FLAGS: General flags to pass to all Valgrind tools.
+#    (Default: --num-callers=30)
+#  - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of:
+#    memcheck, helgrind, drd, sgcheck). (Default: various)
+
+# Optional variables
+VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES))
+VALGRIND_FLAGS ?= --num-callers=30
+VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no
+VALGRIND_helgrind_FLAGS ?= --history-level=approx
+VALGRIND_drd_FLAGS ?=
+VALGRIND_sgcheck_FLAGS ?=
+
+# Internal use
+valgrind_tools = memcheck helgrind drd sgcheck
+valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools)))
+
+valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS)
+valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS)
+valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS)
+valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS)
+
+valgrind_quiet = $(valgrind_quiet_$(V))
+valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY))
+valgrind_quiet_0 = --quiet
+
+# Support running with and without libtool.
+ifneq ($(LIBTOOL),)
+valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute
+else
+valgrind_lt =
+endif
+
+# Use recursive makes in order to ignore errors during check
+check-valgrind:
+ifeq ($(VALGRIND_ENABLED),yes)
+       -$(foreach tool,$(valgrind_tools), \
+               $(if $(VALGRIND_HAVE_TOOL_$(tool))$(VALGRIND_HAVE_TOOL_exp_$(tool)), \
+                       $(MAKE) $(AM_MAKEFLAGS) -k check-valgrind-tool VALGRIND_TOOL=$(tool); \
+               ) \
+       )
+else
+       @echo "Need to reconfigure with --enable-valgrind"
+endif
+
+# Valgrind running
+VALGRIND_TESTS_ENVIRONMENT = \
+       $(TESTS_ENVIRONMENT) \
+       env VALGRIND=$(VALGRIND) \
+       G_SLICE=always-malloc,debug-blocks \
+       G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly
+
+VALGRIND_LOG_COMPILER = \
+       $(valgrind_lt) \
+       $(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
+
+check-valgrind-tool:
+ifeq ($(VALGRIND_ENABLED),yes)
+       $(MAKE) check-TESTS \
+               TESTS_ENVIRONMENT="$(VALGRIND_TESTS_ENVIRONMENT)" \
+               LOG_COMPILER="$(VALGRIND_LOG_COMPILER)" \
+               LOG_FLAGS="$(valgrind_$(VALGRIND_TOOL)_flags)" \
+               TEST_SUITE_LOG=test-suite-$(VALGRIND_TOOL).log
+else
+       @echo "Need to reconfigure with --enable-valgrind"
+endif
+
+DISTCHECK_CONFIGURE_FLAGS ?=
+DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind
+
+MOSTLYCLEANFILES ?=
+MOSTLYCLEANFILES += $(valgrind_log_files)
+
+.PHONY: check-valgrind check-valgrind-tool
+'
+
+       AC_SUBST([VALGRIND_CHECK_RULES])
+       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
+])
+
+# ===========================================================================
+#    http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   This macro compares two version strings. Due to the various number of
+#   minor-version numbers that can exist, and the fact that string
+#   comparisons are not compatible with numeric comparisons, this is not
+#   necessarily trivial to do in a autoconf script. This macro makes doing
+#   these comparisons easy.
+#
+#   The six basic comparisons are available, as well as checking equality
+#   limited to a certain number of minor-version levels.
+#
+#   The operator OP determines what type of comparison to do, and can be one
+#   of:
+#
+#    eq  - equal (test A == B)
+#    ne  - not equal (test A != B)
+#    le  - less than or equal (test A <= B)
+#    ge  - greater than or equal (test A >= B)
+#    lt  - less than (test A < B)
+#    gt  - greater than (test A > B)
+#
+#   Additionally, the eq and ne operator can have a number after it to limit
+#   the test to that number of minor versions.
+#
+#    eq0 - equal up to the length of the shorter version
+#    ne0 - not equal up to the length of the shorter version
+#    eqN - equal up to N sub-version levels
+#    neN - not equal up to N sub-version levels
+#
+#   When the condition is true, shell commands ACTION-IF-TRUE are run,
+#   otherwise shell commands ACTION-IF-FALSE are run. The environment
+#   variable 'ax_compare_version' is always set to either 'true' or 'false'
+#   as well.
+#
+#   Examples:
+#
+#     AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+#   would both be true.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+#   would both be false.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+#   would be true because it is only comparing two minor versions.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+#   would be true because it is only comparing the lesser number of minor
+#   versions of the two values.
+#
+#   Note: The characters that separate the version numbers do not matter. An
+#   empty string is the same as version 0. OP is evaluated by autoconf, not
+#   configure, so must be a string, not a variable.
+#
+#   The author would like to acknowledge Guido Draheim whose advice about
+#   the m4_case and m4_ifvaln functions make this macro only include the
+#   portions necessary to perform the specific comparison specified by the
+#   OP argument in the final configure script.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 11
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+  AC_REQUIRE([AC_PROG_AWK])
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+  AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+  A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+  B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+  dnl # then the first line is used to determine if the condition is true.
+  dnl # The sed right after the echo is to remove any indented white space.
+  m4_case(m4_tolower($2),
+  [lt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [gt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [le],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],
+  [ge],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],[
+    dnl Split the operator from the subversion count if present.
+    m4_bmatch(m4_substr($2,2),
+    [0],[
+      # A count of zero means use the length of the shorter version.
+      # Determine the number of characters in A and B.
+      ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+      ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+      # Set A to no more than B's length and B to no more than A's length.
+      A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+    ],
+    [[0-9]+],[
+      # A count greater than zero means use only that many subversions
+      A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+    ],
+    [.+],[
+      AC_WARNING(
+        [illegal OP numeric parameter: $2])
+    ],[])
+
+    # Pad zeros at end of numbers to make same length.
+    ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+    B="$B`echo $A | sed 's/./0/g'`"
+    A="$ax_compare_version_tmp_A"
+
+    # Check for equality or inequality as necessary.
+    m4_case(m4_tolower(m4_substr($2,0,2)),
+    [eq],[
+      test "x$A" = "x$B" && ax_compare_version=true
+    ],
+    [ne],[
+      test "x$A" != "x$B" && ax_compare_version=true
+    ],[
+      AC_WARNING([illegal OP parameter: $2])
+    ])
+  ])
+
+  AS_VAR_POPDEF([A])dnl
+  AS_VAR_POPDEF([B])dnl
+
+  dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+  if test "$ax_compare_version" = "true" ; then
+    m4_ifvaln([$4],[$4],[:])dnl
+    m4_ifvaln([$5],[else $5])dnl
+  fi
+]) dnl AX_COMPARE_VERSION
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..e514c67
--- /dev/null
@@ -0,0 +1,1932 @@
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# gpgme.m4 - autoconf macro to detect GPGME.
+# Copyright (C) 2002, 2003, 2004, 2014 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Last-changed: 2014-10-02
+
+
+AC_DEFUN([_AM_PATH_GPGME_CONFIG],
+[ AC_ARG_WITH(gpgme-prefix,
+            AC_HELP_STRING([--with-gpgme-prefix=PFX],
+                           [prefix where GPGME is installed (optional)]),
+     gpgme_config_prefix="$withval", gpgme_config_prefix="")
+  if test x"${GPGME_CONFIG}" = x ; then
+     if test x"${gpgme_config_prefix}" != x ; then
+        GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config"
+     else
+       case "${SYSROOT}" in
+         /*)
+           if test -x "${SYSROOT}/bin/gpgme-config" ; then
+             GPGME_CONFIG="${SYSROOT}/bin/gpgme-config"
+           fi
+           ;;
+         '')
+           ;;
+          *)
+           AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
+           ;;
+       esac
+     fi
+  fi
+
+  AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
+
+  if test "$GPGME_CONFIG" != "no" ; then
+    gpgme_version=`$GPGME_CONFIG --version`
+  fi
+  gpgme_version_major=`echo $gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+  gpgme_version_minor=`echo $gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+  gpgme_version_micro=`echo $gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+])
+
+
+AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK],
+[
+    gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
+    if test x"$gpgme_config_host" != xnone ; then
+      if test x"$gpgme_config_host" != x"$host" ; then
+  AC_MSG_WARN([[
+***
+*** The config script $GPGME_CONFIG was
+*** built for $gpgme_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-gpgme-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***]])
+        gpg_config_script_warn="$gpg_config_script_warn gpgme"
+      fi
+    fi
+])
+
+
+dnl AM_PATH_GPGME([MINIMUM-VERSION,
+dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS.
+dnl
+dnl If a prefix option is not used, the config script is first
+dnl searched in $SYSROOT/bin and then along $PATH.  If the used
+dnl config script does not match the host specification the script
+dnl is added to the gpg_config_script_warn variable.
+dnl
+AC_DEFUN([AM_PATH_GPGME],
+[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
+  tmp=ifelse([$1], ,1:0.4.2,$1)
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_gpgme_api=0
+     min_gpgme_version="$tmp"
+  fi
+
+  AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
+  ok=no
+  if test "$GPGME_CONFIG" != "no" ; then
+    req_major=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+    req_minor=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+    req_micro=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+    if test "$gpgme_version_major" -gt "$req_major"; then
+        ok=yes
+    else
+        if test "$gpgme_version_major" -eq "$req_major"; then
+            if test "$gpgme_version_minor" -gt "$req_minor"; then
+               ok=yes
+            else
+               if test "$gpgme_version_minor" -eq "$req_minor"; then
+                   if test "$gpgme_version_micro" -ge "$req_micro"; then
+                     ok=yes
+                   fi
+               fi
+            fi
+        fi
+    fi
+  fi
+  if test $ok = yes; then
+     # If we have a recent GPGME, we should also check that the
+     # API is compatible.
+     if test "$req_gpgme_api" -gt 0 ; then
+        tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        if test "$tmp" -gt 0 ; then
+           if test "$req_gpgme_api" -ne "$tmp" ; then
+             ok=no
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
+    GPGME_LIBS=`$GPGME_CONFIG --libs`
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , :, [$2])
+    _AM_PATH_GPGME_CONFIG_HOST_CHECK
+  else
+    GPGME_CFLAGS=""
+    GPGME_LIBS=""
+    AC_MSG_RESULT(no)
+    ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GPGME_CFLAGS)
+  AC_SUBST(GPGME_LIBS)
+])
+
+dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
+dnl                       [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
+dnl  and GPGME_PTHREAD_LIBS.
+dnl
+AC_DEFUN([AM_PATH_GPGME_PTHREAD],
+[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
+  tmp=ifelse([$1], ,1:0.4.2,$1)
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_gpgme_api=0
+     min_gpgme_version="$tmp"
+  fi
+
+  AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
+  ok=no
+  if test "$GPGME_CONFIG" != "no" ; then
+    if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
+      req_major=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+      req_minor=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+      req_micro=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+      if test "$gpgme_version_major" -gt "$req_major"; then
+        ok=yes
+      else
+        if test "$gpgme_version_major" -eq "$req_major"; then
+          if test "$gpgme_version_minor" -gt "$req_minor"; then
+            ok=yes
+          else
+            if test "$gpgme_version_minor" -eq "$req_minor"; then
+              if test "$gpgme_version_micro" -ge "$req_micro"; then
+                ok=yes
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+  if test $ok = yes; then
+     # If we have a recent GPGME, we should also check that the
+     # API is compatible.
+     if test "$req_gpgme_api" -gt 0 ; then
+        tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        if test "$tmp" -gt 0 ; then
+           if test "$req_gpgme_api" -ne "$tmp" ; then
+             ok=no
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
+    GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , :, [$2])
+    _AM_PATH_GPGME_CONFIG_HOST_CHECK
+  else
+    GPGME_PTHREAD_CFLAGS=""
+    GPGME_PTHREAD_LIBS=""
+    AC_MSG_RESULT(no)
+    ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GPGME_PTHREAD_CFLAGS)
+  AC_SUBST(GPGME_PTHREAD_LIBS)
+])
+
+
+dnl AM_PATH_GPGME_GLIB([MINIMUM-VERSION,
+dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for libgpgme-glib and define GPGME_GLIB_CFLAGS and GPGME_GLIB_LIBS.
+dnl
+AC_DEFUN([AM_PATH_GPGME_GLIB],
+[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
+  tmp=ifelse([$1], ,1:0.4.2,$1)
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_gpgme_api=0
+     min_gpgme_version="$tmp"
+  fi
+
+  AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
+  ok=no
+  if test "$GPGME_CONFIG" != "no" ; then
+    req_major=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+    req_minor=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+    req_micro=`echo $min_gpgme_version | \
+               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+    if test "$gpgme_version_major" -gt "$req_major"; then
+        ok=yes
+    else
+        if test "$gpgme_version_major" -eq "$req_major"; then
+            if test "$gpgme_version_minor" -gt "$req_minor"; then
+               ok=yes
+            else
+               if test "$gpgme_version_minor" -eq "$req_minor"; then
+                   if test "$gpgme_version_micro" -ge "$req_micro"; then
+                     ok=yes
+                   fi
+               fi
+            fi
+        fi
+    fi
+  fi
+  if test $ok = yes; then
+     # If we have a recent GPGME, we should also check that the
+     # API is compatible.
+     if test "$req_gpgme_api" -gt 0 ; then
+        tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        if test "$tmp" -gt 0 ; then
+           if test "$req_gpgme_api" -ne "$tmp" ; then
+             ok=no
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
+    GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , :, [$2])
+    _AM_PATH_GPGME_CONFIG_HOST_CHECK
+  else
+    GPGME_GLIB_CFLAGS=""
+    GPGME_GLIB_LIBS=""
+    AC_MSG_RESULT(no)
+    ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GPGME_GLIB_CFLAGS)
+  AC_SUBST(GPGME_GLIB_LIBS)
+])
+
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
+dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_default([$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes ],
+                    [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
+
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+       AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+       m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+       AC_MSG_RESULT([no])
+       m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       $3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
+
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+           [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+            [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+    [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+            [auto],[PKG_CHECK_MODULES([$1],[$2],
+                                        [m4_n([def_action_if_found]) $3],
+                                        [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl   [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+       dnl Canonicalize enable_introspection
+       enable_introspection=$found_introspection
+    ],dnl
+    [dnl       
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
+
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.15'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.15], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.15])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Older Autoconf quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named 'Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running 'make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "$am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+             [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                 [_AM_DEPENDENCIES([CC])],
+                 [m4_define([AC_PROG_CC],
+                            m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                 [_AM_DEPENDENCIES([CXX])],
+                 [m4_define([AC_PROG_CXX],
+                            m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                 [_AM_DEPENDENCIES([OBJC])],
+                 [m4_define([AC_PROG_OBJC],
+                            m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+                 [_AM_DEPENDENCIES([OBJCXX])],
+                 [m4_define([AC_PROG_OBJCXX],
+                            m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+  fi
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+      am_maintainer_other[ make rules and dependencies not useful
+      (and sometimes confusing) to the casual installer])],
+    [USE_MAINTAINER_MODE=$enableval],
+    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST([MAINT])dnl
+]
+)
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
+else
+  am_missing_run=
+  AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \   ]]*)
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+       # -L didn't work.
+       set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+       && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+       # If neither matched, then we have a broken ls.  This can happen
+       # if, for instance, CONFIG_SHELL is bash and it inherits a
+       # broken ls alias from the environment.  This has actually
+       # happened.  Such a system could not be considered "sane".
+       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
+
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
+  rm -rf conftest.dir
+
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([libglnx/libglnx.m4])
+m4_include([m4/attributes.m4])
+m4_include([m4/gettext.m4])
+m4_include([m4/glibtests.m4])
+m4_include([m4/gtk-doc.m4])
+m4_include([m4/iconv.m4])
+m4_include([m4/intlmacosx.m4])
+m4_include([m4/lib-ld.m4])
+m4_include([m4/lib-link.m4])
+m4_include([m4/lib-prefix.m4])
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
+m4_include([m4/nls.m4])
+m4_include([m4/po.m4])
+m4_include([m4/progtest.m4])
+m4_include([acinclude.m4])
diff --git a/app/Makefile.am.inc b/app/Makefile.am.inc
new file mode 100644 (file)
index 0000000..02d23f0
--- /dev/null
@@ -0,0 +1,47 @@
+bin_PROGRAMS += \
+       flatpak \
+       $(NULL)
+
+flatpak_SOURCES = \
+       app/flatpak-main.c \
+       app/flatpak-builtins.h \
+       app/flatpak-builtins-utils.h \
+       app/flatpak-builtins-utils.c \
+       app/flatpak-transaction.h \
+       app/flatpak-transaction.c \
+       app/flatpak-builtins-add-remote.c \
+       app/flatpak-builtins-delete-remote.c \
+       app/flatpak-builtins-list-remotes.c \
+       app/flatpak-builtins-ls-remote.c \
+       app/flatpak-builtins-info-remote.c \
+       app/flatpak-builtins-install.c \
+       app/flatpak-builtins-override.c \
+       app/flatpak-builtins-make-current.c \
+       app/flatpak-builtins-update.c \
+       app/flatpak-builtins-uninstall.c \
+       app/flatpak-builtins-list.c \
+       app/flatpak-builtins-info.c \
+       app/flatpak-builtins-config.c \
+       app/flatpak-builtins-run.c \
+       app/flatpak-builtins-enter.c \
+       app/flatpak-builtins-build-init.c \
+       app/flatpak-builtins-build.c \
+       app/flatpak-builtins-build-finish.c \
+       app/flatpak-builtins-build-export.c \
+       app/flatpak-builtins-build-bundle.c \
+       app/flatpak-builtins-build-import-bundle.c \
+       app/flatpak-builtins-build-commit-from.c \
+       app/flatpak-builtins-build-sign.c \
+       app/flatpak-builtins-repo-update.c \
+       app/flatpak-builtins-repo.c \
+       app/flatpak-builtins-document-export.c \
+       app/flatpak-builtins-document-unexport.c \
+       app/flatpak-builtins-document-info.c \
+       app/flatpak-builtins-document-list.c \
+       app/flatpak-builtins-search.c \
+       $(NULL)
+
+flatpak_LDADD = $(AM_LDADD) $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(APPSTREAM_GLIB_LIBS) \
+       libglnx.la libflatpak-common.la
+flatpak_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(APPSTREAM_GLIB_CFLAGS) \
+        -DLOCALEDIR=\"$(localedir)\"
diff --git a/app/flatpak-builtins-add-remote.c b/app/flatpak-builtins-add-remote.c
new file mode 100644 (file)
index 0000000..4d845bb
--- /dev/null
@@ -0,0 +1,550 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+
+static gboolean opt_no_gpg_verify;
+static gboolean opt_do_gpg_verify;
+static gboolean opt_do_enumerate;
+static gboolean opt_no_enumerate;
+static gboolean opt_do_deps;
+static gboolean opt_no_deps;
+static gboolean opt_if_not_exists;
+static gboolean opt_enable;
+static gboolean opt_oci;
+static gboolean opt_update_metadata;
+static gboolean opt_disable;
+static int opt_prio = -1;
+static char *opt_title;
+static char *opt_default_branch;
+static char *opt_url;
+static char *opt_collection_id = NULL;
+static gboolean opt_from;
+static char **opt_gpg_import;
+
+
+static GOptionEntry add_options[] = {
+  { "if-not-exists", 0, 0, G_OPTION_ARG_NONE, &opt_if_not_exists, N_("Do nothing if the provided remote exists"), NULL },
+  { "from", 0, 0, G_OPTION_ARG_NONE, &opt_from, N_("LOCATION specifies a configuration file, not the repo location"), NULL },
+  { NULL }
+};
+
+static GOptionEntry modify_options[] = {
+  { "gpg-verify", 0, 0, G_OPTION_ARG_NONE, &opt_do_gpg_verify, N_("Enable GPG verification"), NULL },
+  { "enumerate", 0, 0, G_OPTION_ARG_NONE, &opt_do_enumerate, N_("Mark the remote as enumerate"), NULL },
+  { "use-for-deps", 0, 0, G_OPTION_ARG_NONE, &opt_do_deps, N_("Mark the remote as used for dependencies"), NULL },
+  { "url", 0, 0, G_OPTION_ARG_STRING, &opt_url, N_("Set a new url"), N_("URL") },
+  { "enable", 0, 0, G_OPTION_ARG_NONE, &opt_enable, N_("Enable the remote"), NULL },
+  { "update-metadata", 0, 0, G_OPTION_ARG_NONE, &opt_update_metadata, N_("Update extra metadata from the summary file"), NULL },
+  { NULL }
+};
+
+static GOptionEntry common_options[] = {
+  { "no-gpg-verify", 0, 0, G_OPTION_ARG_NONE, &opt_no_gpg_verify, N_("Disable GPG verification"), NULL },
+  { "no-enumerate", 0, 0, G_OPTION_ARG_NONE, &opt_no_enumerate, N_("Mark the remote as don't enumerate"), NULL },
+  { "no-use-for-deps", 0, 0, G_OPTION_ARG_NONE, &opt_no_deps, N_("Mark the remote as don't use for deps"), NULL },
+  { "prio", 0, 0, G_OPTION_ARG_INT, &opt_prio, N_("Set priority (default 1, higher is more prioritized)"), N_("PRIORITY") },
+  { "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, N_("A nice name to use for this remote"), N_("TITLE") },
+  { "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, N_("Default branch to use for this remote"), N_("BRANCH") },
+#ifdef FLATPAK_ENABLE_P2P
+  { "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), N_("COLLECTION-ID") },
+#endif  /* FLATPAK_ENABLE_P2P */
+  { "gpg-import", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_import, N_("Import GPG key from FILE (- for stdin)"), N_("FILE") },
+  { "disable", 0, 0, G_OPTION_ARG_NONE, &opt_disable, N_("Disable the remote"), NULL },
+  { "oci", 0, 0, G_OPTION_ARG_NONE, &opt_oci, N_("Add OCI registry"), NULL },
+  { NULL }
+};
+
+
+static GKeyFile *
+get_config_from_opts (FlatpakDir *dir, const char *remote_name, gboolean *changed)
+{
+  OstreeRepo *repo;
+  GKeyFile *config;
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote_name);
+
+  repo = flatpak_dir_get_repo (dir);
+  if (repo == NULL)
+    config = g_key_file_new ();
+  else
+    config = ostree_repo_copy_config (repo);
+
+  if (opt_no_gpg_verify)
+    {
+      g_key_file_set_boolean (config, group, "gpg-verify", FALSE);
+      g_key_file_set_boolean (config, group, "gpg-verify-summary", FALSE);
+      *changed = TRUE;
+    }
+
+  if (opt_do_gpg_verify)
+    {
+      g_key_file_set_boolean (config, group, "gpg-verify", TRUE);
+      g_key_file_set_boolean (config, group, "gpg-verify-summary", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_url)
+    {
+      if (g_str_has_prefix (opt_url, "metalink="))
+        g_key_file_set_string (config, group, "metalink", opt_url + strlen ("metalink="));
+      else
+        g_key_file_set_string (config, group, "url", opt_url);
+      *changed = TRUE;
+    }
+
+  if (opt_collection_id)
+    {
+      g_key_file_set_string (config, group, "collection-id", opt_collection_id);
+      g_key_file_set_boolean (config, group, "gpg-verify-summary", FALSE);
+      *changed = TRUE;
+    }
+
+  if (opt_title)
+    {
+      g_key_file_set_string (config, group, "xa.title", opt_title);
+      g_key_file_set_boolean (config, group, "xa.title-is-set", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_default_branch)
+    {
+      g_key_file_set_string (config, group, "xa.default-branch", opt_default_branch);
+      g_key_file_set_boolean (config, group, "xa.default-branch-is-set", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_no_enumerate)
+    {
+      g_key_file_set_boolean (config, group, "xa.noenumerate", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_do_enumerate)
+    {
+      g_key_file_set_boolean (config, group, "xa.noenumerate", FALSE);
+      *changed = TRUE;
+    }
+
+  if (opt_no_deps)
+    {
+      g_key_file_set_boolean (config, group, "xa.nodeps", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_do_deps)
+    {
+      g_key_file_set_boolean (config, group, "xa.nodeps", FALSE);
+      *changed = TRUE;
+    }
+
+  if (opt_disable)
+    {
+      g_key_file_set_boolean (config, group, "xa.disable", TRUE);
+      *changed = TRUE;
+    }
+  else if (opt_enable)
+    {
+      g_key_file_set_boolean (config, group, "xa.disable", FALSE);
+      *changed = TRUE;
+    }
+
+  if (opt_oci)
+    {
+      g_key_file_set_boolean (config, group, "xa.oci", TRUE);
+      *changed = TRUE;
+    }
+
+  if (opt_prio != -1)
+    {
+      g_autofree char *prio_as_string = g_strdup_printf ("%d", opt_prio);
+      g_key_file_set_string (config, group, "xa.prio", prio_as_string);
+      *changed = TRUE;
+    }
+
+  return config;
+}
+
+static void
+load_options (const char *filename,
+              GBytes **gpg_data)
+{
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+  char *str;
+  gboolean nodeps;
+  g_autoptr(GBytes) bytes = NULL;
+  g_autofree char *version = NULL;
+
+  if (g_str_has_prefix (filename, "http:") ||
+      g_str_has_prefix (filename, "https:"))
+    {
+      const char *options_data;
+      gsize options_size;
+
+      bytes = download_uri (filename, &error);
+
+      if (bytes == NULL)
+        {
+          g_printerr (_("Can't load uri %s: %s\n"), filename, error->message);
+          exit (1);
+        }
+
+      options_data = g_bytes_get_data (bytes, &options_size);
+      if (!g_key_file_load_from_data (keyfile, options_data, options_size, 0, &error))
+        {
+          g_printerr (_("Can't load uri %s: %s\n"), filename, error->message);
+          exit (1);
+        }
+    }
+  else
+    {
+      if (!g_key_file_load_from_file (keyfile, filename, 0, &error))
+        {
+          g_printerr (_("Can't load file %s: %s\n"), filename, error->message);
+          exit (1);
+        }
+    }
+
+
+  if (!g_key_file_has_group (keyfile, FLATPAK_REPO_GROUP))
+    {
+      g_printerr (_("Invalid file format"));
+      exit (1);
+    }
+
+  version = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP,
+                                   FLATPAK_REPO_VERSION_KEY, NULL);
+  if (version != NULL && strcmp (version, "1") != 0)
+    {
+      g_printerr (_("Invalid version %s, only 1 supported"), version);
+      exit (1);
+    }
+
+  str = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP,
+                               FLATPAK_REPO_URL_KEY, NULL);
+  if (str != NULL)
+    opt_url = str;
+
+#ifdef FLATPAK_ENABLE_P2P
+  str = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, FLATPAK_REPO_COLLECTION_ID_KEY, NULL);
+  if (str != NULL)
+    opt_collection_id = str;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  str = g_key_file_get_locale_string (keyfile, FLATPAK_REPO_GROUP,
+                                      FLATPAK_REPO_TITLE_KEY, NULL, NULL);
+  if (str != NULL)
+    opt_title = str;
+
+  str = g_key_file_get_locale_string (keyfile, FLATPAK_REPO_GROUP,
+                                      FLATPAK_REPO_DEFAULT_BRANCH_KEY, NULL, NULL);
+  if (str != NULL)
+    opt_default_branch = str;
+
+  nodeps = g_key_file_get_boolean (keyfile, FLATPAK_REPO_GROUP,
+                                   FLATPAK_REPO_NODEPS_KEY, NULL);
+  if (nodeps)
+    {
+      opt_no_deps = TRUE;
+      opt_do_deps = FALSE;
+    }
+
+  str = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP,
+                               FLATPAK_REPO_GPGKEY_KEY, NULL);
+  if (str != NULL)
+    {
+      guchar *decoded;
+      gsize decoded_len;
+
+      str = g_strstrip (str);
+      decoded = g_base64_decode (str, &decoded_len);
+      if (decoded_len < 10) /* Check some minimal size so we don't get crap */
+        {
+          g_printerr (_("Invalid gpg key"));
+          exit (1);
+        }
+
+      *gpg_data = g_bytes_new_take (decoded, decoded_len);
+      if (!opt_no_gpg_verify)
+        opt_do_gpg_verify = TRUE;
+    }
+}
+
+gboolean
+flatpak_builtin_add_remote (int argc, char **argv,
+                            GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  g_autoptr(GFile) file = NULL;
+  g_auto(GStrv) remotes = NULL;
+  g_autofree char *remote_url = NULL;
+  const char *remote_name;
+  const char *location = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  g_autoptr(GBytes) gpg_data = NULL;
+  gboolean changed = FALSE;
+  g_autoptr(GError) local_error = NULL;
+
+  context = g_option_context_new (_("NAME LOCATION - Add a remote repository"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  g_option_context_add_main_entries (context, common_options, NULL);
+
+  if (!flatpak_option_context_parse (context, add_options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR | FLATPAK_BUILTIN_FLAG_OPTIONAL_REPO,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (argc < 2)
+    return usage_error (context, _("NAME must be specified"), error);
+
+  if (argc < 3)
+    return usage_error (context, _("LOCATION must be specified"), error);
+
+  if (argc > 3)
+    return usage_error (context, _("Too many arguments"), error);
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (opt_collection_id != NULL &&
+      !ostree_validate_collection_id (opt_collection_id, &local_error))
+    return flatpak_fail (error, _("‘%s’ is not a valid collection ID: %s"), opt_collection_id, local_error->message);
+
+  if (opt_collection_id != NULL &&
+      (opt_no_gpg_verify || opt_gpg_import == NULL || opt_gpg_import[0] == NULL))
+    return flatpak_fail (error, _("GPG verification is required if collections are enabled"));
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  remote_name = argv[1];
+  location = argv[2];
+
+  remotes = flatpak_dir_list_remotes (dir, cancellable, error);
+  if (remotes == NULL)
+    return FALSE;
+
+  if (g_strv_contains ((const char **)remotes, remote_name))
+    {
+      if (opt_if_not_exists)
+        return TRUE; /* Do nothing */
+
+      return flatpak_fail (error, _("Remote %s already exists"), remote_name);
+    }
+
+  if (opt_from ||
+      flatpak_file_arg_has_suffix (location, ".flatpakrepo"))
+    {
+      load_options (location, &gpg_data);
+      if (opt_url == NULL)
+        return flatpak_fail (error, _("No url specified in flatpakrepo file"));
+    }
+  else
+    {
+      file = g_file_new_for_commandline_arg (location);
+      if (g_file_is_native (file))
+        remote_url = g_file_get_uri (file);
+      else
+        remote_url = g_strdup (location);
+      opt_url = remote_url;
+    }
+
+  if (opt_oci && g_getenv ("FLATPAK_ENABLE_EXPERIMENTAL_OCI") == NULL)
+    return flatpak_fail (error, "flatpak remote-add --oci is currently unsupported and experimental, enable it by setting the FLATPAK_ENABLE_EXPERIMENTAL_OCI env var");
+
+  /* Default to gpg verify, except for --oci */
+  if (!opt_no_gpg_verify && !opt_oci)
+    opt_do_gpg_verify = TRUE;
+
+  config = get_config_from_opts (dir, remote_name, &changed);
+
+  if (opt_gpg_import != NULL)
+    {
+      gpg_data = flatpak_load_gpg_keys (opt_gpg_import, cancellable, error);
+      if (gpg_data == NULL)
+        return FALSE;
+    }
+
+  if (!flatpak_dir_modify_remote (dir, remote_name, config, gpg_data, cancellable, error))
+    return FALSE;
+
+  /* Reload previously changed configuration */
+  if (!flatpak_dir_recreate_repo (dir, cancellable, error))
+    return FALSE;
+
+  /* We can't retrieve the extra metadata until the remote has been added locally, since
+     ostree_repo_remote_fetch_summary() works with the repository's name, not its URL.
+     Don't propagate IO failed errors here because we might just be offline - the
+     remote should already be usable. */
+  if (!flatpak_dir_update_remote_configuration (dir, remote_name, cancellable, &local_error))
+    {
+      if (local_error->domain == G_RESOLVER_ERROR ||
+          g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_FAILED))
+        {
+          g_printerr (_("Warning: Could not update extra metadata for '%s': %s\n"), remote_name, local_error->message);
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_add_remote (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+  g_option_context_add_main_entries (context, common_options, NULL);
+  if (!flatpak_option_context_parse (context, add_options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1:
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, common_options);
+      flatpak_complete_options (completion, add_options);
+      flatpak_complete_options (completion, user_entries);
+
+      break;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(FlatpakDir) preferred_dir = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  g_autoptr(GBytes) gpg_data = NULL;
+  const char *remote_name;
+  gboolean changed = FALSE;
+
+  context = g_option_context_new (_("NAME - Modify a remote repository"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  g_option_context_add_main_entries (context, common_options, NULL);
+
+  if (!flatpak_option_context_parse (context, modify_options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("Remote NAME must be specified"), error);
+
+  remote_name = argv[1];
+
+  if (!flatpak_resolve_duplicate_remotes (dirs, remote_name, &preferred_dir, cancellable, error))
+    return FALSE;
+
+  if (opt_update_metadata)
+    {
+      g_autoptr(GError) local_error = NULL;
+
+      g_print (_("Updating extra metadata from remote summary for %s\n"), remote_name);
+      if (!flatpak_dir_update_remote_configuration (preferred_dir, remote_name, cancellable, &local_error))
+        {
+          g_printerr (_("Error updating extra metadata for '%s': %s\n"), remote_name, local_error->message);
+          return flatpak_fail (error, _("Could not update extra metadata for %s"), remote_name);
+        }
+
+      /* Reload changed configuration */
+      if (!flatpak_dir_recreate_repo (preferred_dir, cancellable, error))
+        return FALSE;
+    }
+
+  config = get_config_from_opts (preferred_dir, remote_name, &changed);
+
+  if (opt_gpg_import != NULL)
+    {
+      gpg_data = flatpak_load_gpg_keys (opt_gpg_import, cancellable, error);
+      if (gpg_data == NULL)
+        return FALSE;
+      changed = TRUE;
+    }
+
+  if (!changed)
+    return TRUE;
+
+  return flatpak_dir_modify_remote (preferred_dir, remote_name, config, gpg_data, cancellable, error);
+}
+
+gboolean
+flatpak_complete_modify_remote (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+  g_option_context_add_main_entries (context, common_options, NULL);
+  if (!flatpak_option_context_parse (context, modify_options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* REMOTE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, common_options);
+      flatpak_complete_options (completion, modify_options);
+      flatpak_complete_options (completion, user_entries);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          int j;
+          g_auto(GStrv) remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+          if (remotes == NULL)
+            return FALSE;
+          for (j = 0; remotes[j] != NULL; j++)
+            flatpak_complete_word (completion, "%s ", remotes[j]);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-bundle.c b/app/flatpak-builtins-build-bundle.c
new file mode 100644 (file)
index 0000000..43e7987
--- /dev/null
@@ -0,0 +1,538 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <json-glib/json-glib.h>
+
+#include <glib/gi18n.h>
+
+#include <gio/gunixinputstream.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-oci-registry.h"
+#include "flatpak-chain-input-stream.h"
+#include "flatpak-builtins-utils.h"
+
+#include <archive.h>
+#include <archive_entry.h>
+
+static char *opt_arch;
+static char *opt_repo_url;
+static char *opt_runtime_repo;
+static gboolean opt_runtime = FALSE;
+static char **opt_gpg_file;
+static gboolean opt_oci = FALSE;
+static char **opt_gpg_key_ids;
+static char *opt_gpg_homedir;
+
+static GOptionEntry options[] = {
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Export runtime instead of app"), NULL },
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to bundle for"), N_("ARCH") },
+  { "repo-url", 0, 0, G_OPTION_ARG_STRING, &opt_repo_url, N_("Url for repo"), N_("URL") },
+  { "runtime-repo", 0, 0, G_OPTION_ARG_STRING, &opt_runtime_repo, N_("Url for runtime flatpakrepo file"), N_("URL") },
+  { "gpg-keys", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_file, N_("Add GPG key from FILE (- for stdin)"), N_("FILE") },
+  { "oci", 0, 0, G_OPTION_ARG_NONE, &opt_oci, N_("Export oci image instead of flatpak bundle"), NULL },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the OCI image with"), N_("KEY-ID") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+
+  { NULL }
+};
+
+static GBytes *
+read_gpg_data (GCancellable *cancellable,
+               GError      **error)
+{
+  g_autoptr(GInputStream) source_stream = NULL;
+  guint n_keyrings = 0;
+  g_autoptr(GPtrArray) streams = NULL;
+
+  if (opt_gpg_file != NULL)
+    n_keyrings = g_strv_length (opt_gpg_file);
+
+  guint ii;
+
+  streams = g_ptr_array_new_with_free_func (g_object_unref);
+
+  for (ii = 0; ii < n_keyrings; ii++)
+    {
+      GInputStream *input_stream = NULL;
+
+      if (strcmp (opt_gpg_file[ii], "-") == 0)
+        {
+          input_stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
+        }
+      else
+        {
+          g_autoptr(GFile) file = g_file_new_for_commandline_arg (opt_gpg_file[ii]);
+          input_stream = G_INPUT_STREAM (g_file_read (file, cancellable, error));
+
+          if (input_stream == NULL)
+            return NULL;
+        }
+
+      /* Takes ownership. */
+      g_ptr_array_add (streams, input_stream);
+    }
+
+  /* Chain together all the --keyring options as one long stream. */
+  source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
+
+  return flatpak_read_stream (source_stream, FALSE, error);
+}
+
+static gboolean
+build_bundle (OstreeRepo *repo, GFile *file,
+              const char *name, const char *full_branch,
+              GCancellable *cancellable, GError **error)
+{
+  GVariantBuilder metadata_builder;
+  GVariantBuilder param_builder;
+
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_autoptr(GFile) xmls_dir = NULL;
+  g_autoptr(GFile) metadata_file = NULL;
+  g_autoptr(GFile) appstream_file = NULL;
+  g_autofree char *appstream_basename = NULL;
+  g_autoptr(GInputStream) in = NULL;
+  g_autoptr(GInputStream) xml_in = NULL;
+  g_autoptr(GFile) root = NULL;
+  g_autofree char *commit_checksum = NULL;
+  g_autoptr(GBytes) gpg_data = NULL;
+  g_autoptr(GVariant) params = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  const char *collection_id;
+
+  if (!ostree_repo_resolve_rev (repo, full_branch, FALSE, &commit_checksum, error))
+    return FALSE;
+
+  if (!ostree_repo_read_commit (repo, commit_checksum, &root, NULL, NULL, error))
+    return FALSE;
+
+  g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));
+
+  /* We add this first in the metadata, so this will become the file
+   * format header.  The first part is readable to make it easy to
+   * figure out the type. The uint32 is basically a random value, but
+   * it ensures we have both zero and high bits sets, so we don't get
+   * sniffed as text. Also, the last 01 can be used as a version
+   * later.  Furthermore, the use of an uint32 lets use detect
+   * byteorder issues.
+   */
+  g_variant_builder_add (&metadata_builder, "{sv}", "flatpak",
+                         g_variant_new_uint32 (0xe5890001));
+
+  g_variant_builder_add (&metadata_builder, "{sv}", "ref", g_variant_new_string (full_branch));
+
+  metadata_file = g_file_resolve_relative_path (root, "metadata");
+
+  keyfile = g_key_file_new ();
+
+  in = (GInputStream *) g_file_read (metadata_file, cancellable, NULL);
+  if (in != NULL)
+    {
+      g_autoptr(GBytes) bytes = flatpak_read_stream (in, TRUE, error);
+
+      if (bytes == NULL)
+        return FALSE;
+
+      if (!g_key_file_load_from_data (keyfile,
+                                      g_bytes_get_data (bytes, NULL),
+                                      g_bytes_get_size (bytes),
+                                      G_KEY_FILE_NONE, error))
+        return FALSE;
+
+      g_variant_builder_add (&metadata_builder, "{sv}", "metadata",
+                             g_variant_new_string (g_bytes_get_data (bytes, NULL)));
+    }
+
+  xmls_dir = g_file_resolve_relative_path (root, "files/share/app-info/xmls");
+  appstream_basename = g_strconcat (name, ".xml.gz", NULL);
+  appstream_file = g_file_get_child (xmls_dir, appstream_basename);
+
+  xml_in = (GInputStream *) g_file_read (appstream_file, cancellable, NULL);
+  if (xml_in)
+    {
+      g_autoptr(FlatpakXml) appstream_root = NULL;
+      g_autoptr(FlatpakXml) xml_root = flatpak_xml_parse (xml_in, TRUE,
+                                                          cancellable, error);
+      if (xml_root == NULL)
+        return FALSE;
+
+      appstream_root = flatpak_appstream_xml_new ();
+      if (flatpak_appstream_xml_migrate (xml_root, appstream_root,
+                                         full_branch, name, keyfile))
+        {
+          g_autoptr(GBytes) xml_data = flatpak_appstream_xml_root_to_data (appstream_root, error);
+          int i;
+          g_autoptr(GFile) icons_dir =
+            g_file_resolve_relative_path (root,
+                                          "files/share/app-info/icons/flatpak");
+          const char *icon_sizes[] = { "64x64", "128x128" };
+          const char *icon_sizes_key[] = { "icon-64", "icon-128" };
+          g_autofree char *icon_name = g_strconcat (name, ".png", NULL);
+
+          if (xml_data == NULL)
+            return FALSE;
+
+          g_variant_builder_add (&metadata_builder, "{sv}", "appdata",
+                                 g_variant_new_from_bytes (G_VARIANT_TYPE_BYTESTRING,
+                                                           xml_data, TRUE));
+
+          for (i = 0; i < G_N_ELEMENTS (icon_sizes); i++)
+            {
+              g_autoptr(GFile) size_dir = g_file_get_child (icons_dir, icon_sizes[i]);
+              g_autoptr(GFile) icon_file = g_file_get_child (size_dir, icon_name);
+              g_autoptr(GInputStream) png_in = NULL;
+
+              png_in = (GInputStream *) g_file_read (icon_file, cancellable, NULL);
+              if (png_in != NULL)
+                {
+                  g_autoptr(GBytes) png_data = flatpak_read_stream (png_in, FALSE, error);
+                  if (png_data == NULL)
+                    return FALSE;
+
+                  g_variant_builder_add (&metadata_builder, "{sv}", icon_sizes_key[i],
+                                         g_variant_new_from_bytes (G_VARIANT_TYPE_BYTESTRING,
+                                                                   png_data, TRUE));
+                }
+            }
+        }
+
+    }
+
+  if (opt_repo_url)
+    g_variant_builder_add (&metadata_builder, "{sv}", "origin", g_variant_new_string (opt_repo_url));
+
+  if (opt_runtime_repo)
+    g_variant_builder_add (&metadata_builder, "{sv}", "runtime-repo", g_variant_new_string (opt_runtime_repo));
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = ostree_repo_get_collection_id (repo);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+  g_variant_builder_add (&metadata_builder, "{sv}", "collection-id",
+                         g_variant_new_string (collection_id ? collection_id : ""));
+
+  if (opt_gpg_file != NULL)
+    {
+      gpg_data = read_gpg_data (cancellable, error);
+      if (gpg_data == NULL)
+        return FALSE;
+    }
+
+  if (gpg_data)
+    {
+      g_variant_builder_add (&metadata_builder, "{sv}", "gpg-keys",
+                             g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
+                                                        g_bytes_get_data (gpg_data, NULL),
+                                                        g_bytes_get_size (gpg_data),
+                                                        1));
+    }
+
+  g_variant_builder_init (&param_builder, G_VARIANT_TYPE ("a{sv}"));
+  g_variant_builder_add (&param_builder, "{sv}", "min-fallback-size", g_variant_new_uint32 (0));
+  g_variant_builder_add (&param_builder, "{sv}", "compression", g_variant_new_byte ('x'));
+  g_variant_builder_add (&param_builder, "{sv}", "bsdiff-enabled", g_variant_new_boolean (FALSE));
+  g_variant_builder_add (&param_builder, "{sv}", "inline-parts", g_variant_new_boolean (TRUE));
+  g_variant_builder_add (&param_builder, "{sv}", "include-detached", g_variant_new_boolean (TRUE));
+  g_variant_builder_add (&param_builder, "{sv}", "filename", g_variant_new_bytestring (flatpak_file_get_path_cached (file)));
+
+  params = g_variant_ref_sink (g_variant_builder_end (&param_builder));
+  metadata = g_variant_ref_sink (g_variant_builder_end (&metadata_builder));
+
+  if (!ostree_repo_static_delta_generate (repo,
+                                          OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY,
+                                          /* from */ NULL,
+                                          commit_checksum,
+                                          metadata,
+                                          params,
+                                          cancellable,
+                                          error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gchar *
+timestamp_to_iso8601 (guint64 timestamp)
+{
+  GTimeVal stamp;
+
+  stamp.tv_sec = timestamp;
+  stamp.tv_usec = 0;
+
+  return g_time_val_to_iso8601 (&stamp);
+}
+
+static gboolean
+export_commit_to_archive (OstreeRepo *repo,
+                          GFile *root,
+                          guint64 timestamp,
+                          struct archive *a,
+                          GCancellable *cancellable, GError **error)
+{
+  OstreeRepoExportArchiveOptions opts = { 0, };
+
+  opts.timestamp_secs = timestamp;
+
+  if (!ostree_repo_export_tree_to_archive (repo, &opts, (OstreeRepoFile *) root, a,
+                                           cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+build_oci (OstreeRepo *repo, GFile *dir,
+           const char *name, const char *ref,
+           GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(GVariant) commit_data = NULL;
+  g_autoptr(GVariant) commit_metadata = NULL;
+  g_autofree char *commit_checksum = NULL;
+  g_autofree char *dir_uri = NULL;
+  g_autoptr(FlatpakOciRegistry) registry = NULL;
+  g_autoptr(FlatpakOciLayerWriter) layer_writer = NULL;
+  struct archive *archive;
+  g_autofree char *uncompressed_digest = NULL;
+  g_autofree char *timestamp = NULL;
+  g_autoptr(FlatpakOciImage) image = NULL;
+  g_autoptr(FlatpakOciDescriptor) layer_desc = NULL;
+  g_autoptr(FlatpakOciDescriptor) image_desc = NULL;
+  g_autoptr(FlatpakOciDescriptor) manifest_desc = NULL;
+  g_autoptr(FlatpakOciManifest) manifest = NULL;
+  g_autoptr(FlatpakOciIndex) index = NULL;
+  g_autoptr(GFile) metadata_file = NULL;
+  guint64 installed_size = 0;
+  GHashTable *annotations;
+  gsize metadata_size;
+  g_autofree char *metadata_contents = NULL;
+  g_auto(GStrv) ref_parts = NULL;
+
+  if (!ostree_repo_resolve_rev (repo, ref, FALSE, &commit_checksum, error))
+    return FALSE;
+
+  if (!ostree_repo_read_commit (repo, commit_checksum, &root, NULL, NULL, error))
+    return FALSE;
+
+  if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, commit_checksum, &commit_data, error))
+    return FALSE;
+
+  if (!ostree_repo_read_commit_detached_metadata (repo, commit_checksum, &commit_metadata, cancellable, error))
+    return FALSE;
+
+  ref_parts = flatpak_decompose_ref (ref, error);
+  if (ref_parts == NULL)
+    return FALSE;
+
+  dir_uri = g_file_get_uri (dir);
+  registry = flatpak_oci_registry_new (dir_uri, TRUE, -1, cancellable, error);
+  if (registry == NULL)
+    return FALSE;
+
+  layer_writer = flatpak_oci_registry_write_layer (registry, cancellable, error);
+  if (layer_writer == NULL)
+    return FALSE;
+
+  archive = flatpak_oci_layer_writer_get_archive (layer_writer);
+
+  if (!export_commit_to_archive (repo, root, ostree_commit_get_timestamp (commit_data),
+                                 archive, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_oci_layer_writer_close (layer_writer,
+                                       &uncompressed_digest,
+                                       &layer_desc,
+                                       cancellable,
+                                       error))
+    return FALSE;
+
+
+  image = flatpak_oci_image_new ();
+  flatpak_oci_image_set_layer (image, uncompressed_digest);
+  flatpak_oci_image_set_architecture (image, flatpak_arch_to_oci_arch (ref_parts[2]));
+
+  timestamp = timestamp_to_iso8601 (ostree_commit_get_timestamp (commit_data));
+  flatpak_oci_image_set_created (image, timestamp);
+
+  image_desc = flatpak_oci_registry_store_json (registry, FLATPAK_JSON (image), cancellable, error);
+  if (image_desc == NULL)
+    return FALSE;
+
+  manifest = flatpak_oci_manifest_new ();
+  flatpak_oci_manifest_set_config (manifest, image_desc);
+  flatpak_oci_manifest_set_layer (manifest, layer_desc);
+
+  annotations = flatpak_oci_manifest_get_annotations (manifest);
+  flatpak_oci_add_annotations_for_commit (annotations, ref, commit_checksum, commit_data);
+
+  metadata_file = g_file_get_child (root, "metadata");
+  if (g_file_load_contents (metadata_file, cancellable, &metadata_contents, &metadata_size, NULL, NULL) &&
+      g_utf8_validate (metadata_contents, -1, NULL))
+    {
+      g_hash_table_replace (annotations,
+                            g_strdup ("org.flatpak.metadata"),
+                            g_steal_pointer (&metadata_contents));
+    }
+
+  if (!flatpak_repo_collect_sizes (repo, root, &installed_size, NULL, NULL, error))
+    return FALSE;
+
+  g_hash_table_replace (annotations,
+                        g_strdup ("org.flatpak.installed-size"),
+                        g_strdup_printf ("%" G_GUINT64_FORMAT, installed_size));
+
+  g_hash_table_replace (annotations,
+                        g_strdup ("org.flatpak.download-size"),
+                        g_strdup_printf ("%" G_GUINT64_FORMAT, layer_desc->size));
+
+  manifest_desc = flatpak_oci_registry_store_json (registry, FLATPAK_JSON (manifest), cancellable, error);
+  if (manifest_desc == NULL)
+    return FALSE;
+
+  flatpak_oci_export_annotations (manifest->annotations, manifest_desc->annotations);
+
+  index = flatpak_oci_registry_load_index (registry, NULL, NULL, NULL, NULL);
+  if (index == NULL)
+    index = flatpak_oci_index_new ();
+
+  flatpak_oci_index_add_manifest (index, manifest_desc);
+
+  if (!flatpak_oci_registry_save_index (registry, index, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) file = NULL;
+  g_autoptr(GFile) repofile = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  g_autoptr(GError) my_error = NULL;
+  const char *location;
+  const char *filename;
+  const char *name;
+  const char *branch;
+  g_autofree char *full_branch = NULL;
+
+  context = g_option_context_new (_("LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local repository"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 4)
+    return usage_error (context, _("LOCATION, FILENAME and NAME must be specified"), error);
+
+  if (argc > 5)
+    return usage_error (context, _("Too many arguments"), error);
+
+  location = argv[1];
+  filename = argv[2];
+  name = argv[3];
+
+  if (argc >= 5)
+    branch = argv[4];
+  else
+    branch = "master";
+
+  repofile = g_file_new_for_commandline_arg (location);
+  repo = ostree_repo_new (repofile);
+
+  if (!g_file_query_exists (repofile, cancellable))
+    return flatpak_fail (error, _("'%s' is not a valid repository"), location);
+
+  if (!ostree_repo_open (repo, cancellable, error))
+    return FALSE;
+
+  file = g_file_new_for_commandline_arg (filename);
+
+  if (ostree_repo_resolve_rev (repo, name, FALSE, NULL, NULL))
+    full_branch = g_strdup (name);
+  else
+    {
+      if (!flatpak_is_valid_name (name, &my_error))
+        return flatpak_fail (error, _("'%s' is not a valid name: %s"), name, my_error->message);
+
+      if (!flatpak_is_valid_branch (branch, &my_error))
+        return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, my_error->message);
+
+      if (opt_runtime)
+        full_branch = flatpak_build_runtime_ref (name, branch, opt_arch);
+      else
+        full_branch = flatpak_build_app_ref (name, branch, opt_arch);
+    }
+
+  if (opt_oci)
+    {
+      if (!build_oci (repo, file, name, full_branch, cancellable, error))
+        return FALSE;
+    }
+  else
+    {
+      if (!build_bundle (repo, file, name, full_branch, cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_bundle (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* FILENAME */
+      flatpak_complete_file (completion, "__FLATPAK_BUNDLE_FILE");
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-commit-from.c b/app/flatpak-builtins-build-commit-from.c
new file mode 100644 (file)
index 0000000..5259977
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+
+static char *opt_src_repo;
+static char *opt_src_ref;
+static char *opt_subject;
+static char *opt_body;
+static gboolean opt_update_appstream;
+static gboolean opt_no_update_summary;
+static gboolean opt_untrusted;
+static gboolean opt_force;
+static char **opt_gpg_key_ids;
+static char *opt_gpg_homedir;
+
+static GOptionEntry options[] = {
+  { "src-repo", 's', 0, G_OPTION_ARG_STRING, &opt_src_repo, N_("Source repo dir"), N_("SRC-REPO") },
+  { "src-ref", 's', 0, G_OPTION_ARG_STRING, &opt_src_ref, N_("Source repo ref"), N_("SRC-REF") },
+  { "untrusted", 0, 0, G_OPTION_ARG_NONE, &opt_untrusted, "Do not trust SRC-REPO", NULL },
+  { "force", 0, 0, G_OPTION_ARG_NONE, &opt_force, "Always commit, even if same content", NULL },
+  { "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, N_("One line subject"), N_("SUBJECT") },
+  { "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, N_("Full description"), N_("BODY") },
+  { "update-appstream", 0, 0, G_OPTION_ARG_NONE, &opt_update_appstream, N_("Update the appstream branch"), NULL },
+  { "no-update-summary", 0, 0, G_OPTION_ARG_NONE, &opt_no_update_summary, N_("Don't update the summary"), NULL },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the commit with"), N_("KEY-ID") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) dst_repofile = NULL;
+  g_autoptr(OstreeRepo) dst_repo = NULL;
+  g_autoptr(GFile) src_repofile = NULL;
+  g_autoptr(OstreeRepo) src_repo = NULL;
+  g_autofree char *src_repo_uri = NULL;
+  const char *dst_repo_arg;
+  const char **dst_refs;
+  int n_dst_refs = 0;
+  g_autoptr(FlatpakRepoTransaction) transaction = NULL;
+  g_autoptr(GPtrArray) src_refs = NULL;
+  g_autoptr(GPtrArray) resolved_src_refs = NULL;
+  OstreeRepoCommitState src_commit_state;
+  int i;
+
+  context = g_option_context_new (_("DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("DST-REPO must be specified"), error);
+
+  dst_repo_arg = argv[1];
+
+  dst_refs = (const char **)argv + 2;
+  n_dst_refs = argc - 2;
+
+  if (opt_src_repo == NULL && n_dst_refs != 1)
+    return usage_error (context, _("If --src-repo is not specified, exactly one destination ref must be specified"), error);
+
+  if (opt_src_ref != NULL && n_dst_refs != 1)
+    return usage_error (context, _("If --src-ref is specified, exactly one destination ref must be specified"), error);
+
+  if (opt_src_repo == NULL && opt_src_ref == NULL)
+    return flatpak_fail (error, _("Either --src-repo or --src-ref must be specified."));
+
+  dst_repofile = g_file_new_for_commandline_arg (dst_repo_arg);
+  if (!g_file_query_exists (dst_repofile, cancellable))
+    return flatpak_fail (error, _("'%s' is not a valid repository"), dst_repo_arg);
+
+  dst_repo = ostree_repo_new (dst_repofile);
+  if (!ostree_repo_open (dst_repo, cancellable, error))
+    return FALSE;
+
+  if (opt_src_repo)
+    {
+      src_repofile = g_file_new_for_commandline_arg (opt_src_repo);
+      if (!g_file_query_exists (src_repofile, cancellable))
+        return flatpak_fail (error, _("'%s' is not a valid repository"), opt_src_repo);
+
+      src_repo_uri = g_file_get_uri (src_repofile);
+      src_repo = ostree_repo_new (src_repofile);
+      if (!ostree_repo_open (src_repo, cancellable, error))
+        return FALSE;
+    }
+  else
+    {
+      src_repo = g_object_ref (dst_repo);
+    }
+
+  src_refs = g_ptr_array_new_with_free_func (g_free);
+  if (opt_src_ref)
+    {
+      g_assert (n_dst_refs == 1);
+      g_ptr_array_add (src_refs, g_strdup (opt_src_ref));
+    }
+  else
+    {
+      g_assert (opt_src_repo != NULL);
+      if (n_dst_refs == 0)
+        {
+          g_autofree const char **keys = NULL;
+          g_autoptr(GHashTable) all_src_refs = NULL;
+
+          if (!ostree_repo_list_refs (src_repo, NULL, &all_src_refs,
+                                      cancellable, error))
+            return FALSE;
+
+          keys = (const char **)g_hash_table_get_keys_as_array (all_src_refs, NULL);
+
+          for (i = 0; keys[i] != NULL; i++)
+            {
+              if (g_str_has_prefix (keys[i], "runtime/") ||
+                  g_str_has_prefix (keys[i], "app/"))
+                g_ptr_array_add (src_refs, g_strdup (keys[i]));
+            }
+          n_dst_refs = src_refs->len;
+          dst_refs = (const char **)src_refs->pdata;
+        }
+      else
+        {
+          for (i = 0; i < n_dst_refs; i++)
+            g_ptr_array_add (src_refs, g_strdup (dst_refs[i]));
+        }
+    }
+
+  resolved_src_refs = g_ptr_array_new_with_free_func (g_free);
+  for (i = 0; i < src_refs->len; i++)
+    {
+      const char *src_ref = g_ptr_array_index (src_refs, i);
+      char *resolved_ref;
+
+      if (!ostree_repo_resolve_rev (src_repo, src_ref, FALSE, &resolved_ref, error))
+        return FALSE;
+
+      g_ptr_array_add (resolved_src_refs, resolved_ref);
+    }
+
+  if (src_repo_uri != NULL)
+    {
+      OstreeRepoPullFlags pullflags = 0;
+      GVariantBuilder builder;
+      g_autoptr(OstreeAsyncProgress) progress = NULL;
+      g_auto(GLnxConsoleRef) console = { 0, };
+      gboolean res;
+
+      if (opt_untrusted)
+        pullflags |= OSTREE_REPO_PULL_FLAGS_UNTRUSTED;
+
+      glnx_console_lock (&console);
+      if (console.is_tty)
+        progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
+
+      g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+      g_variant_builder_add (&builder, "{s@v}", "flags",
+                             g_variant_new_variant (g_variant_new_int32 (pullflags)));
+      g_variant_builder_add (&builder, "{s@v}", "refs",
+                             g_variant_new_variant (g_variant_new_strv ((const char *const*) resolved_src_refs->pdata,
+                                                                        resolved_src_refs->len)));
+      g_variant_builder_add (&builder, "{s@v}", "depth",
+                             g_variant_new_variant (g_variant_new_int32 (0)));
+
+      res = ostree_repo_pull_with_options (dst_repo, src_repo_uri,
+                                           g_variant_builder_end (&builder),
+                                           progress,
+                                           cancellable, error);
+
+      if (progress)
+        ostree_async_progress_finish (progress);
+
+      if (!res)
+        return FALSE;
+    }
+
+  /* By now we have the commit with commit_id==resolved_ref and dependencies in dst_repo. We now create a new
+   * commit based on the toplevel tree ref from that commit.
+   * This is equivalent to:
+   *   ostree commit --skip-if-unchanged --repo=${destrepo} --tree=ref=${resolved_ref}
+   */
+
+  transaction = flatpak_repo_transaction_start (dst_repo, cancellable, error);
+  if (transaction == NULL)
+    return FALSE;
+
+  for (i = 0; i < resolved_src_refs->len; i ++)
+    {
+      const char *dst_ref = dst_refs[i];
+      const char *resolved_ref = g_ptr_array_index (resolved_src_refs, i);
+      g_autofree char *dst_parent = NULL;
+      g_autoptr(GFile) dst_parent_root = NULL;
+      g_autoptr(GFile) src_ref_root = NULL;
+      g_autoptr(GVariant) src_commitv = NULL;
+      g_autoptr(OstreeMutableTree) mtree = NULL;
+      g_autoptr(GFile) dst_root = NULL;
+      g_autoptr(GVariant) commitv_metadata = NULL;
+      const char *subject;
+      const char *body;
+      g_autofree char *commit_checksum = NULL;
+      GVariantBuilder metadata_builder;
+      gint j;
+      const char *dst_collection_id = NULL;
+
+      if (!ostree_repo_resolve_rev (dst_repo, dst_ref, TRUE, &dst_parent, error))
+        return FALSE;
+
+      if (dst_parent != NULL &&
+          !ostree_repo_read_commit (dst_repo, dst_parent, &dst_parent_root, NULL, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_read_commit (dst_repo, resolved_ref, &src_ref_root, NULL, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_load_commit (dst_repo, resolved_ref, &src_commitv, &src_commit_state, error))
+        return FALSE;
+
+      if (src_commit_state & OSTREE_REPO_COMMIT_STATE_PARTIAL)
+        return flatpak_fail (error, _("Can't commit from partial source commit."));
+
+      /* Don't create a new commit if this is the same tree */
+      if (!opt_force && dst_parent_root != NULL && g_file_equal (dst_parent_root, src_ref_root))
+        {
+          g_print (_("%s: no change\n"), dst_ref);
+          continue;
+        }
+
+      mtree = ostree_mutable_tree_new ();
+      if (!ostree_repo_write_directory_to_mtree (dst_repo, src_ref_root, mtree, NULL,
+                                                 cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_write_mtree (dst_repo, mtree, &dst_root, cancellable, error))
+        return FALSE;
+
+      commitv_metadata = g_variant_get_child_value (src_commitv, 0);
+
+      g_variant_get_child (src_commitv, 3, "s", &subject);
+      if (opt_subject)
+        subject = (const char *)opt_subject;
+      g_variant_get_child (src_commitv, 4, "s", &body);
+      if (opt_body)
+        body = (const char *)opt_body;
+
+#ifdef FLATPAK_ENABLE_P2P
+      dst_collection_id = ostree_repo_get_collection_id (dst_repo);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+      /* Copy old metadata */
+      g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));
+
+      /* Bindings. xa.ref is deprecated but added anyway for backwards compatibility.
+       * Add the bindings even if we are not built with P2P support, since other
+       * flatpak builds might be. */
+      g_variant_builder_add (&metadata_builder, "{sv}", "ostree.collection-binding",
+                             g_variant_new_string (dst_collection_id ? dst_collection_id : ""));
+      g_variant_builder_add (&metadata_builder, "{sv}", "ostree.ref-binding",
+                             g_variant_new_strv (&dst_ref, 1));
+      g_variant_builder_add (&metadata_builder, "{sv}", "xa.ref", g_variant_new_string (dst_ref));
+
+      /* Record the source commit. This is nice to have, but it also
+         means the commit-from gets a different commit id, which
+         avoids problems with e.g.  sharing .commitmeta files
+         (signatures) */
+      g_variant_builder_add (&metadata_builder, "{sv}", "xa.from_commit", g_variant_new_string (resolved_ref));
+
+      for (j = 0; j < g_variant_n_children (commitv_metadata); j++)
+        {
+          g_autoptr(GVariant) child = g_variant_get_child_value (commitv_metadata, j);
+          g_autoptr(GVariant) keyv = g_variant_get_child_value (child, 0);
+          const char *key = g_variant_get_string (keyv, NULL);
+
+          if (strcmp (key, "xa.ref") == 0 ||
+              strcmp (key, "xa.from_commit") == 0 ||
+              strcmp (key, "ostree.collection-binding") == 0 ||
+              strcmp (key, "ostree.ref-binding") == 0)
+            continue;
+
+          g_variant_builder_add_value (&metadata_builder, child);
+        }
+
+      if (!ostree_repo_write_commit_with_time (dst_repo, dst_parent, subject, body, g_variant_builder_end (&metadata_builder),
+                                               OSTREE_REPO_FILE (dst_root),
+                                               ostree_commit_get_timestamp (src_commitv),
+                                               &commit_checksum, cancellable, error))
+        return FALSE;
+
+      g_print ("%s: %s\n", dst_ref, commit_checksum);
+
+      /* This doesn't copy the detached metadata. I'm not sure if this is a problem.
+       * The main thing there is commit signatures, and we can't copy those, as the commit hash changes.
+       */
+
+      if (opt_gpg_key_ids)
+        {
+          char **iter;
+
+          for (iter = opt_gpg_key_ids; iter && *iter; iter++)
+            {
+              const char *keyid = *iter;
+              g_autoptr(GError) my_error = NULL;
+
+              if (!ostree_repo_sign_commit (dst_repo,
+                                            commit_checksum,
+                                            keyid,
+                                            opt_gpg_homedir,
+                                            cancellable,
+                                            &my_error) &&
+                  !g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+                {
+                  g_propagate_error (error, g_steal_pointer (&my_error));
+                  return FALSE;
+                }
+            }
+        }
+
+#ifdef FLATPAK_ENABLE_P2P
+      if (dst_collection_id != NULL)
+        {
+          OstreeCollectionRef ref = { (char *) dst_collection_id, (char *) dst_ref };
+          ostree_repo_transaction_set_collection_ref (dst_repo, &ref, commit_checksum);
+        }
+      else
+#endif  /* FLATPAK_ENABLE_P2P */
+        {
+          ostree_repo_transaction_set_ref (dst_repo, NULL, dst_ref, commit_checksum);
+        }
+    }
+
+  if (!ostree_repo_commit_transaction (dst_repo, NULL, cancellable, error))
+    return FALSE;
+
+  if (opt_update_appstream &&
+      !flatpak_repo_generate_appstream (dst_repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, 0, cancellable, error))
+    return FALSE;
+
+  if (!opt_no_update_summary &&
+      !flatpak_repo_update (dst_repo,
+                            (const char **) opt_gpg_key_ids,
+                            opt_gpg_homedir,
+                            cancellable,
+                            error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_commit_from (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) dst_repofile = NULL;
+  g_autoptr(OstreeRepo) dst_repo = NULL;
+  g_autoptr(GFile) src_repofile = NULL;
+  g_autoptr(OstreeRepo) src_repo = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* DST-REPO */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* DST-REF */
+      dst_repofile = g_file_new_for_commandline_arg (completion->argv[1]);
+      dst_repo = ostree_repo_new (dst_repofile);
+      if (ostree_repo_open (dst_repo, NULL, NULL))
+        flatpak_complete_ref (completion, dst_repo);
+
+      if (opt_src_repo)
+        {
+          src_repofile = g_file_new_for_commandline_arg (opt_src_repo);
+          src_repo = ostree_repo_new (src_repofile);
+          if (ostree_repo_open (src_repo, NULL, NULL))
+            flatpak_complete_ref (completion, src_repo);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c
new file mode 100644 (file)
index 0000000..5f549aa
--- /dev/null
@@ -0,0 +1,1020 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+
+static char *opt_subject;
+static char *opt_body;
+static char *opt_arch;
+static gboolean opt_runtime;
+static gboolean opt_update_appstream;
+static gboolean opt_no_update_summary;
+static char **opt_gpg_key_ids;
+static char **opt_exclude;
+static char **opt_include;
+static char *opt_gpg_homedir;
+static char *opt_files;
+static char *opt_metadata;
+static char *opt_timestamp = NULL;
+#ifdef FLATPAK_ENABLE_P2P
+static char *opt_collection_id = NULL;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+static GOptionEntry options[] = {
+  { "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, N_("One line subject"), N_("SUBJECT") },
+  { "body", 'b', 0, G_OPTION_ARG_STRING, &opt_body, N_("Full description"), N_("BODY") },
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Architecture to export for (must be host compatible)"), N_("ARCH") },
+  { "runtime", 'r', 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Commit runtime (/usr), not /app"), NULL },
+  { "update-appstream", 0, 0, G_OPTION_ARG_NONE, &opt_update_appstream, N_("Update the appstream branch"), NULL },
+  { "no-update-summary", 0, 0, G_OPTION_ARG_NONE, &opt_no_update_summary, N_("Don't update the summary"), NULL },
+  { "files", 0, 0, G_OPTION_ARG_STRING, &opt_files, N_("Use alternative directory for the files"), N_("SUBDIR") },
+  { "metadata", 0, 0, G_OPTION_ARG_STRING, &opt_metadata, N_("Use alternative file for the metadata"), N_("FILE") },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the commit with"), N_("KEY-ID") },
+  { "exclude", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_exclude, N_("Files to exclude"), N_("PATTERN") },
+  { "include", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_include, N_("Excluded files to include"), N_("PATTERN") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+  { "timestamp", 0, 0, G_OPTION_ARG_STRING, &opt_timestamp, N_("Override the timestamp of the commit"), N_("ISO-8601-TIMESTAMP") },
+#ifdef FLATPAK_ENABLE_P2P
+  { "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), "COLLECTION-ID" },
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  { NULL }
+};
+
+static gboolean
+metadata_get_arch (GFile *file, char **out_arch, GError **error)
+{
+  g_autofree char *path = NULL;
+
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_autofree char *runtime = NULL;
+  g_auto(GStrv) parts = NULL;
+
+  if (opt_arch != NULL)
+    {
+      *out_arch = g_strdup (opt_arch);
+      return TRUE;
+    }
+
+  keyfile = g_key_file_new ();
+  path = g_file_get_path (file);
+  if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, error))
+    return FALSE;
+
+  runtime = g_key_file_get_string (keyfile,
+                                   "Application",
+                                   "runtime", NULL);
+  if (runtime == NULL)
+    runtime = g_key_file_get_string (keyfile,
+                                     "Application",
+                                     "sdk", NULL);
+  if (runtime == NULL)
+    runtime = g_key_file_get_string (keyfile,
+                                     "Runtime",
+                                     "runtime", NULL);
+  if (runtime == NULL)
+    runtime = g_key_file_get_string (keyfile,
+                                     "Runtime",
+                                     "sdk", NULL);
+  if (runtime == NULL)
+    {
+      *out_arch = g_strdup (flatpak_get_arch ());
+      return TRUE;
+    }
+
+  parts = g_strsplit (runtime, "/", 0);
+  if (g_strv_length (parts) != 3)
+    return flatpak_fail (error, "Failed to determine arch from metadata runtime key: %s", runtime);
+
+  *out_arch = g_strdup (parts[1]);
+
+  return TRUE;
+}
+
+static gboolean
+is_empty_directory (GFile *file, GCancellable *cancellable)
+{
+  g_autoptr(GFileEnumerator) file_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+
+  file_enum = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME,
+                                         G_FILE_QUERY_INFO_NONE,
+                                         cancellable, NULL);
+  if (!file_enum)
+    return FALSE;
+
+  child_info = g_file_enumerator_next_file (file_enum, cancellable, NULL);
+  if (child_info)
+    return FALSE;
+
+  return TRUE;
+}
+
+typedef struct
+{
+  const char **exclude;
+  const char **include;
+} CommitData;
+
+static gboolean
+matches_patterns (const char **patterns, const char *path)
+{
+  int i;
+
+  if (patterns == NULL)
+    return FALSE;
+
+  for (i = 0; patterns[i] != NULL; i++)
+    {
+      if (flatpak_path_match_prefix (patterns[i], path) != NULL)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static OstreeRepoCommitFilterResult
+commit_filter (OstreeRepo *repo,
+               const char *path,
+               GFileInfo  *file_info,
+               CommitData *commit_data)
+{
+  guint mode;
+
+  /* No user info */
+  g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0);
+
+  /* In flatpak, there is no real reason for files to have different
+   * permissions based on the group or user really, everything is
+   * always used readonly for everyone. Having things be writeable
+   * for anyone but the user just causes risks for the system-installed
+   * case. So, we canonicalize the mode to writable only by the user,
+   * readable to all, and executable for all for directories and
+   * files that the user can execute.
+  */
+  mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
+  if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
+    mode = 0755 | S_IFDIR;
+  else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
+    {
+      /* If use can execute, make executable by all */
+      if (mode & S_IXUSR)
+        mode = 0755 | S_IFREG;
+      else /* otherwise executable by none */
+        mode = 0644 | S_IFREG;
+    }
+  g_file_info_set_attribute_uint32 (file_info, "unix::mode", mode);
+
+  if (matches_patterns (commit_data->exclude, path) &&
+      !matches_patterns (commit_data->include, path))
+    {
+      g_debug ("Excluding %s", path);
+      return OSTREE_REPO_COMMIT_FILTER_SKIP;
+    }
+
+  return OSTREE_REPO_COMMIT_FILTER_ALLOW;
+}
+
+static gboolean
+add_file_to_mtree (GFile             *file,
+                   const char        *name,
+                   OstreeRepo        *repo,
+                   OstreeMutableTree *mtree,
+                   GCancellable      *cancellable,
+                   GError           **error)
+{
+  g_autoptr(GFileInfo) file_info = NULL;
+  g_autoptr(GInputStream) raw_input = NULL;
+  g_autoptr(GInputStream) input = NULL;
+  guint64 length;
+  g_autofree guchar *child_file_csum = NULL;
+  g_autofree char *tmp_checksum = NULL;
+
+  file_info = g_file_query_info (file,
+                                 "standard::size",
+                                 0, cancellable, error);
+  if (file_info == NULL)
+    return FALSE;
+
+  g_file_info_set_name (file_info, name);
+  g_file_info_set_file_type (file_info, G_FILE_TYPE_REGULAR);
+  g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::mode", 0100644);
+
+  raw_input = (GInputStream *) g_file_read (file, cancellable, error);
+  if (raw_input == NULL)
+    return FALSE;
+
+  if (!ostree_raw_file_to_content_stream (raw_input,
+                                          file_info, NULL,
+                                          &input, &length,
+                                          cancellable, error))
+    return FALSE;
+
+  if (!ostree_repo_write_content (repo, NULL, input, length,
+                                  &child_file_csum, cancellable, error))
+    return FALSE;
+
+  tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
+  if (!ostree_mutable_tree_replace_file (mtree, name, tmp_checksum, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+find_file_in_tree (GFile *base, const char *filename)
+{
+  g_autoptr(GFileEnumerator) enumerator = NULL;
+
+  enumerator = g_file_enumerate_children (base,
+                                          G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+                                          G_FILE_ATTRIBUTE_STANDARD_NAME,
+                                          G_FILE_QUERY_INFO_NONE,
+                                          NULL,
+                                          NULL);
+  if (!enumerator)
+    return FALSE;
+
+  do {
+    g_autoptr(GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
+    GFileType type;
+    const char *name;
+
+    if (!info)
+      return FALSE;
+
+    type = g_file_info_get_file_type (info);
+    name = g_file_info_get_name (info);
+
+    if (type == G_FILE_TYPE_REGULAR && strcmp (name, filename) == 0)
+      return TRUE;
+    else if (type == G_FILE_TYPE_DIRECTORY)
+      {
+        g_autoptr(GFile) dir = g_file_get_child (base, name);
+        if (find_file_in_tree (dir, filename))
+          return TRUE;
+      }
+  } while (1);
+
+  return FALSE;
+}
+
+static GFile *
+convert_app_absolute_path (const char *path, GFile *files)
+{
+  g_autofree char *exec_path = NULL;
+
+  if (g_path_is_absolute (path))
+    {
+      if (g_str_has_prefix (path, "/app/"))
+        exec_path = g_strdup (path + 5);
+      else
+        exec_path = g_strdup (path);
+    }
+  else
+    exec_path = g_strconcat ("bin/", path, NULL);
+
+  return g_file_resolve_relative_path (files, exec_path);
+}
+
+static gboolean
+validate_desktop_file (GFile *desktop_file,
+                       GFile *export,
+                       GFile *files,
+                       const char *app_id,
+                       char **icon,
+                       gboolean *activatable,
+                       GError **error)
+{
+  g_autofree char *path = g_file_get_path (desktop_file);
+  g_autoptr(GSubprocess) subprocess = NULL;
+  g_autofree char *stdout_buf = NULL;
+  g_autofree char *stderr_buf = NULL;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GKeyFile) key_file = NULL;
+  g_autofree char *command = NULL;
+  g_auto(GStrv) argv = NULL;
+  g_autoptr(GFile) bin_file = NULL;
+
+  if (!g_file_query_exists (desktop_file, NULL))
+    return TRUE;
+
+  subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
+                                 G_SUBPROCESS_FLAGS_STDERR_PIPE |
+                                 G_SUBPROCESS_FLAGS_STDERR_MERGE,
+                                 &local_error, "desktop-file-validate", path, NULL);
+  if (!subprocess)
+    {
+      if (!g_error_matches (local_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
+        g_print (_("WARNING: Error running desktop-file-validate: %s\n"), local_error->message);
+
+      g_clear_error (&local_error);
+      goto check_refs;
+    }
+
+  if (!g_subprocess_communicate_utf8 (subprocess, NULL, NULL, &stdout_buf, &stderr_buf, &local_error))
+    {
+      g_print (_("WARNING: Error reading from desktop-file-validate: %s\n"), local_error->message);
+      g_clear_error (&local_error);
+    }
+
+  if (g_subprocess_get_if_exited (subprocess) &&
+      g_subprocess_get_exit_status (subprocess) != 0)
+    g_print (_("WARNING: Failed to validate desktop file %s: %s\n"), path, stdout_buf);
+
+check_refs:
+  /* Test that references to other files are valid */
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, error))
+    return FALSE;
+
+  command = g_key_file_get_string (key_file,
+                                   G_KEY_FILE_DESKTOP_GROUP,
+                                   G_KEY_FILE_DESKTOP_KEY_EXEC,
+                                   &local_error);
+  if (!command)
+    {
+      g_print (_("WARNING: Can't find Exec key in %s: %s\n"), path, local_error->message);
+      g_clear_error (&local_error);
+    }
+
+  argv = g_strsplit (command, " ", 0);
+
+  bin_file = convert_app_absolute_path (argv[0], files);
+  if (!g_file_query_exists (bin_file, NULL))
+    g_print (_("WARNING: Binary not found for Exec line in %s: %s\n"), path, command);
+
+  *icon = g_key_file_get_string (key_file,
+                                 G_KEY_FILE_DESKTOP_GROUP,
+                                 G_KEY_FILE_DESKTOP_KEY_ICON,
+                                 NULL);
+  if (*icon && !g_str_has_prefix (*icon, app_id))
+    g_print (_("WARNING: Icon not matching app id in %s: %s\n"), path, *icon);
+
+  *activatable = g_key_file_get_boolean (key_file,
+                                         G_KEY_FILE_DESKTOP_GROUP,
+                                         G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE,
+                                         NULL);
+
+  return TRUE;
+}
+
+static gboolean
+validate_icon (const char *icon,
+               GFile *export,
+               const char *app_id,
+               GError **error)
+{
+  g_autoptr(GFile) icondir = NULL;
+  g_autofree char *png = NULL;
+  g_autofree char *svg  = NULL;
+
+  if (!icon)
+    return TRUE;
+
+  icondir = g_file_resolve_relative_path (export, "share/icons/hicolor");
+  png = g_strconcat (icon, ".png", NULL);
+  svg  = g_strconcat (icon, ".svg", NULL);
+  if (!find_file_in_tree (icondir, png) &&
+      !find_file_in_tree (icondir, svg))
+    g_print (_("WARNING: Icon referenced in desktop file but not exported: %s\n"), icon);
+
+  return TRUE;
+}
+
+static gboolean
+validate_service_file (GFile *service_file,
+                       gboolean activatable,
+                       GFile *files,
+                       const char *app_id,
+                       GError **error)
+{
+  g_autofree char *path = g_file_get_path (service_file);
+  g_autoptr(GKeyFile) key_file = NULL;
+  g_autofree char *name = NULL;
+  g_autofree char *command = NULL;
+  g_auto(GStrv) argv = NULL;
+  g_autoptr(GFile) bin_file = NULL;
+
+  if (!g_file_query_exists (service_file, NULL))
+    {
+      if (activatable)
+        {
+          g_set_error (error,
+                       G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Desktop file D-Bus activatable, but service file not exported: %s", path);
+          return FALSE;
+        }
+
+      return TRUE;
+    }
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, error))
+    return FALSE;
+
+  name = g_key_file_get_string (key_file, "D-BUS Service", "Name", error);
+  if (!name)
+    {
+      g_prefix_error (error, "Invalid service file %s: ", path);
+      return FALSE;
+    }
+
+  if (strcmp (name, app_id) != 0)
+    {
+      g_set_error (error,
+                   G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Name in service file %s does not match app id: %s", path, name);
+      return FALSE;
+    }
+
+  command = g_key_file_get_string (key_file, "D-BUS Service", "Exec", error);
+  if (!command)
+    {
+      g_prefix_error (error, "Invalid service file %s: ", path);
+      return FALSE;
+    }
+
+  argv = g_strsplit (command, " ", 0);
+
+  bin_file = convert_app_absolute_path (argv[0], files);
+  if (!g_file_query_exists (bin_file, NULL))
+    g_print (_("WARNING: Binary not found for Exec line in %s: %s\n"), path, command);
+
+  return TRUE;
+}
+
+static gboolean
+validate_exports (GFile *export, GFile *files, const char *app_id, GError **error)
+{
+  g_autofree char *desktop_path = NULL;
+  g_autoptr(GFile) desktop_file = NULL;
+  g_autofree char *service_path = NULL;
+  g_autoptr(GFile) service_file = NULL;
+  g_autofree char *icon = NULL;
+  gboolean activatable = FALSE;
+
+  desktop_path = g_strconcat ("share/applications/", app_id, ".desktop", NULL);
+  desktop_file = g_file_resolve_relative_path (export, desktop_path);
+
+  if (!validate_desktop_file (desktop_file, export, files, app_id, &icon, &activatable, error))
+    return FALSE;
+
+  if (!validate_icon (icon, export, app_id, error))
+    return FALSE;
+
+  service_path = g_strconcat ("share/dbus-1/services/", app_id, ".service", NULL);
+  service_file = g_file_resolve_relative_path (export, service_path);
+
+  if (!validate_service_file (service_file, activatable, files, app_id, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+collect_extra_data (GKeyFile *metakey, GVariantDict *metadata_dict, GError **error)
+{
+  g_auto(GStrv) keys = NULL;
+  g_autoptr(GVariantBuilder) extra_data_sources_builder = NULL;
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  int i;
+
+  keys = g_key_file_get_keys (metakey, "Extra Data", NULL, NULL);
+  if (keys == NULL)
+    return TRUE;
+
+  extra_data_sources_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(ayttays)"));
+
+  for (i = 0; keys[i] != NULL; i++)
+    {
+      const char *key = keys[i];
+      if (g_str_has_prefix (key, "uri"))
+        {
+          const char *suffix = key + 3;
+          g_autofree char *uri = NULL;
+          g_autofree char *checksum_key = NULL;
+          g_autofree char *size_key = NULL;
+          g_autofree char *installed_size_key = NULL;
+          g_autofree char *name_key = NULL;
+          g_autofree char *checksum = NULL;
+          g_autofree char *name = NULL;
+          guint64 size, installed_size;
+
+          checksum_key = g_strconcat ("checksum", suffix, NULL);
+          size_key = g_strconcat ("size", suffix, NULL);
+          installed_size_key = g_strconcat ("installed-size", suffix, NULL);
+          name_key = g_strconcat ("name", suffix, NULL);
+
+          uri = g_key_file_get_string (metakey, "Extra Data", key, error);
+          if (uri == NULL)
+            return FALSE;
+
+          if (!g_str_has_prefix (uri, "http:") &&
+              !g_str_has_prefix (uri, "https:"))
+            {
+              g_set_error (error, G_KEY_FILE_ERROR,
+                           G_KEY_FILE_ERROR_INVALID_VALUE,
+                           _("Invalid uri type %s, only http/https supported"), uri);
+              return FALSE;
+            }
+
+          if (g_key_file_has_key (metakey, "Extra Data", name_key, NULL))
+            {
+              name = g_key_file_get_string (metakey, "Extra Data", name_key, error);
+              if (name == NULL)
+                return FALSE;
+            }
+          else
+            {
+              g_autoptr(GFile) file = g_file_new_for_uri (uri);
+              name = g_file_get_basename (file);
+              if (name == NULL || *name == 0)
+                {
+                  g_set_error (error, G_KEY_FILE_ERROR,
+                               G_KEY_FILE_ERROR_INVALID_VALUE,
+                               _("Unable to find basename in %s, specify a name explicitly"), uri);
+                  return FALSE;
+                }
+            }
+
+          if (strchr (name, '/') != NULL)
+            {
+              g_set_error (error, G_KEY_FILE_ERROR,
+                           G_KEY_FILE_ERROR_INVALID_VALUE,
+                           _("No slashes allowed in extra data name"));
+              return FALSE;
+            }
+
+          checksum = g_key_file_get_string (metakey, "Extra Data", checksum_key, error);
+          if (checksum == NULL)
+            return FALSE;
+
+          if (!ostree_validate_checksum_string (checksum, NULL))
+            {
+              g_set_error (error, G_KEY_FILE_ERROR,
+                           G_KEY_FILE_ERROR_INVALID_VALUE,
+                           _("Invalid format for sha256 checksum: '%s'"), checksum);
+              return FALSE;
+            }
+
+          size = g_key_file_get_uint64 (metakey, "Extra Data", size_key, error);
+          if (size == 0)
+            {
+              if (error != NULL && *error == NULL)
+                g_set_error (error, G_KEY_FILE_ERROR,
+                             G_KEY_FILE_ERROR_INVALID_VALUE,
+                             _("Extra data sizes of zero not supported"));
+              return FALSE;
+            }
+
+          installed_size = g_key_file_get_uint64 (metakey, "Extra Data", installed_size_key, NULL);
+
+          g_variant_builder_add (extra_data_sources_builder,
+                                 "(^aytt@ay&s)",
+                                 name, GUINT64_TO_BE (size), GUINT64_TO_BE (installed_size),
+                                 ostree_checksum_to_bytes_v (checksum), uri);
+        }
+    }
+
+  extra_data_sources = g_variant_ref_sink (g_variant_builder_end (extra_data_sources_builder));
+  g_variant_dict_insert_value (metadata_dict, "xa.extra-data-sources", extra_data_sources);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) files = NULL;
+  g_autoptr(GFile) usr = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_autoptr(GFile) export = NULL;
+  g_autoptr(GFile) repofile = NULL;
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  const char *location;
+  const char *directory;
+  const char *branch;
+  g_autofree char *arch = NULL;
+  g_autofree char *full_branch = NULL;
+  g_autofree char *id = NULL;
+  g_autofree char *parent = NULL;
+  g_autofree char *commit_checksum = NULL;
+  g_autofree char *metadata_contents = NULL;
+  g_autofree char *format_size = NULL;
+  g_autoptr(OstreeMutableTree) mtree = NULL;
+  g_autoptr(OstreeMutableTree) files_mtree = NULL;
+  g_autoptr(OstreeMutableTree) export_mtree = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GError) my_error = NULL;
+  gsize metadata_size;
+  g_autofree char *subject = NULL;
+  g_autofree char *body = NULL;
+  OstreeRepoTransactionStats stats;
+  g_autoptr(OstreeRepoCommitModifier) modifier = NULL;
+  CommitData commit_data = {0};
+  g_auto(GVariantDict) metadata_dict = FLATPAK_VARIANT_DICT_INITIALIZER;
+  g_autoptr(GVariant) metadata_dict_v = NULL;
+  gboolean is_runtime = FALSE;
+  gboolean is_extension = FALSE;
+  guint64 installed_size = 0,download_size = 0;
+  GTimeVal ts;
+  const char *collection_id;
+
+  context = g_option_context_new (_("LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    goto out;
+
+  if (argc < 3)
+    {
+      usage_error (context, _("LOCATION and DIRECTORY must be specified"), error);
+      goto out;
+    }
+
+  if (argc > 4)
+    {
+      usage_error (context, _("Too many arguments"), error);
+      goto out;
+    }
+
+  location = argv[1];
+  directory = argv[2];
+
+  if (argc >= 4)
+    branch = argv[3];
+  else
+    branch = "master";
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (opt_collection_id != NULL &&
+      !ostree_validate_collection_id (opt_collection_id, &my_error))
+    {
+      flatpak_fail (error, _("‘%s’ is not a valid collection ID: %s"), opt_collection_id, my_error->message);
+      goto out;
+    }
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (!flatpak_is_valid_branch (branch, &my_error))
+    {
+      flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, my_error->message);
+      goto out;
+    }
+
+  base = g_file_new_for_commandline_arg (directory);
+  if (opt_files)
+    files = g_file_resolve_relative_path (base, opt_files);
+  else
+    files = g_file_get_child (base, "files");
+  if (opt_files)
+    usr = g_file_resolve_relative_path (base, opt_files);
+  else
+    usr = g_file_get_child (base, "usr");
+  if (opt_metadata)
+    metadata = g_file_resolve_relative_path (base, opt_metadata);
+  else
+    metadata = g_file_get_child (base, "metadata");
+  export = g_file_get_child (base, "export");
+
+  if (!g_file_query_exists (files, cancellable) ||
+      !g_file_query_exists (metadata, cancellable))
+    {
+      flatpak_fail (error, _("Build directory %s not initialized, use flatpak build-init"), directory);
+      goto out;
+    }
+
+  if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, error))
+    goto out;
+
+  metakey = g_key_file_new ();
+  if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
+    goto out;
+
+  id = g_key_file_get_string (metakey, "Application", "name", NULL);
+  if (id == NULL)
+    {
+      id = g_key_file_get_string (metakey, "Runtime", "name", NULL);
+      if (id == NULL)
+        {
+          flatpak_fail (error, _("No name specified in the metadata"));
+          goto out;
+        }
+      is_runtime = TRUE;
+
+      if (g_key_file_has_group (metakey, "ExtensionOf"))
+        is_extension = TRUE;
+    }
+
+  if (!(opt_runtime || is_runtime) && !g_file_query_exists (export, cancellable))
+    {
+      flatpak_fail (error, "Build directory %s not finalized, use flatpak build-finish", directory);
+      goto out;
+    }
+
+  g_variant_dict_init (&metadata_dict, NULL);
+
+  if (!collect_extra_data (metakey, &metadata_dict, error))
+    goto out;
+
+  if (!(opt_runtime || is_runtime) &&
+      !validate_exports (export, files, id, error))
+    goto out;
+
+  if (!metadata_get_arch (metadata, &arch, error))
+    goto out;
+
+  if (opt_subject)
+    subject = g_strdup (opt_subject);
+  else
+    subject = g_strconcat ("Export ", id, NULL);
+  if (opt_body)
+    body = g_strdup (opt_body);
+  else
+    body = g_strdup_printf ("Name: %s\n"
+                            "Arch: %s\n"
+                            "Branch: %s\n"
+                            "Built with: "PACKAGE_STRING"\n",
+                            id, arch, branch);
+
+  full_branch = g_strconcat ((opt_runtime || is_runtime) ? "runtime/" : "app/", id, "/", arch, "/", branch, NULL);
+
+  repofile = g_file_new_for_commandline_arg (location);
+  repo = ostree_repo_new (repofile);
+
+  if (g_file_query_exists (repofile, cancellable) &&
+      !is_empty_directory (repofile, cancellable))
+    {
+      if (!ostree_repo_open (repo, cancellable, error))
+        goto out;
+
+      if (!ostree_repo_resolve_rev (repo, full_branch, TRUE, &parent, error))
+        goto out;
+
+#ifdef FLATPAK_ENABLE_P2P
+      if (opt_collection_id != NULL &&
+          g_strcmp0 (ostree_repo_get_collection_id (repo), opt_collection_id) != 0)
+        {
+          flatpak_fail (error, "Specified collection ID ‘%s’ doesn’t match collection ID in repository configuration ‘%s’.",
+                        opt_collection_id, ostree_repo_get_collection_id (repo));
+          goto out;
+        }
+#endif  /* FLATPAK_ENABLE_P2P */
+    }
+  else
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      if (opt_collection_id != NULL &&
+          !ostree_repo_set_collection_id (repo, opt_collection_id, error))
+        goto out;
+#endif  /* FLATPAK_ENABLE_P2P */
+      if (!ostree_repo_create (repo, OSTREE_REPO_MODE_ARCHIVE_Z2, cancellable, error))
+        goto out;
+    }
+
+  /* Get the canonical collection ID which we’ll use for the commit. This might
+   * be %NULL if the existing repo doesn’t have one and none was specified on
+   * the command line. */
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = ostree_repo_get_collection_id (repo);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+  if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+    goto out;
+
+  /* This is useful only if the target is a "bare" rep, but this happens
+     in flatpak-builder when commiting to the cache repo. For other repos
+     this is a no-op */
+  if (!ostree_repo_scan_hardlinks (repo, cancellable, error))
+    goto out;
+
+  mtree = ostree_mutable_tree_new ();
+
+  if (!flatpak_mtree_create_root (repo, mtree, cancellable, error))
+    goto out;
+
+  if (!ostree_mutable_tree_ensure_dir (mtree, "files", &files_mtree, error))
+    goto out;
+
+  modifier = ostree_repo_commit_modifier_new (OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS,
+                                              (OstreeRepoCommitFilter) commit_filter, &commit_data, NULL);
+
+  if (is_extension)
+    {
+      commit_data.exclude = (const char **) opt_exclude;
+      commit_data.include = (const char **) opt_include;
+      if (!ostree_repo_write_directory_to_mtree (repo, files, files_mtree, modifier, cancellable, error))
+        goto out;
+      commit_data.exclude = NULL;
+      commit_data.include = NULL;
+    }
+  else if (opt_runtime || is_runtime)
+    {
+      commit_data.exclude = (const char **) opt_exclude;
+      commit_data.include = (const char **) opt_include;
+      if (!ostree_repo_write_directory_to_mtree (repo, usr, files_mtree, modifier, cancellable, error))
+        goto out;
+      commit_data.exclude = NULL;
+      commit_data.include = NULL;
+    }
+  else
+    {
+      commit_data.exclude = (const char **) opt_exclude;
+      commit_data.include = (const char **) opt_include;
+      if (!ostree_repo_write_directory_to_mtree (repo, files, files_mtree, modifier, cancellable, error))
+        goto out;
+      commit_data.exclude = NULL;
+      commit_data.include = NULL;
+
+      if (!ostree_mutable_tree_ensure_dir (mtree, "export", &export_mtree, error))
+        goto out;
+
+      if (!ostree_repo_write_directory_to_mtree (repo, export, export_mtree, modifier, cancellable, error))
+        goto out;
+    }
+
+  if (!add_file_to_mtree (metadata, "metadata", repo, mtree, cancellable, error))
+    goto out;
+
+  if (!ostree_repo_write_mtree (repo, mtree, &root, cancellable, error))
+    goto out;
+
+  if (!flatpak_repo_collect_sizes (repo, root, &installed_size, &download_size, cancellable, error))
+    goto out;
+
+  /* Binding information. xa.ref is deprecated in favour of the OSTree keys, but
+   * keep it around for backwards compatibility. Write the bindings even if
+   * we’re compiled without P2P support, since other flatpak builds might be. */
+  g_variant_dict_insert_value (&metadata_dict, "ostree.collection-binding",
+                               g_variant_new_string ((collection_id != NULL) ? collection_id : ""));
+  g_variant_dict_insert_value (&metadata_dict, "ostree.ref-binding",
+                               g_variant_new_strv ((const gchar * const *) &full_branch, 1));
+  g_variant_dict_insert_value (&metadata_dict, "xa.ref", g_variant_new_string (full_branch));
+
+  g_variant_dict_insert_value (&metadata_dict, "xa.metadata", g_variant_new_string (metadata_contents));
+  g_variant_dict_insert_value (&metadata_dict, "xa.installed-size", g_variant_new_uint64 (GUINT64_TO_BE (installed_size)));
+  g_variant_dict_insert_value (&metadata_dict, "xa.download-size", g_variant_new_uint64 (GUINT64_TO_BE (download_size)));
+
+  metadata_dict_v = g_variant_ref_sink (g_variant_dict_end (&metadata_dict));
+
+  /* required for the metadata and the AppStream commits */
+  if (opt_timestamp != NULL)
+    {
+      if (!g_time_val_from_iso8601 (opt_timestamp, &ts))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Could not parse '%s'", opt_timestamp);
+          goto out;
+        }
+    }
+
+  if (opt_timestamp == NULL)
+    {
+      if (!ostree_repo_write_commit (repo, parent, subject, body, metadata_dict_v,
+                                     OSTREE_REPO_FILE (root),
+                                     &commit_checksum, cancellable, error))
+        goto out;
+    }
+  else
+    {
+      if (!ostree_repo_write_commit_with_time (repo, parent, subject, body,
+                                               metadata_dict_v,
+                                               OSTREE_REPO_FILE (root),
+                                               ts.tv_sec, &commit_checksum,
+                                               cancellable, error))
+        goto out;
+    }
+
+  if (opt_gpg_key_ids)
+    {
+      char **iter;
+
+      for (iter = opt_gpg_key_ids; iter && *iter; iter++)
+        {
+          const char *keyid = *iter;
+
+          if (!ostree_repo_sign_commit (repo,
+                                        commit_checksum,
+                                        keyid,
+                                        opt_gpg_homedir,
+                                        cancellable,
+                                        error))
+            goto out;
+        }
+    }
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (collection_id != NULL)
+    {
+      OstreeCollectionRef ref = { (char *) collection_id, full_branch };
+      ostree_repo_transaction_set_collection_ref (repo, &ref, commit_checksum);
+    }
+  else
+#endif  /* FLATPAK_ENABLE_P2P */
+    {
+      ostree_repo_transaction_set_ref (repo, NULL, full_branch, commit_checksum);
+    }
+
+  if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
+    goto out;
+
+  if (opt_update_appstream &&
+      !flatpak_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir,
+                                        ts.tv_sec, cancellable, error))
+    return FALSE;
+
+  if (!opt_no_update_summary &&
+      !flatpak_repo_update (repo,
+                            (const char **) opt_gpg_key_ids,
+                            opt_gpg_homedir,
+                            cancellable,
+                            error))
+    goto out;
+
+  format_size = g_format_size (stats.content_bytes_written);
+
+  g_print (_("Commit: %s\n"), commit_checksum);
+  g_print (_("Metadata Total: %u\n"), stats.metadata_objects_total);
+  g_print (_("Metadata Written: %u\n"), stats.metadata_objects_written);
+  g_print (_("Content Total: %u\n"), stats.content_objects_total);
+  g_print (_("Content Written: %u\n"), stats.content_objects_written);
+  g_print (_("Content Bytes Written:"));
+  g_print (" %" G_GUINT64_FORMAT " (%s)\n", stats.content_bytes_written, format_size);
+
+  ret = TRUE;
+
+out:
+  if (repo)
+    ostree_repo_abort_transaction (repo, cancellable, NULL);
+
+  return ret;
+}
+
+gboolean
+flatpak_complete_build_export (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* DIR */
+      flatpak_complete_dir (completion);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-finish.c b/app/flatpak-builtins-build-finish.c
new file mode 100644 (file)
index 0000000..15641ca
--- /dev/null
@@ -0,0 +1,612 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ftw.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static char *opt_command;
+static char *opt_require_version;
+static char **opt_extra_data;
+static char **opt_extensions;
+static char **opt_metadata;
+static gboolean opt_no_exports;
+static int opt_extension_prio = G_MININT;
+static char *opt_sdk;
+static char *opt_runtime;
+
+static GOptionEntry options[] = {
+  { "command", 0, 0, G_OPTION_ARG_STRING, &opt_command, N_("Command to set"), N_("COMMAND") },
+  { "require-version", 0, 0, G_OPTION_ARG_STRING, &opt_require_version, N_("Flatpak version to require"), N_("MAJOR.MINOR.MICRO") },
+  { "no-exports", 0, 0, G_OPTION_ARG_NONE, &opt_no_exports, N_("Don't process exports"), NULL },
+  { "extra-data", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_extra_data, N_("Extra data info") },
+  { "extension", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_extensions, N_("Add extension point info"),  N_("NAME=VARIABLE[=VALUE]") },
+  { "extension-priority", 0, 0, G_OPTION_ARG_INT, &opt_extension_prio, N_("Set extension priority (only for extensions)"), N_("0") },
+  { "sdk", 0, 0, G_OPTION_ARG_STRING, &opt_sdk, N_("Change the sdk used for the app"),  N_("SDK") },
+  { "runtime", 0, 0, G_OPTION_ARG_STRING, &opt_runtime, N_("Change the runtime used for the app"),  N_("RUNTIME") },
+  { "metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata, N_("Set generic metadata option"),  N_("GROUP=KEY[=VALUE]") },
+  { NULL }
+};
+
+static gboolean
+export_dir (int           source_parent_fd,
+            const char   *source_name,
+            const char   *source_relpath,
+            int           destination_parent_fd,
+            const char   *destination_name,
+            const char   *required_prefix,
+            GCancellable *cancellable,
+            GError      **error)
+{
+  int res;
+
+  g_auto(GLnxDirFdIterator) source_iter = {0};
+  glnx_autofd int destination_dfd = -1;
+  struct dirent *dent;
+
+  if (!glnx_dirfd_iterator_init_at (source_parent_fd, source_name, FALSE, &source_iter, error))
+    return FALSE;
+
+  do
+    res = mkdirat (destination_parent_fd, destination_name, 0755);
+  while (G_UNLIKELY (res == -1 && errno == EINTR));
+  if (res == -1)
+    {
+      if (errno != EEXIST)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+    }
+
+  if (!glnx_opendirat (destination_parent_fd, destination_name, TRUE,
+                       &destination_dfd, error))
+    return FALSE;
+
+  while (TRUE)
+    {
+      struct stat stbuf;
+      g_autofree char *source_printable = NULL;
+
+      if (!glnx_dirfd_iterator_next_dent (&source_iter, &dent, cancellable, error))
+        return FALSE;
+
+      if (dent == NULL)
+        break;
+
+      if (fstatat (source_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
+        {
+          if (errno == ENOENT)
+            {
+              continue;
+            }
+          else
+            {
+              glnx_set_error_from_errno (error);
+              return FALSE;
+            }
+        }
+
+      /* Don't export any hidden files or backups */
+      if (g_str_has_prefix (dent->d_name, ".") ||
+          g_str_has_suffix (dent->d_name, "~"))
+        continue;
+
+      if (S_ISDIR (stbuf.st_mode))
+        {
+          g_autofree gchar *child_relpath = g_build_filename (source_relpath, dent->d_name, NULL);
+
+          if (!export_dir (source_iter.fd, dent->d_name, child_relpath, destination_dfd, dent->d_name,
+                           required_prefix, cancellable, error))
+            return FALSE;
+        }
+      else if (S_ISREG (stbuf.st_mode))
+        {
+          source_printable = g_build_filename (source_relpath, dent->d_name, NULL);
+
+
+          if (!flatpak_has_name_prefix (dent->d_name, required_prefix))
+            {
+              g_print (_("Not exporting %s, wrong prefix\n"), source_printable);
+              continue;
+            }
+
+          g_print (_("Exporting %s\n"), source_printable);
+
+          if (!glnx_file_copy_at (source_iter.fd, dent->d_name, &stbuf,
+                                  destination_dfd, dent->d_name,
+                                  GLNX_FILE_COPY_NOXATTRS,
+                                  cancellable,
+                                  error))
+            return FALSE;
+        }
+      else
+        {
+          source_printable = g_build_filename (source_relpath, dent->d_name, NULL);
+          g_debug ("Not exporting non-regular file %s", source_printable);
+        }
+    }
+
+  /* Try to remove the directory, as we don't want to export empty directories.
+   * However, don't fail if the unlink fails due to the directory not being empty */
+  do
+    res = unlinkat (destination_parent_fd, destination_name, AT_REMOVEDIR);
+  while (G_UNLIKELY (res == -1 && errno == EINTR));
+  if (res == -1)
+    {
+      if (errno != ENOTEMPTY)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+static gboolean
+copy_exports (GFile        *source,
+              GFile        *destination,
+              const char   *source_prefix,
+              const char   *required_prefix,
+              GCancellable *cancellable,
+              GError      **error)
+{
+  if (!flatpak_mkdir_p (destination, cancellable, error))
+    return FALSE;
+
+  /* The fds are closed by this call */
+  if (!export_dir (AT_FDCWD, flatpak_file_get_path_cached (source), source_prefix,
+                   AT_FDCWD, flatpak_file_get_path_cached (destination),
+                   required_prefix, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+collect_exports (GFile *base, const char *app_id, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GFile) files = NULL;
+  g_autoptr(GFile) export = NULL;
+  const char *paths[] = {
+    "share/applications",                 /* Copy desktop files */
+    "share/mime/packages",                /* Copy MIME Type files */
+    "share/icons",                        /* Icons */
+    "share/dbus-1/services",              /* D-Bus service files */
+    "share/gnome-shell/search-providers", /* Search providers */
+    NULL,
+  };
+  int i;
+
+  files = g_file_get_child (base, "files");
+
+  export = g_file_get_child (base, "export");
+
+  if (!flatpak_mkdir_p (export, cancellable, error))
+    return FALSE;
+
+  if (opt_no_exports)
+    return TRUE;
+
+  for (i = 0; paths[i]; i++)
+    {
+      g_autoptr(GFile) src = NULL;
+      src = g_file_resolve_relative_path (files, paths[i]);
+      if (g_file_query_exists (src, cancellable))
+        {
+          g_debug ("Exporting from %s", paths[i]);
+          g_autoptr(GFile) dest = NULL;
+          g_autoptr(GFile) dest_parent = NULL;
+          dest = g_file_resolve_relative_path (export, paths[i]);
+          dest_parent = g_file_get_parent (dest);
+          g_debug ("Ensuring export/%s parent exists", paths[i]);
+          if (!flatpak_mkdir_p (dest_parent, cancellable, error))
+            return FALSE;
+          g_debug ("Copying from files/%s", paths[i]);
+          if (!copy_exports (src, dest, paths[i], app_id, cancellable, error))
+            return FALSE;
+        }
+    }
+
+  g_assert_no_error (*error);
+  return TRUE;
+}
+
+static gboolean
+update_metadata (GFile *base, FlatpakContext *arg_context, gboolean is_runtime, GCancellable *cancellable, GError **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) metadata = NULL;
+  g_autofree char *path = NULL;
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_autoptr(FlatpakContext) app_context = NULL;
+  GError *temp_error = NULL;
+  const char *group;
+  int i;
+
+  metadata = g_file_get_child (base, "metadata");
+  if (!g_file_query_exists (metadata, cancellable))
+    goto out;
+
+  if (is_runtime)
+    group = FLATPAK_METADATA_GROUP_RUNTIME;
+  else
+    group = FLATPAK_METADATA_GROUP_APPLICATION;
+
+  path = g_file_get_path (metadata);
+  keyfile = g_key_file_new ();
+  if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, error))
+    goto out;
+
+  if (opt_sdk != NULL || opt_runtime != NULL)
+    {
+      g_autofree char *old_runtime = g_key_file_get_string (keyfile,
+                                                            group,
+                                                            FLATPAK_METADATA_KEY_RUNTIME, NULL);
+      g_autofree char *old_sdk = g_key_file_get_string (keyfile,
+                                                        group,
+                                                        FLATPAK_METADATA_KEY_SDK,
+                                                        NULL);
+      const char *old_sdk_arch = NULL;
+      const char *old_runtime_arch = NULL;
+      const char *old_sdk_branch = NULL;
+      const char *old_runtime_branch = NULL;
+      g_auto(GStrv) old_sdk_parts = NULL;
+      g_auto(GStrv) old_runtime_parts = NULL;
+
+      if (old_sdk)
+        old_sdk_parts = g_strsplit (old_sdk, "/", 3);
+
+      if (old_runtime)
+        old_runtime_parts = g_strsplit (old_runtime, "/", 3);
+
+      if (old_sdk_parts != NULL)
+        {
+          old_sdk_arch = old_sdk_parts[1];
+          old_sdk_branch = old_sdk_parts[2];
+        }
+      if (old_runtime_parts != NULL)
+        {
+          old_runtime_arch = old_runtime_parts[1];
+          old_runtime_branch = old_runtime_parts[2];
+
+          /* Use the runtime as fallback if sdk is not specified */
+          if (old_sdk_parts == NULL)
+            {
+              old_sdk_arch = old_runtime_parts[1];
+              old_sdk_branch = old_runtime_parts[2];
+            }
+        }
+
+      if (opt_sdk)
+        {
+          g_autofree char *id = NULL;
+          g_autofree char *arch = NULL;
+          g_autofree char *branch = NULL;
+          g_autofree char *ref = NULL;
+          FlatpakKinds kinds;
+
+          if (!flatpak_split_partial_ref_arg (opt_sdk, FLATPAK_KINDS_RUNTIME,
+                                              old_sdk_arch, old_sdk_branch ? old_sdk_branch : "master",
+                                              &kinds, &id, &arch, &branch, error))
+            return FALSE;
+
+          ref = flatpak_build_untyped_ref (id, branch, arch);
+          g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_SDK, ref);
+        }
+
+      if (opt_runtime)
+        {
+          g_autofree char *id = NULL;
+          g_autofree char *arch = NULL;
+          g_autofree char *branch = NULL;
+          g_autofree char *ref = NULL;
+          FlatpakKinds kinds;
+
+          if (!flatpak_split_partial_ref_arg (opt_runtime, FLATPAK_KINDS_RUNTIME,
+                                              old_runtime_arch, old_runtime_branch ? old_runtime_branch : "master",
+                                              &kinds, &id, &arch, &branch, error))
+            return FALSE;
+
+          ref = flatpak_build_untyped_ref (id, branch, arch);
+          g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_RUNTIME, ref);
+        }
+    }
+
+  if (!is_runtime)
+    {
+      if (g_key_file_has_key (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, NULL))
+        {
+          g_debug ("Command key is present");
+
+          if (opt_command)
+            g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, opt_command);
+        }
+      else if (opt_command)
+        {
+          g_debug ("Using explicitly provided command %s", opt_command);
+
+          g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, opt_command);
+        }
+      else
+        {
+          g_autofree char *command = NULL;
+          g_autoptr(GFile) bin_dir = NULL;
+          g_autoptr(GFileEnumerator) bin_enum = NULL;
+          g_autoptr(GFileInfo) child_info = NULL;
+
+          g_debug ("Looking for executables");
+
+          bin_dir = g_file_resolve_relative_path (base, "files/bin");
+          if (g_file_query_exists (bin_dir, cancellable))
+            {
+              bin_enum = g_file_enumerate_children (bin_dir, G_FILE_ATTRIBUTE_STANDARD_NAME,
+                                                    G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                                    cancellable, error);
+              if (!bin_enum)
+                goto out;
+
+              while ((child_info = g_file_enumerator_next_file (bin_enum, cancellable, &temp_error)))
+                {
+                  if (command != NULL)
+                    {
+                      g_print (_("More than one executable found\n"));
+                      break;
+                    }
+                  command = g_strdup (g_file_info_get_name (child_info));
+                }
+              if (temp_error != NULL)
+                goto out;
+            }
+
+          if (command)
+            {
+              g_print (_("Using %s as command\n"), command);
+              g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, command);
+            }
+          else
+            {
+              g_print (_("No executable found\n"));
+            }
+        }
+    }
+
+  if (opt_require_version)
+    g_key_file_set_string (keyfile, group, "required-flatpak", opt_require_version);
+
+  app_context = flatpak_context_new ();
+  if (!flatpak_context_load_metadata (app_context, keyfile, error))
+    goto out;
+  flatpak_context_merge (app_context, arg_context);
+  flatpak_context_save_metadata (app_context, FALSE, keyfile);
+
+  for (i = 0; opt_extra_data != NULL && opt_extra_data[i] != NULL; i++)
+    {
+      char *extra_data = opt_extra_data[i];
+      g_auto(GStrv) elements = NULL;
+      g_autofree char *suffix = NULL;
+      g_autofree char *uri_key = NULL;
+      g_autofree char *name_key = NULL;
+      g_autofree char *size_key = NULL;
+      g_autofree char *installed_size_key = NULL;
+      g_autofree char *checksum_key = NULL;
+
+      if (i == 0)
+        suffix = g_strdup ("");
+      else
+        suffix = g_strdup_printf ("%d", i);
+
+      elements = g_strsplit (extra_data, ":", 5);
+      if (g_strv_length (elements) != 5)
+        {
+          flatpak_fail (error, _("Too few elements in --extra-data argument %s"), extra_data);
+          goto out;
+        }
+
+      uri_key = g_strconcat (FLATPAK_METADATA_KEY_EXTRA_DATA_URI, suffix, NULL);
+      name_key = g_strconcat (FLATPAK_METADATA_KEY_EXTRA_DATA_NAME, suffix, NULL);
+      checksum_key = g_strconcat (FLATPAK_METADATA_KEY_EXTRA_DATA_CHECKSUM,
+                                  suffix, NULL);
+      size_key = g_strconcat (FLATPAK_METADATA_KEY_EXTRA_DATA_SIZE, suffix, NULL);
+      installed_size_key = g_strconcat (FLATPAK_METADATA_KEY_EXTRA_DATA_INSTALLED_SIZE,
+                                        suffix, NULL);
+
+      if (strlen (elements[0]) > 0)
+        g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                               name_key, elements[0]);
+      g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                             checksum_key, elements[1]);
+      g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                             size_key, elements[2]);
+      if (strlen (elements[3]) > 0)
+        g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                               installed_size_key, elements[3]);
+      g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                             uri_key, elements[4]);
+    }
+
+  for (i = 0; opt_metadata != NULL && opt_metadata[i] != NULL; i++)
+    {
+      g_auto(GStrv) elements = NULL;
+      elements = g_strsplit (opt_metadata[i], "=", 3);
+      if (g_strv_length (elements) < 2)
+        {
+          flatpak_fail (error, _("Too few elements in --metadata argument %s, format should be GROUP=KEY[=VALUE]]"), opt_metadata[i]);
+          goto out;
+        }
+
+      g_key_file_set_string (keyfile, elements[0], elements[1], elements[2] ? elements[2] : "true");
+    }
+
+  for (i = 0; opt_extensions != NULL && opt_extensions[i] != NULL; i++)
+    {
+      g_auto(GStrv) elements = NULL;
+      g_autofree char *groupname = NULL;
+
+      elements = g_strsplit (opt_extensions[i], "=", 3);
+      if (g_strv_length (elements) < 2)
+        {
+          flatpak_fail (error, _("Too few elements in --extension argument %s, format should be NAME=VAR[=VALUE]"), opt_extensions[i]);
+          goto out;
+        }
+
+      groupname = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION,
+                               elements[0], NULL);
+
+      g_key_file_set_string (keyfile, groupname, elements[1], elements[2] ? elements[2] : "true");
+    }
+
+
+  if (opt_extension_prio != G_MININT)
+    g_key_file_set_integer (keyfile, FLATPAK_METADATA_GROUP_EXTENSION_OF,
+                            FLATPAK_METADATA_KEY_PRIORITY, opt_extension_prio);
+
+  if (!g_key_file_save_to_file (keyfile, path, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  if (temp_error != NULL)
+    g_propagate_error (error, temp_error);
+
+  return ret;
+}
+
+gboolean
+flatpak_builtin_build_finish (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) files_dir = NULL;
+  g_autoptr(GFile) export_dir = NULL;
+  g_autoptr(GFile) metadata_file = NULL;
+  g_autofree char *metadata_contents = NULL;
+  g_autofree char *id = NULL;
+  gboolean is_runtime = FALSE;
+  gsize metadata_size;
+  const char *directory;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+
+  context = g_option_context_new (_("DIRECTORY - Finalize a build directory"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("DIRECTORY must be specified"), error);
+
+  directory = argv[1];
+
+  base = g_file_new_for_commandline_arg (directory);
+
+  files_dir = g_file_get_child (base, "files");
+  export_dir = g_file_get_child (base, "export");
+  metadata_file = g_file_get_child (base, "metadata");
+
+  if (!g_file_query_exists (files_dir, cancellable) ||
+      !g_file_query_exists (metadata_file, cancellable))
+    return flatpak_fail (error, _("Build directory %s not initialized"), directory);
+
+  if (!g_file_load_contents (metadata_file, cancellable, &metadata_contents, &metadata_size, NULL, error))
+    return FALSE;
+
+  metakey = g_key_file_new ();
+  if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
+    return FALSE;
+
+  id = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_APPLICATION,
+                              FLATPAK_METADATA_KEY_NAME, NULL);
+  if (id == NULL)
+    {
+      id = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_RUNTIME,
+                                  FLATPAK_METADATA_KEY_NAME, NULL);
+      if (id == NULL)
+        return flatpak_fail (error, _("No name specified in the metadata"));
+      is_runtime = TRUE;
+    }
+
+  if (g_file_query_exists (export_dir, cancellable))
+    return flatpak_fail (error, _("Build directory %s already finalized"), directory);
+
+  if (!is_runtime)
+    {
+      g_debug ("Collecting exports");
+      if (!collect_exports (base, id, cancellable, error))
+        return FALSE;
+    }
+
+  g_debug ("Updating metadata");
+  if (!update_metadata (base, arg_context, is_runtime, cancellable, error))
+    return FALSE;
+
+  g_print (_("Please review the exported files and the metadata\n"));
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_finish (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+
+  context = g_option_context_new ("");
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* DIR */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_context_complete (arg_context, completion);
+
+      flatpak_complete_dir (completion);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-import-bundle.c b/app/flatpak-builtins-build-import-bundle.c
new file mode 100644 (file)
index 0000000..2489354
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-oci-registry.h"
+
+static char *opt_ref;
+static gboolean opt_oci = FALSE;
+static char **opt_gpg_key_ids;
+static char *opt_gpg_homedir;
+static gboolean opt_update_appstream;
+static gboolean opt_no_update_summary;
+
+static GOptionEntry options[] = {
+  { "ref", 0, 0, G_OPTION_ARG_STRING, &opt_ref, N_("Override the ref used for the imported bundle"), N_("REF") },
+  { "oci", 0, 0, G_OPTION_ARG_NONE, &opt_oci, N_("Import oci image instead of flatpak bundle"), NULL },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the commit with"), N_("KEY-ID") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+  { "update-appstream", 0, 0, G_OPTION_ARG_NONE, &opt_update_appstream, N_("Update the appstream branch"), NULL },
+  { "no-update-summary", 0, 0, G_OPTION_ARG_NONE, &opt_no_update_summary, N_("Don't update the summary"), NULL },
+  { NULL }
+};
+
+static char *
+import_oci (OstreeRepo *repo, GFile *file,
+            GCancellable *cancellable, GError **error)
+{
+  g_autofree char *commit_checksum = NULL;
+  g_autofree char *dir_uri = NULL;
+  g_autofree char *target_ref = NULL;
+  const char *oci_digest;
+  g_autoptr(FlatpakOciRegistry) registry = NULL;
+  g_autoptr(FlatpakOciVersioned) versioned = NULL;
+  FlatpakOciManifest *manifest = NULL;
+  g_autoptr(FlatpakOciIndex) index = NULL;
+  const FlatpakOciManifestDescriptor *desc;
+  GHashTable *annotations;
+
+  dir_uri = g_file_get_uri (file);
+  registry = flatpak_oci_registry_new (dir_uri, FALSE, -1, cancellable, error);
+  if (registry == NULL)
+    return NULL;
+
+  index = flatpak_oci_registry_load_index (registry, NULL, NULL, cancellable, error);
+  if (index == NULL)
+    return NULL;
+
+  if (opt_ref)
+    {
+      desc = flatpak_oci_index_get_manifest (index, opt_ref);
+      if (desc == NULL)
+        {
+          flatpak_fail (error, _("Ref '%s' not found in registry"), opt_ref);
+          return NULL;
+        }
+    }
+  else
+    {
+      desc = flatpak_oci_index_get_only_manifest (index);
+      if (desc == NULL)
+        {
+          flatpak_fail (error, _("Multiple images in registry, specify a ref with --ref"));
+          return NULL;
+        }
+    }
+
+  oci_digest = desc->parent.digest;
+
+  versioned = flatpak_oci_registry_load_versioned (registry, NULL,
+                                                   oci_digest, NULL,
+                                                   cancellable, error);
+  if (versioned == NULL)
+    return NULL;
+
+  manifest = FLATPAK_OCI_MANIFEST (versioned);
+
+  annotations = flatpak_oci_manifest_get_annotations (manifest);
+  if (annotations)
+    flatpak_oci_parse_commit_annotations (annotations, NULL, NULL, NULL,
+                                          &target_ref, NULL, NULL, NULL);
+
+  if (target_ref == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "The OCI image didn't specify a ref, use --ref to specify one");
+      return NULL;
+    }
+
+  commit_checksum = flatpak_pull_from_oci (repo, registry, NULL, oci_digest, manifest,
+                                           NULL, target_ref, NULL, NULL, cancellable, error);
+  if (commit_checksum == NULL)
+    return NULL;
+
+  g_print (_("Importing %s (%s)\n"), target_ref, commit_checksum);
+
+  return g_strdup (commit_checksum);
+}
+
+static char *
+import_bundle (OstreeRepo *repo, GFile *file,
+               GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *bundle_ref = NULL;
+  g_autofree char *to_checksum = NULL;
+  const char *ref;
+
+  /* Don’t need to check the collection ID of the bundle here;
+   * flatpak_pull_from_bundle() does that. */
+  metadata = flatpak_bundle_load (file, &to_checksum,
+                                  &bundle_ref,
+                                  NULL, NULL, NULL,
+                                  NULL, NULL, NULL, error);
+  if (metadata == NULL)
+    return NULL;
+
+  if (opt_ref != NULL)
+    ref = opt_ref;
+  else
+    ref = bundle_ref;
+
+  g_print (_("Importing %s (%s)\n"), ref, to_checksum);
+  if (!flatpak_pull_from_bundle (repo, file,
+                                 NULL, ref, FALSE,
+                                 cancellable,
+                                 error))
+    return NULL;
+
+  return g_strdup (to_checksum);
+}
+
+gboolean
+flatpak_builtin_build_import (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) file = NULL;
+  g_autoptr(GFile) repofile = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  const char *location;
+  const char *filename;
+  g_autofree char *commit = NULL;
+
+  context = g_option_context_new (_("LOCATION FILENAME - Import a file bundle into a local repository"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 3)
+    return usage_error (context, _("LOCATION and FILENAME must be specified"), error);
+
+  if (argc > 3)
+    return usage_error (context, _("Too many arguments"), error);
+
+  location = argv[1];
+  filename = argv[2];
+
+  repofile = g_file_new_for_commandline_arg (location);
+  repo = ostree_repo_new (repofile);
+
+  if (!g_file_query_exists (repofile, cancellable))
+    return flatpak_fail (error, _("'%s' is not a valid repository"), location);
+
+  file = g_file_new_for_commandline_arg (filename);
+
+  if (!ostree_repo_open (repo, cancellable, error))
+    return FALSE;
+
+  if (opt_oci)
+    commit = import_oci (repo, file, cancellable, error);
+  else
+    commit = import_bundle (repo, file, cancellable, error);
+  if (commit == NULL)
+    return FALSE;
+
+  if (opt_gpg_key_ids)
+    {
+      char **iter;
+
+      for (iter = opt_gpg_key_ids; iter && *iter; iter++)
+        {
+          const char *keyid = *iter;
+          g_autoptr(GError) local_error = NULL;
+
+          if (!ostree_repo_sign_commit (repo,
+                                        commit,
+                                        keyid,
+                                        opt_gpg_homedir,
+                                        cancellable,
+                                        &local_error))
+            {
+              if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+                {
+                  g_propagate_error (error, g_steal_pointer (&local_error));
+                  return FALSE;
+                }
+            }
+        }
+    }
+
+  if (opt_update_appstream &&
+      !flatpak_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, 0, cancellable, error))
+    return FALSE;
+
+  if (!opt_no_update_summary &&
+      !flatpak_repo_update (repo,
+                            (const char **) opt_gpg_key_ids,
+                            opt_gpg_homedir,
+                            cancellable,
+                            error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_import (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* FILENAME */
+      flatpak_complete_file (completion, "__FLATPAK_BUNDLE_FILE");
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-init.c b/app/flatpak-builtins-build-init.c
new file mode 100644 (file)
index 0000000..7d1dfb5
--- /dev/null
@@ -0,0 +1,471 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+
+static char *opt_arch;
+static char *opt_var;
+static char *opt_type;
+static char *opt_sdk_dir;
+static char **opt_sdk_extensions;
+static char **opt_tags;
+static char *opt_base;
+static char *opt_base_version;
+static char **opt_base_extensions;
+static gboolean opt_writable_sdk;
+static gboolean opt_update;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to use"), N_("ARCH") },
+  { "var", 'v', 0, G_OPTION_ARG_STRING, &opt_var, N_("Initialize var from named runtime"), N_("RUNTIME") },
+  { "base", 0, 0, G_OPTION_ARG_STRING, &opt_base, N_("Initialize apps from named app"), N_("APP") },
+  { "base-version", 0, 0, G_OPTION_ARG_STRING, &opt_base_version, N_("Specify version for --base"), N_("VERSION") },
+  { "base-extension", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_base_extensions, N_("Include this base extension"), N_("EXTENSION") },
+  { "writable-sdk", 'w', 0, G_OPTION_ARG_NONE, &opt_writable_sdk, N_("Initialize /usr with a writable copy of the sdk"), NULL },
+  { "type", 0, 0, G_OPTION_ARG_STRING, &opt_type, N_("Specify the build type (app, runtime, extension)"), N_("TYPE") },
+  { "tag", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_tags, N_("Add a tag"), N_("TAG") },
+  { "sdk-extension", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_sdk_extensions, N_("Include this sdk extension in /usr"), N_("EXTENSION") },
+  { "sdk-dir", 0, 0, G_OPTION_ARG_STRING, &opt_sdk_dir, N_("Where to store sdk (defaults to 'usr')"), N_("DIR") },
+  { "update", 0, 0, G_OPTION_ARG_NONE, &opt_update, N_("Re-initialize the sdk/var"), NULL },
+  { NULL }
+};
+
+static gboolean
+ensure_extensions (FlatpakDeploy *src_deploy, const char *default_branch,
+                 char *src_extensions[], GFile *top_dir, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GKeyFile) metakey = flatpak_deploy_get_metadata (src_deploy);
+  GList *extensions = NULL, *l;
+  int i;
+
+  /* We leak this on failure, as we have no autoptr for deep lists.. */
+  extensions = flatpak_list_extensions (metakey, opt_arch, default_branch);
+
+  for (i = 0; src_extensions[i] != NULL; i++)
+    {
+      const char *requested_extension = src_extensions[i];
+      gboolean found = FALSE;
+
+      for (l = extensions; l != NULL; l = l->next)
+        {
+          FlatpakExtension *ext = l->data;
+
+          if (strcmp (ext->installed_id, requested_extension) == 0 ||
+              strcmp (ext->id, requested_extension) == 0)
+            {
+              if (!ext->is_unmaintained)
+                {
+                  g_autoptr(FlatpakDir) src_dir = NULL;
+                  g_autoptr(GFile) deploy = NULL;
+                  g_autoptr(GVariant) deploy_data = NULL;
+                  const char **subpaths;
+
+                  deploy = flatpak_find_deploy_dir_for_ref (ext->ref, &src_dir, cancellable, error);
+                  if (deploy == NULL)
+                    return FALSE;
+                  deploy_data = flatpak_dir_get_deploy_data (src_dir, ext->ref, cancellable, error);
+                  if (deploy_data == NULL)
+                    return FALSE;
+
+                  subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+                  if (subpaths[0] != NULL)
+                    return flatpak_fail (error, _("Requested extension %s is only partially installed"), ext->installed_id);
+                }
+
+              if (top_dir)
+                {
+                  g_autoptr(GFile) target = g_file_resolve_relative_path (top_dir, ext->directory);
+                  g_autoptr(GFile) target_parent = g_file_get_parent (target);
+                  g_autoptr(GFile) ext_deploy_files = g_file_new_for_path (ext->files_path);
+
+                  if (!flatpak_mkdir_p (target_parent, cancellable, error))
+                    return FALSE;
+
+                  /* An extension overrides whatever is there before, so we clean up first */
+                  if (!flatpak_rm_rf (target, cancellable, error))
+                    return FALSE;
+
+                  if (!flatpak_cp_a (ext_deploy_files, target,
+                                     FLATPAK_CP_FLAGS_NO_CHOWN,
+                                     cancellable, error))
+                    return FALSE;
+                }
+
+              found = TRUE;
+            }
+        }
+
+      if (!found)
+        {
+          g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
+          return flatpak_fail (error, _("Requested extension %s not installed"), requested_extension);
+        }
+    }
+
+  g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) var_deploy_files = NULL;
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) files_dir = NULL;
+  g_autoptr(GFile) usr_dir = NULL;
+  g_autoptr(GFile) var_dir = NULL;
+  g_autoptr(GFile) var_tmp_dir = NULL;
+  g_autoptr(GFile) var_run_dir = NULL;
+  g_autoptr(GFile) metadata_file = NULL;
+  g_autoptr(GString) metadata_contents = NULL;
+  g_autoptr(GError) my_error = NULL;
+  g_autoptr(FlatpakDeploy) sdk_deploy = NULL;
+  const char *app_id;
+  const char *directory;
+  const char *sdk_pref;
+  const char *runtime_pref;
+  const char *default_branch = NULL;
+  g_autofree char *runtime_ref = NULL;
+  g_autofree char *var_ref = NULL;
+  g_autofree char *sdk_ref = NULL;
+  FlatpakKinds kinds;
+  int i;
+  g_autoptr(FlatpakDir) sdk_dir = NULL;
+  g_autoptr(FlatpakDir) runtime_dir = NULL;
+  gboolean is_app = FALSE;
+  gboolean is_extension = FALSE;
+  gboolean is_runtime = FALSE;
+
+  context = g_option_context_new (_("DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 5)
+    return usage_error (context, _("RUNTIME must be specified"), error);
+
+  if (argc > 6)
+    return usage_error (context, _("Too many arguments"), error);
+
+  directory = argv[1];
+  app_id = argv[2];
+  sdk_pref = argv[3];
+  runtime_pref = argv[4];
+  if (argc >= 6)
+    default_branch = argv[5];
+
+  if (opt_type != NULL)
+    {
+      if (strcmp (opt_type, "app") == 0)
+        is_app = TRUE;
+      else if (strcmp (opt_type, "extension") == 0)
+        is_extension = TRUE;
+      else if (strcmp (opt_type, "runtime") == 0)
+        is_runtime = TRUE;
+      else
+        return flatpak_fail (error, _("'%s' is not a valid build type name, use app, runtime or extension"), opt_type);
+    }
+  else
+    is_app = TRUE;
+
+  if (!flatpak_is_valid_name (app_id, &my_error))
+    return flatpak_fail (error, _("'%s' is not a valid application name: %s"), app_id, my_error->message);
+
+  kinds = FLATPAK_KINDS_RUNTIME;
+  sdk_dir = flatpak_find_installed_pref (sdk_pref, kinds, opt_arch, default_branch, TRUE, FALSE, FALSE, NULL,
+                                         &sdk_ref, cancellable, error);
+  if (sdk_dir == NULL)
+    return FALSE;
+
+  kinds = FLATPAK_KINDS_RUNTIME;
+  if (is_extension)
+    kinds |= FLATPAK_KINDS_APP;
+
+  runtime_dir = flatpak_find_installed_pref (runtime_pref, kinds, opt_arch, default_branch, TRUE, FALSE, FALSE, NULL,
+                                             &runtime_ref, cancellable, error);
+  if (runtime_dir == NULL)
+    return FALSE;
+
+  base = g_file_new_for_commandline_arg (directory);
+
+  if (!flatpak_mkdir_p (base, cancellable, error))
+    return FALSE;
+
+  files_dir = g_file_get_child (base, "files");
+  var_dir = g_file_get_child (base, "var");
+  var_tmp_dir = g_file_get_child (var_dir, "tmp");
+  var_run_dir = g_file_get_child (var_dir, "run");
+  metadata_file = g_file_get_child (base, "metadata");
+
+  if (!opt_update &&
+      g_file_query_exists (files_dir, cancellable))
+    return flatpak_fail (error, _("Build directory %s already initialized"), directory);
+
+  sdk_deploy = flatpak_dir_load_deployed (sdk_dir, sdk_ref, NULL, cancellable, error);
+  if (sdk_deploy == NULL)
+    return FALSE;
+
+  if (opt_writable_sdk || is_runtime)
+    {
+      g_autoptr(GFile) sdk_deploy_files = NULL;
+
+      if (opt_sdk_dir)
+        usr_dir = g_file_get_child (base, opt_sdk_dir);
+      else
+        usr_dir = g_file_get_child (base, "usr");
+
+      if (!flatpak_rm_rf (usr_dir, NULL, &my_error))
+        {
+          if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+            {
+              g_propagate_error (error, g_steal_pointer (&my_error));
+              return FALSE;
+            }
+
+          g_clear_error (&my_error);
+        }
+
+      sdk_deploy_files = flatpak_deploy_get_files (sdk_deploy);
+      if (!flatpak_cp_a (sdk_deploy_files, usr_dir, FLATPAK_CP_FLAGS_NO_CHOWN, cancellable, error))
+        return FALSE;
+    }
+
+  if (opt_sdk_extensions &&
+      !ensure_extensions (sdk_deploy, default_branch,
+                          opt_sdk_extensions, usr_dir, cancellable, error))
+    return FALSE;
+
+  if (opt_var)
+    {
+      var_ref = flatpak_build_runtime_ref (opt_var, default_branch, opt_arch);
+
+      var_deploy_files = flatpak_find_files_dir_for_ref (var_ref, cancellable, error);
+      if (var_deploy_files == NULL)
+        return FALSE;
+    }
+
+  if (opt_update)
+    return TRUE;
+
+  if (!g_file_make_directory (files_dir, cancellable, error))
+    return FALSE;
+
+  if (opt_base)
+    {
+      const char *base_branch;
+      g_autofree char *base_ref = NULL;
+      g_autoptr(GFile) base_deploy_files = NULL;
+      g_autoptr(FlatpakDeploy) base_deploy = NULL;
+
+      base_branch = opt_base_version ? opt_base_version : "master";
+      base_ref = flatpak_build_app_ref (opt_base, base_branch, opt_arch);
+      base_deploy = flatpak_find_deploy_for_ref (base_ref, cancellable, error);
+      if (base_deploy == NULL)
+        return FALSE;
+
+      base_deploy_files = flatpak_deploy_get_files (base_deploy);
+      if (!flatpak_cp_a (base_deploy_files, files_dir,
+                         FLATPAK_CP_FLAGS_MERGE | FLATPAK_CP_FLAGS_NO_CHOWN,
+                         cancellable, error))
+        return FALSE;
+
+
+      if (opt_base_extensions &&
+          !ensure_extensions (base_deploy, base_branch, opt_base_extensions, files_dir, cancellable, error))
+        return FALSE;
+    }
+
+  if (var_deploy_files)
+    {
+      if (!flatpak_cp_a (var_deploy_files, var_dir, FLATPAK_CP_FLAGS_NONE, cancellable, error))
+        return FALSE;
+    }
+  else
+    {
+      if (!g_file_make_directory (var_dir, cancellable, error))
+        return FALSE;
+    }
+
+  if (!flatpak_mkdir_p (var_tmp_dir, cancellable, error))
+    return FALSE;
+
+  if (!g_file_query_exists (var_run_dir, cancellable) &&
+      !g_file_make_symbolic_link (var_run_dir, "/run", cancellable, error))
+    return FALSE;
+
+
+  metadata_contents = g_string_new ("");
+  if (is_app)
+    g_string_append (metadata_contents, "[Application]\n");
+  else
+    g_string_append (metadata_contents, "[Runtime]\n");
+
+  g_string_append_printf (metadata_contents,
+                          "name=%s\n",
+                          app_id);
+
+  /* The "runtime" can be an app in case we're building an extension */
+  if (g_str_has_prefix (runtime_ref, "runtime/"))
+    g_string_append_printf (metadata_contents,
+                            "runtime=%s\n",
+                            runtime_ref + strlen ("runtime/"));
+
+  if (g_str_has_prefix (sdk_ref, "runtime/"))
+    g_string_append_printf (metadata_contents,
+                            "sdk=%s\n",
+                            sdk_ref + strlen ("runtime/"));
+
+  if (opt_tags != NULL)
+    {
+      g_string_append (metadata_contents, "tags=");
+      for (i = 0; opt_tags[i] != NULL; i++)
+        {
+          g_string_append (metadata_contents, opt_tags[i]);
+          g_string_append_c (metadata_contents, ';');
+        }
+      g_string_append_c (metadata_contents, '\n');
+    }
+
+  if (is_extension)
+    g_string_append_printf (metadata_contents,
+                            "\n"
+                            "[ExtensionOf]\n"
+                            "ref=%s\n",
+                            runtime_ref);
+
+  if (!g_file_replace_contents (metadata_file,
+                                metadata_contents->str, metadata_contents->len, NULL, FALSE,
+                                G_FILE_CREATE_REPLACE_DESTINATION,
+                                NULL, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_init (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(FlatpakDir) system_dir = NULL;
+  g_autoptr(GError) error = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* DIR */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* APP */
+      break;
+
+    case 3: /* RUNTIME */
+    case 4: /* SDK */
+      user_dir = flatpak_dir_get_user ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, NULL, NULL, opt_arch,
+                                                              FLATPAK_KINDS_RUNTIME, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[1]);
+          }
+      }
+
+      system_dir = flatpak_dir_get_system_default ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (system_dir, NULL, NULL, opt_arch,
+                                                              FLATPAK_KINDS_RUNTIME, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[1]);
+          }
+      }
+
+      break;
+
+    case 5: /* BRANCH */
+      user_dir = flatpak_dir_get_user ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, completion->argv[3], NULL, opt_arch,
+                                                              FLATPAK_KINDS_RUNTIME, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[3]);
+          }
+      }
+
+      system_dir = flatpak_dir_get_system_default ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (system_dir, completion->argv[3], NULL, opt_arch,
+                                                              FLATPAK_KINDS_RUNTIME, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[3]);
+          }
+      }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build-sign.c b/app/flatpak-builtins-build-sign.c
new file mode 100644 (file)
index 0000000..c6119b2
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+
+static char *opt_arch;
+static gboolean opt_runtime;
+static char **opt_gpg_key_ids;
+static char *opt_gpg_homedir;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to install for"), N_("ARCH") },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Look for runtime with the specified name"), NULL },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the commit with"), N_("KEY-ID") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+  { NULL }
+};
+
+
+gboolean
+flatpak_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) repofile = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  g_autoptr(GError) my_error = NULL;
+  const char *location;
+  const char *branch;
+  const char *id = NULL;
+  g_autofree char *commit_checksum = NULL;
+  int i;
+  char **iter;
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_free);
+
+  context = g_option_context_new (_("LOCATION [ID [BRANCH]] - Sign an application or runtime"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("LOCATION must be specified"), error);
+
+  if (argc > 4)
+    return usage_error (context, _("Too many arguments"), error);
+
+  location = argv[1];
+  if (argc >= 3)
+    id = argv[2];
+
+  if (argc >= 4)
+    branch = argv[3];
+  else
+    branch = "master";
+
+  if (id != NULL && !flatpak_is_valid_name (id, &my_error))
+    return flatpak_fail (error, _("'%s' is not a valid name: %s"), id, my_error->message);
+
+  if (!flatpak_is_valid_branch (branch, &my_error))
+    return flatpak_fail (error, _("'%s' is not a valid branch name: %s"), branch, my_error->message);
+
+  if (opt_gpg_key_ids == NULL)
+    return flatpak_fail (error, _("No gpg key ids specified"));
+
+  repofile = g_file_new_for_commandline_arg (location);
+  repo = ostree_repo_new (repofile);
+
+  if (!ostree_repo_open (repo, cancellable, error))
+    return FALSE;
+
+  if (id)
+    {
+      g_autofree char *ref = NULL;
+      if (opt_runtime)
+        ref = flatpak_build_runtime_ref (id, branch, opt_arch);
+      else
+        ref = flatpak_build_app_ref (id, branch, opt_arch);
+
+      g_ptr_array_add (refs, g_steal_pointer (&ref));
+    }
+  else
+    {
+      g_autoptr(GHashTable) all_refs = NULL;
+      GHashTableIter hashiter;
+      gpointer key, value;
+
+      if (!ostree_repo_list_refs_ext (repo, NULL, &all_refs,
+                                      OSTREE_REPO_LIST_REFS_EXT_NONE,
+                                      cancellable, error))
+        return FALSE;
+
+      /* Merge the prefix refs to the full refs table */
+      g_hash_table_iter_init (&hashiter, all_refs);
+      while (g_hash_table_iter_next (&hashiter, &key, &value))
+        {
+          if (g_str_has_prefix (key, "app/") ||
+              g_str_has_prefix (key, "runtime/"))
+            g_ptr_array_add (refs, g_strdup (key));
+        }
+
+    }
+
+  for (i = 0; i < refs->len; i++)
+    {
+      const char *ref = g_ptr_array_index (refs, i);
+
+      if (!ostree_repo_resolve_rev (repo, ref, FALSE, &commit_checksum, error))
+        return FALSE;
+
+      for (iter = opt_gpg_key_ids; iter && *iter; iter++)
+        {
+          const char *keyid = *iter;
+          g_autoptr(GError) local_error = NULL;
+
+          if (!ostree_repo_sign_commit (repo,
+                                        commit_checksum,
+                                        keyid,
+                                        opt_gpg_homedir,
+                                        cancellable,
+                                        &local_error))
+            {
+              if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+                {
+                  g_propagate_error (error, g_steal_pointer (&local_error));
+                  return FALSE;
+                }
+            }
+        }
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build_sign (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+
+    case 2: /* ID */
+      break;
+
+    case 3: /* BRANCH */
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-build.c b/app/flatpak-builtins-build.c
new file mode 100644 (file)
index 0000000..f40f27b
--- /dev/null
@@ -0,0 +1,480 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static gboolean opt_runtime;
+static char *opt_build_dir;
+static char **opt_bind_mounts;
+static char *opt_sdk_dir;
+static char *opt_metadata;
+static gboolean opt_log_session_bus;
+static gboolean opt_log_system_bus;
+static gboolean opt_die_with_parent;
+static gboolean opt_with_appdir;
+static gboolean opt_readonly;
+
+static GOptionEntry options[] = {
+  { "runtime", 'r', 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Use Platform runtime rather than Sdk"), NULL },
+  { "readonly", 0, 0, G_OPTION_ARG_NONE, &opt_readonly, N_("Make destination readonly"), NULL },
+  { "bind-mount", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_bind_mounts, N_("Add bind mount"), N_("DEST=SRC") },
+  { "build-dir", 0, 0, G_OPTION_ARG_STRING, &opt_build_dir, N_("Start build in this directory"), N_("DIR") },
+  { "sdk-dir", 0, 0, G_OPTION_ARG_STRING, &opt_sdk_dir, N_("Where to look for custom sdk dir (defaults to 'usr')"), N_("DIR") },
+  { "metadata", 0, 0, G_OPTION_ARG_STRING, &opt_metadata, N_("Use alternative file for the metadata"), N_("FILE") },
+  { "die-with-parent", 'p', 0, G_OPTION_ARG_NONE, &opt_die_with_parent, N_("Kill processes when the parent process dies"), NULL },
+  { "with-appdir", 0, 0, G_OPTION_ARG_NONE, &opt_with_appdir, N_("Export application homedir directory to build"), NULL },
+  { "log-session-bus", 0, 0, G_OPTION_ARG_NONE, &opt_log_session_bus, N_("Log session bus calls"), NULL },
+  { "log-system-bus", 0, 0, G_OPTION_ARG_NONE, &opt_log_system_bus, N_("Log system bus calls"), NULL },
+  { NULL }
+};
+
+/* Unset FD_CLOEXEC on the array of fds passed in @user_data */
+static void
+child_setup (gpointer user_data)
+{
+  GArray *fd_array = user_data;
+  int i;
+
+  /* If no fd_array was specified, don't care. */
+  if (fd_array == NULL)
+    return;
+
+  /* Otherwise, mark not - close-on-exec all the fds in the array */
+  for (i = 0; i < fd_array->len; i++)
+    fcntl (g_array_index (fd_array, int, i), F_SETFD, 0);
+}
+
+gboolean
+flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakDeploy) runtime_deploy = NULL;
+  g_autoptr(GVariant) runtime_deploy_data = NULL;
+  g_autoptr(FlatpakDeploy) extensionof_deploy = NULL;
+  g_autoptr(GFile) var = NULL;
+  g_autoptr(GFile) usr = NULL;
+  g_autoptr(GFile) res_deploy = NULL;
+  g_autoptr(GFile) res_files = NULL;
+  g_autoptr(GFile) app_files = NULL;
+  gboolean app_files_ro = FALSE;
+  g_autoptr(GFile) runtime_files = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_autofree char *metadata_contents = NULL;
+  g_autofree char *runtime = NULL;
+  g_autofree char *runtime_ref = NULL;
+  g_autofree char *extensionof_ref = NULL;
+  g_autofree char *extension_point = NULL;
+  g_autofree char *extension_tmpfs_point = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GKeyFile) runtime_metakey = NULL;
+  g_autoptr(FlatpakBwrap) bwrap = NULL;
+  g_auto(GStrv) minimal_envp = NULL;
+  gsize metadata_size;
+  const char *directory = NULL;
+  const char *command = "/bin/sh";
+  g_autofree char *id = NULL;
+  int i;
+  int rest_argv_start, rest_argc;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+  g_autoptr(FlatpakContext) app_context = NULL;
+  gboolean custom_usr;
+  g_auto(GStrv) runtime_ref_parts = NULL;
+  FlatpakRunFlags run_flags;
+  const char *group = NULL;
+  const char *runtime_key = NULL;
+  const char *dest = NULL;
+  gboolean is_app = FALSE;
+  gboolean is_extension = FALSE;
+  gboolean is_app_extension = FALSE;
+  g_autofree char *app_info_path = NULL;
+  g_autofree char *runtime_extensions = NULL;
+  g_autoptr(GFile) app_id_dir = NULL;
+
+  context = g_option_context_new (_("DIRECTORY [COMMAND [args...]] - Build in directory"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  rest_argc = 0;
+  for (i = 1; i < argc; i++)
+    {
+      /* The non-option is the directory, take it out of the arguments */
+      if (argv[i][0] != '-')
+        {
+          rest_argv_start = i;
+          rest_argc = argc - i;
+          argc = i;
+          break;
+        }
+    }
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (rest_argc == 0)
+    return usage_error (context, _("DIRECTORY must be specified"), error);
+
+  directory = argv[rest_argv_start];
+  if (rest_argc >= 2)
+    command = argv[rest_argv_start + 1];
+
+  res_deploy = g_file_new_for_commandline_arg (directory);
+  metadata = g_file_get_child (res_deploy, opt_metadata ? opt_metadata : "metadata");
+
+  if (!g_file_query_exists (res_deploy, NULL) ||
+      !g_file_query_exists (metadata, NULL))
+    return flatpak_fail (error, _("Build directory %s not initialized, use flatpak build-init"), directory);
+
+  if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, error))
+    return FALSE;
+
+  metakey = g_key_file_new ();
+  if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
+    return FALSE;
+
+  if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_APPLICATION))
+    {
+      group = FLATPAK_METADATA_GROUP_APPLICATION;
+      is_app = TRUE;
+    }
+  else if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_RUNTIME))
+    {
+      group = FLATPAK_METADATA_GROUP_RUNTIME;
+    }
+  else
+    return flatpak_fail (error, _("metadata invalid, not application or runtime"));
+
+  extensionof_ref = g_key_file_get_string (metakey,
+                                           FLATPAK_METADATA_GROUP_EXTENSION_OF,
+                                           FLATPAK_METADATA_KEY_REF, NULL);
+  if (extensionof_ref != NULL)
+    {
+      is_extension = TRUE;
+      if (g_str_has_prefix (extensionof_ref, "app/"))
+        is_app_extension = TRUE;
+    }
+
+
+  id = g_key_file_get_string (metakey, group, FLATPAK_METADATA_KEY_NAME, error);
+  if (id == NULL)
+    return FALSE;
+
+  if (opt_runtime)
+    runtime_key = FLATPAK_METADATA_KEY_RUNTIME;
+  else
+    runtime_key = FLATPAK_METADATA_KEY_SDK;
+
+  runtime = g_key_file_get_string (metakey, group, runtime_key, error);
+  if (runtime == NULL)
+    return FALSE;
+
+  runtime_ref = g_build_filename ("runtime", runtime, NULL);
+
+  runtime_ref_parts = flatpak_decompose_ref (runtime_ref, error);
+  if (runtime_ref_parts == NULL)
+    return FALSE;
+
+  custom_usr = FALSE;
+  usr = g_file_get_child (res_deploy,  opt_sdk_dir ? opt_sdk_dir : "usr");
+  if (g_file_query_exists (usr, cancellable))
+    {
+      custom_usr = TRUE;
+      runtime_files = g_object_ref (usr);
+    }
+  else
+    {
+      runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, cancellable, error);
+      if (runtime_deploy == NULL)
+        return FALSE;
+
+      runtime_deploy_data = flatpak_deploy_get_deploy_data (runtime_deploy, cancellable, error);
+      if (runtime_deploy_data == NULL)
+        return FALSE;
+
+      runtime_metakey = flatpak_deploy_get_metadata (runtime_deploy);
+
+      runtime_files = flatpak_deploy_get_files (runtime_deploy);
+    }
+
+  var = g_file_get_child (res_deploy, "var");
+  if (!flatpak_mkdir_p (var, cancellable, error))
+    return FALSE;
+
+  res_files = g_file_get_child (res_deploy, "files");
+
+  if (is_app)
+    {
+      app_files = g_object_ref (res_files);
+      if (opt_with_appdir)
+        app_id_dir = flatpak_ensure_data_dir (id, cancellable, NULL);
+    }
+  else if (is_extension)
+    {
+      g_autoptr(GKeyFile) x_metakey = NULL;
+      g_autofree char *x_group = NULL;
+      g_autofree char *x_dir = NULL;
+      g_autofree char *x_subdir_suffix = NULL;
+      char *x_subdir = NULL;
+      g_autofree char *bare_extension_point = NULL;
+
+      extensionof_deploy = flatpak_find_deploy_for_ref (extensionof_ref, cancellable, error);
+      if (extensionof_deploy == NULL)
+        return FALSE;
+
+      x_metakey = flatpak_deploy_get_metadata (extensionof_deploy);
+
+      x_group = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION, id, NULL);
+      if (!g_key_file_has_group (x_metakey, x_group))
+        {
+          /* Failed, look for subdirectories=true parent */
+          char *last_dot = strrchr (id, '.');
+
+          if (last_dot != NULL)
+            {
+              char *parent_id = g_strndup (id, last_dot - id);
+              g_free (x_group);
+              x_group = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION,
+                                     parent_id, NULL);
+              if (g_key_file_get_boolean (x_metakey, x_group,
+                                          FLATPAK_METADATA_KEY_SUBDIRECTORIES,
+                                          NULL))
+                x_subdir = last_dot + 1;
+            }
+
+          if (x_subdir == NULL)
+            return flatpak_fail (error, _("No extension point matching %s in %s"), id, extensionof_ref);
+        }
+
+      x_dir = g_key_file_get_string (x_metakey, x_group,
+                                     FLATPAK_METADATA_KEY_DIRECTORY, error);
+      if (x_dir == NULL)
+        return FALSE;
+
+      x_subdir_suffix = g_key_file_get_string (x_metakey, x_group,
+                                               FLATPAK_METADATA_KEY_SUBDIRECTORY_SUFFIX,
+                                               NULL);
+
+      if (is_app_extension)
+        {
+          app_files = flatpak_deploy_get_files (extensionof_deploy);
+          app_files_ro = TRUE;
+          if (x_subdir != NULL)
+            extension_tmpfs_point = g_build_filename ("/app", x_dir, NULL);
+          bare_extension_point = g_build_filename ("/app", x_dir, x_subdir, NULL);
+        }
+      else
+        {
+          if (x_subdir != NULL)
+            extension_tmpfs_point = g_build_filename ("/usr", x_dir, NULL);
+          bare_extension_point = g_build_filename ("/usr", x_dir, x_subdir, NULL);
+        }
+
+      extension_point = g_build_filename (bare_extension_point, x_subdir_suffix, NULL);
+    }
+
+  minimal_envp = flatpak_run_get_minimal_env (TRUE, FALSE);
+  bwrap = flatpak_bwrap_new (minimal_envp);
+  flatpak_bwrap_add_args (bwrap, flatpak_get_bwrap (), NULL);
+
+  run_flags =
+    FLATPAK_RUN_FLAG_DEVEL | FLATPAK_RUN_FLAG_NO_SESSION_HELPER |
+    FLATPAK_RUN_FLAG_SET_PERSONALITY | FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY;
+  if (opt_die_with_parent)
+    run_flags |= FLATPAK_RUN_FLAG_DIE_WITH_PARENT;
+  if (custom_usr)
+    run_flags |= FLATPAK_RUN_FLAG_WRITABLE_ETC;
+
+  /* Unless manually specified, we disable dbus proxy */
+  if (!flatpak_context_get_needs_session_bus_proxy (arg_context))
+    run_flags |= FLATPAK_RUN_FLAG_NO_SESSION_BUS_PROXY;
+
+  if (!flatpak_context_get_needs_system_bus_proxy (arg_context))
+    run_flags |= FLATPAK_RUN_FLAG_NO_SYSTEM_BUS_PROXY;
+
+  if (opt_log_session_bus)
+    run_flags |= FLATPAK_RUN_FLAG_LOG_SESSION_BUS;
+
+  if (opt_log_system_bus)
+    run_flags |= FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS;
+
+  /* Never set up an a11y bus for builds */
+  run_flags |= FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY;
+
+  if (!flatpak_run_setup_base_argv (bwrap, runtime_files, app_id_dir, runtime_ref_parts[2],
+                                    run_flags, error))
+    return FALSE;
+
+  flatpak_bwrap_add_args (bwrap,
+                          (custom_usr && !opt_readonly)  ? "--bind" : "--ro-bind", flatpak_file_get_path_cached (runtime_files), "/usr",
+                          NULL);
+
+  if (!custom_usr)
+    flatpak_bwrap_add_args (bwrap,
+                            "--lock-file", "/usr/.ref",
+                            NULL);
+
+  if (app_files)
+    flatpak_bwrap_add_args (bwrap,
+                            (app_files_ro || opt_readonly) ? "--ro-bind" : "--bind", flatpak_file_get_path_cached (app_files), "/app",
+                            NULL);
+  else
+    flatpak_bwrap_add_args (bwrap,
+                            "--dir", "/app",
+                            NULL);
+
+  if (extension_tmpfs_point)
+    flatpak_bwrap_add_args (bwrap,
+                            "--tmpfs", extension_tmpfs_point,
+                            NULL);
+
+  if (extension_point)
+    flatpak_bwrap_add_args (bwrap,
+                            "--bind", flatpak_file_get_path_cached (res_files), extension_point,
+                            NULL);
+
+  if (extension_point)
+    dest = extension_point;
+  else if (is_app)
+    dest = g_strdup ("/app");
+  else
+    dest = g_strdup ("/usr");
+
+  flatpak_bwrap_add_args (bwrap,
+            "--setenv", "FLATPAK_DEST", dest,
+            "--setenv", "FLATPAK_ID", id,
+            "--setenv", "FLATPAK_ARCH", runtime_ref_parts[2],
+            NULL);
+
+  app_context = flatpak_app_compute_permissions (metakey,
+                                                 runtime_metakey,
+                                                 error);
+  if (app_context == NULL)
+    return FALSE;
+
+  flatpak_context_allow_host_fs (app_context);
+  flatpak_context_merge (app_context, arg_context);
+
+  flatpak_run_apply_env_vars (bwrap, app_context);
+
+  if (!custom_usr && !(is_extension && !is_app_extension) &&
+      !flatpak_run_add_extension_args (bwrap, runtime_metakey, runtime_ref, FALSE, &runtime_extensions, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_run_add_app_info_args (bwrap,
+                                      app_files, NULL, NULL,
+                                      runtime_files, runtime_deploy_data, runtime_extensions,
+                                      id, NULL,
+                                      runtime_ref,
+                                      app_context,
+                                      &app_info_path,
+                                      error))
+    return FALSE;
+
+  if (!flatpak_run_add_environment_args (bwrap, app_info_path, run_flags, id,
+                                         app_context, app_id_dir, NULL, cancellable, error))
+    return FALSE;
+
+  /* After setup_base to avoid conflicts with /var symlinks */
+  flatpak_bwrap_add_args (bwrap,
+                          "--bind", flatpak_file_get_path_cached (var), "/var",
+                          NULL);
+
+  for (i = 0; opt_bind_mounts != NULL && opt_bind_mounts[i] != NULL; i++)
+    {
+      char *split = strchr (opt_bind_mounts[i], '=');
+      if (split == NULL)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                       _("Missing '=' in bind mount option '%s'"), opt_bind_mounts[i]);
+          return FALSE;
+        }
+
+      *split++ = 0;
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", split, opt_bind_mounts[i],
+                              NULL);
+    }
+
+  if (opt_build_dir != NULL)
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--chdir", opt_build_dir,
+                              NULL);
+    }
+
+  flatpak_bwrap_add_args (bwrap, command, NULL);
+  flatpak_bwrap_append_argsv (bwrap,
+                              &argv[rest_argv_start + 2],
+                              rest_argc - 2);
+
+  g_ptr_array_add (bwrap->argv, NULL);
+
+  /* Ensure we unset O_CLOEXEC */
+  child_setup (bwrap->fds);
+  if (execvpe (flatpak_get_bwrap (), (char **) bwrap->argv->pdata, bwrap->envp) == -1)
+    {
+      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+                   _("Unable to start app"));
+      return FALSE;
+    }
+
+  /* Not actually reached... */
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_build (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* DIR */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-config.c b/app/flatpak-builtins-config.c
new file mode 100644 (file)
index 0000000..2494f62
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ * Copyright © 2017 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "common/flatpak-dir.h"
+
+static gboolean opt_get;
+static gboolean opt_set;
+static gboolean opt_unset;
+static gboolean opt_list;
+
+static GOptionEntry options[] = {
+  { "list", 0, 0, G_OPTION_ARG_NONE, &opt_list, N_("List configuration keys and values"), NULL },
+  { "get", 0, 0, G_OPTION_ARG_NONE, &opt_get, N_("Get configuration for KEY"), NULL },
+  { "set", 0, 0, G_OPTION_ARG_NONE, &opt_set, N_("Set configuration for KEY to VALUE"), NULL },
+  { "unset", 0, 0, G_OPTION_ARG_NONE, &opt_unset, N_("Unset configuration for KEY"), NULL },
+  { NULL }
+};
+
+static char *
+parse_lang (const char *value)
+{
+  if (strcmp (value, "*") == 0 ||
+      strcmp (value, "*all*") == 0)
+    return g_strdup ("");
+  return g_strdup (value);
+}
+
+static char *
+print_lang (const char *value)
+{
+  if (*value == 0)
+    return g_strdup ("*all*");
+  return g_strdup (value);
+}
+
+static char *
+get_lang_default (FlatpakDir *dir)
+{
+  g_auto(GStrv) langs = flatpak_dir_get_default_locale_languages (dir);
+
+  return g_strjoinv (";", langs);
+}
+
+typedef struct {
+  const char *name;
+  char *(*parse)(const char *value);
+  char *(*print)(const char *value);
+  char *(*get_default)(FlatpakDir *dir);
+} ConfigKey;
+
+ConfigKey keys[] = {
+  { "languages", parse_lang, print_lang, get_lang_default },
+};
+
+static ConfigKey *
+get_config_key (const char *arg, GError **error)
+{
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS (keys); i++)
+    {
+      if (strcmp (keys[i].name, arg) == 0)
+        return &keys[i];
+    }
+
+  flatpak_fail (error, _("Unknown configure key '%s'"), arg);
+  return NULL;
+}
+
+static char *
+print_config (FlatpakDir *dir, ConfigKey *key)
+{
+  g_autofree char *value = NULL;
+
+  value = flatpak_dir_get_config (dir, key->name, NULL);
+  if (value == NULL)
+    return g_strdup ("*unset*");
+
+  return key->print (value);
+}
+
+static gboolean
+list_config (int argc, char **argv, FlatpakDir *dir, GCancellable *cancellable, GError **error)
+{
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS (keys); i++)
+    {
+      const char *key = keys[i].name;
+      g_autofree char *value = print_config (dir, &keys[i]);
+      g_autofree char *default_value = NULL;
+
+      g_print ("%s: %s", key, value);
+
+      if (keys[i].get_default)
+        default_value = keys[i].get_default (dir);
+      if (default_value)
+        {
+          g_autofree char *printed = keys[i].print (default_value);
+          g_print (" (default: %s)", printed);
+        }
+      g_print ("\n");
+    }
+
+  return TRUE;
+}
+
+static gboolean
+get_config (int argc, char **argv, FlatpakDir *dir, GCancellable *cancellable, GError **error)
+{
+  ConfigKey *key;
+  g_autofree char *value = NULL;
+
+  if (argc != 2)
+    return flatpak_fail (error, _("You must specify key"));
+
+  key = get_config_key (argv[1], error);
+  if (key == NULL)
+    return FALSE;
+
+  value = print_config (dir, key);
+  if (value)
+    g_print ("%s\n", value);
+  else
+    g_print ("*unset*\n");
+
+  return TRUE;
+}
+
+static gboolean
+set_config (int argc, char **argv, FlatpakDir *dir, GCancellable *cancellable, GError **error)
+{
+  ConfigKey *key;
+  g_autofree char *parsed = NULL;
+
+  if (argc != 3)
+    return flatpak_fail (error, _("You must specify both key and value"));
+
+  key = get_config_key (argv[1], error);
+  if (key == NULL)
+    return FALSE;
+
+  parsed = key->parse (argv[2]);
+  if (!flatpak_dir_set_config (dir, key->name, parsed, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+unset_config (int argc, char **argv, FlatpakDir *dir, GCancellable *cancellable, GError **error)
+{
+  ConfigKey *key;
+
+  if (argc != 2)
+    return flatpak_fail (error, _("You must specify key"));
+
+  key = get_config_key (argv[1], error);
+  if (key == NULL)
+    return FALSE;
+
+  if (!flatpak_dir_set_config (dir, key->name, argv[2], error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_config (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+
+  context = g_option_context_new (_("[KEY [VALUE]] - Manage configuration"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (opt_get)
+    return get_config (argc, argv, dir, cancellable, error);
+  else if (opt_set)
+    return set_config (argc, argv, dir, cancellable, error);
+  else if (opt_unset)
+    return unset_config (argc, argv, dir, cancellable, error);
+  else if (opt_list)
+    return list_config (argc, argv, dir, cancellable, error);
+  else
+    return flatpak_fail (error, _("Must specify one of --list, --get, --set or --unset"));
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_config (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* KEY */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      if (opt_set || opt_get || opt_unset)
+        {
+          int i;
+          for (i = 0; i < G_N_ELEMENTS (keys); i++)
+            flatpak_complete_word (completion, "%s", keys[i].name);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-delete-remote.c b/app/flatpak-builtins-delete-remote.c
new file mode 100644 (file)
index 0000000..f23470f
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+
+static gboolean opt_force;
+
+static GOptionEntry delete_options[] = {
+  { "force", 0, 0, G_OPTION_ARG_NONE, &opt_force, N_("Remove remote even if in use"), NULL },
+  { NULL }
+};
+
+
+gboolean
+flatpak_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(FlatpakDir) preferred_dir = NULL;
+  const char *remote_name;
+
+  context = g_option_context_new (_("NAME - Delete a remote repository"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  g_option_context_add_main_entries (context, delete_options, NULL);
+
+  if (!flatpak_option_context_parse (context, NULL, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("NAME must be specified"), error);
+
+  remote_name = argv[1];
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  if (!flatpak_resolve_duplicate_remotes (dirs, remote_name, &preferred_dir, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_remove_remote (preferred_dir, opt_force, remote_name,
+                                  cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_delete_remote (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, delete_options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* REMOTE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, delete_options);
+      flatpak_complete_options (completion, user_entries);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          int j;
+          g_auto(GStrv) remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+          if (remotes == NULL)
+            return FALSE;
+          for (j = 0; remotes[j] != NULL; j++)
+            flatpak_complete_word (completion, "%s ", remotes[j]);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-document-export.c b/app/flatpak-builtins-document-export.c
new file mode 100644 (file)
index 0000000..1a16c7b
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+#include "document-portal/xdp-dbus.h"
+
+#include <gio/gunixfdlist.h>
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static gboolean opt_unique = FALSE;
+static gboolean opt_transient = FALSE;
+static gboolean opt_noexist = FALSE;
+static gboolean opt_allow_read = TRUE;
+static gboolean opt_forbid_read = FALSE;
+static gboolean opt_allow_write = FALSE;
+static gboolean opt_forbid_write = FALSE;
+static gboolean opt_allow_delete = FALSE;
+static gboolean opt_forbid_delete = FALSE;
+static gboolean opt_allow_grant_permissions = FALSE;
+static gboolean opt_forbid_grant_permissions = FALSE;
+static char **opt_apps = NULL;
+
+static GOptionEntry options[] = {
+  { "unique", 'u', 0, G_OPTION_ARG_NONE, &opt_unique, N_("Create a unique document reference"), NULL },
+  { "transient", 't', 0, G_OPTION_ARG_NONE, &opt_transient, N_("Make the document transient for the current session"), NULL },
+  { "noexist", 'n', 0, G_OPTION_ARG_NONE, &opt_noexist, N_("Don't require the file to exist already"), NULL },
+  { "allow-read", 'r', 0, G_OPTION_ARG_NONE, &opt_allow_read, N_("Give the app read permissions"), NULL },
+  { "allow-write", 'w', 0, G_OPTION_ARG_NONE, &opt_allow_write, N_("Give the app write permissions"), NULL },
+  { "allow-delete", 'd', 0, G_OPTION_ARG_NONE, &opt_allow_delete, N_("Give the app delete permissions"), NULL },
+  { "allow-grant-permission", 'g', 0, G_OPTION_ARG_NONE, &opt_allow_grant_permissions, N_("Give the app permissions to grant further permissions"), NULL },
+  { "forbid-read", 0, 0, G_OPTION_ARG_NONE, &opt_forbid_read, N_("Revoke read permissions of the app"), NULL },
+  { "forbid-write", 0, 0, G_OPTION_ARG_NONE, &opt_forbid_write, N_("Revoke write permissions of the app"), NULL },
+  { "forbid-delete", 0, 0, G_OPTION_ARG_NONE, &opt_forbid_delete, N_("Revoke delete permissions of the app"), NULL },
+  { "forbid-grant-permission", 0, 0, G_OPTION_ARG_NONE, &opt_forbid_grant_permissions, N_("Revoke the permission to grant further permissions"), NULL },
+  { "app", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &opt_apps, N_("Add permissions for this app"), N_("APPID") },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_document_export (int argc, char **argv,
+                                 GCancellable *cancellable,
+                                 GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GVariant) reply = NULL;
+  g_autoptr(GDBusConnection) session_bus = NULL;
+  g_autoptr(GPtrArray) permissions = NULL;
+  g_autoptr(GPtrArray) revocations = NULL;
+  const char *file;
+  g_autofree char *mountpoint = NULL;
+  g_autofree char *basename = NULL;
+  g_autofree char *dirname = NULL;
+  g_autofree char *doc_path = NULL;
+  XdpDbusDocuments *documents;
+  int fd, fd_id;
+  int i;
+  GUnixFDList *fd_list = NULL;
+  const char *doc_id;
+
+  context = g_option_context_new (_("FILE - Export a file to apps"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR,
+                                     NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("FILE must be specified"), error);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  file = argv[1];
+  dirname = g_path_get_dirname (file);
+  basename = g_path_get_basename (file);
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
+  if (session_bus == NULL)
+    return FALSE;
+
+  documents = xdp_dbus_documents_proxy_new_sync (session_bus, 0,
+                                                 "org.freedesktop.portal.Documents",
+                                                 "/org/freedesktop/portal/documents",
+                                                 NULL, error);
+  if (documents == NULL)
+    return FALSE;
+
+  if (!xdp_dbus_documents_call_get_mount_point_sync (documents, &mountpoint,
+                                                     NULL, error))
+    return FALSE;
+
+  if (opt_noexist)
+    fd = open (dirname, O_PATH | O_CLOEXEC);
+  else
+    fd = open (file, O_PATH | O_CLOEXEC);
+
+  if (fd == -1)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  fd_list = g_unix_fd_list_new ();
+  fd_id = g_unix_fd_list_append (fd_list, fd, error);
+  close (fd);
+
+  if (opt_noexist)
+    {
+      reply = g_dbus_connection_call_with_unix_fd_list_sync (session_bus,
+                                                             "org.freedesktop.portal.Documents",
+                                                             "/org/freedesktop/portal/documents",
+                                                             "org.freedesktop.portal.Documents",
+                                                             "AddNamed",
+                                                             g_variant_new ("(h^aybb)", fd_id, basename, !opt_unique, !opt_transient),
+                                                             G_VARIANT_TYPE ("(s)"),
+                                                             G_DBUS_CALL_FLAGS_NONE,
+                                                             30000,
+                                                             fd_list, NULL,
+                                                             NULL,
+                                                             error);
+    }
+  else
+    {
+      reply = g_dbus_connection_call_with_unix_fd_list_sync (session_bus,
+                                                             "org.freedesktop.portal.Documents",
+                                                             "/org/freedesktop/portal/documents",
+                                                             "org.freedesktop.portal.Documents",
+                                                             "Add",
+                                                             g_variant_new ("(hbb)", fd_id, !opt_unique, !opt_transient),
+                                                             G_VARIANT_TYPE ("(s)"),
+                                                             G_DBUS_CALL_FLAGS_NONE,
+                                                             30000,
+                                                             fd_list, NULL,
+                                                             NULL,
+                                                             error);
+    }
+  g_object_unref (fd_list);
+
+  if (reply == NULL)
+    return FALSE;
+
+  g_variant_get (reply, "(&s)", &doc_id);
+
+  permissions = g_ptr_array_new ();
+  if (opt_allow_read)
+    g_ptr_array_add (permissions, "read");
+  if (opt_allow_write)
+    g_ptr_array_add (permissions, "write");
+  if (opt_allow_delete)
+    g_ptr_array_add (permissions, "delete");
+  if (opt_allow_grant_permissions)
+    g_ptr_array_add (permissions, "grant-permissions");
+  g_ptr_array_add (permissions, NULL);
+
+  revocations = g_ptr_array_new ();
+  if (opt_forbid_read)
+    g_ptr_array_add (revocations, "read");
+  if (opt_forbid_write)
+    g_ptr_array_add (revocations, "write");
+  if (opt_forbid_delete)
+    g_ptr_array_add (revocations, "delete");
+  if (opt_forbid_grant_permissions)
+    g_ptr_array_add (revocations, "grant-permissions");
+  g_ptr_array_add (revocations, NULL);
+
+  for (i = 0; opt_apps != NULL && opt_apps[i] != NULL; i++)
+    {
+      if (!xdp_dbus_documents_call_grant_permissions_sync (documents,
+                                                           doc_id,
+                                                           opt_apps[i],
+                                                           (const char **) permissions->pdata,
+                                                           NULL,
+                                                           error))
+        return FALSE;
+
+      if (!xdp_dbus_documents_call_revoke_permissions_sync (documents,
+                                                            doc_id,
+                                                            opt_apps[i],
+                                                            (const char **) revocations->pdata,
+                                                            NULL,
+                                                            error))
+        return FALSE;
+    }
+
+  doc_path = g_build_filename (mountpoint, doc_id, basename, NULL);
+  g_print ("%s\n", doc_path);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_document_export (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* FILE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_file (completion, "__FLATPAK_FILE");
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-document-info.c b/app/flatpak-builtins-document-info.c
new file mode 100644 (file)
index 0000000..bd7edc6
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+#include "document-portal/xdp-dbus.h"
+
+#include <gio/gunixfdlist.h>
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static GOptionEntry options[] = {
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_document_info (int argc, char **argv,
+                               GCancellable *cancellable,
+                               GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GDBusConnection) session_bus = NULL;
+  const char *file;
+  XdpDbusDocuments *documents;
+  g_autofree char *mountpoint = NULL;
+  g_autofree char *basename = NULL;
+  g_autofree char *doc_id = NULL;
+  g_autofree char *doc_path = NULL;
+  g_autofree char *origin = NULL;
+  const char *app_id;
+  const char **perms;
+  g_autoptr(GVariant) apps = NULL;
+  g_autoptr(GVariantIter) iter = NULL;
+
+  context = g_option_context_new (_("FILE - Get information about an exported file"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR,
+                                     NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("FILE must be specified"), error);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  file = argv[1];
+  basename = g_path_get_basename (file);
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
+  if (session_bus == NULL)
+    return FALSE;
+
+  documents = xdp_dbus_documents_proxy_new_sync (session_bus, 0,
+                                                 "org.freedesktop.portal.Documents",
+                                                 "/org/freedesktop/portal/documents",
+                                                 NULL, error);
+  if (documents == NULL)
+    return FALSE;
+
+  if (!xdp_dbus_documents_call_get_mount_point_sync (documents, &mountpoint,
+                                                     NULL, error))
+    return FALSE;
+
+  if (!xdp_dbus_documents_call_lookup_sync (documents, file, &doc_id, NULL, error))
+    return FALSE;
+
+  if (strcmp (doc_id, "") == 0)
+    {
+      g_print (_("Not exported\n"));
+      return TRUE;
+    }
+
+  doc_path = g_build_filename (mountpoint, doc_id, basename, NULL);
+
+  if (!xdp_dbus_documents_call_info_sync (documents, doc_id, &origin, &apps,
+                                          NULL, error))
+    return FALSE;
+
+  iter = g_variant_iter_new (apps);
+
+  g_print ("id: %s\n", doc_id);
+  g_print ("path: %s\n", doc_path);
+  g_print ("origin: %s\n", origin);
+  if (g_variant_iter_n_children (iter) > 0)
+    g_print ("permissions:\n");
+  while (g_variant_iter_next (iter, "{&s^a&s}", &app_id, &perms))
+    {
+      int i;
+      g_print ("\t%s\t", app_id);
+      for (i = 0; perms[i]; i++)
+        {
+          if (i > 0)
+            g_print (", ");
+          g_print ("%s", perms[i]);
+        }
+      g_print ("\n");
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_document_info (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* FILE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_file (completion, "__FLATPAK_FILE");
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-document-list.c b/app/flatpak-builtins-document-list.c
new file mode 100644 (file)
index 0000000..4644086
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+#include "document-portal/xdp-dbus.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static GOptionEntry options[] = {
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_document_list (int argc, char **argv,
+                               GCancellable *cancellable,
+                               GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GDBusConnection) session_bus = NULL;
+  XdpDbusDocuments *documents;
+  g_autoptr(GVariant) apps = NULL;
+  g_autoptr(GVariantIter) iter = NULL;
+  const char *app_id;
+  const char *id;
+  const char *path;
+
+  context = g_option_context_new (_("[APPID] - List exported files"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR,
+                                     NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    app_id = "";
+  else
+    app_id = argv[1];
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
+  if (session_bus == NULL)
+    return FALSE;
+
+  documents = xdp_dbus_documents_proxy_new_sync (session_bus, 0,
+                                                 "org.freedesktop.portal.Documents",
+                                                 "/org/freedesktop/portal/documents",
+                                                 NULL, error);
+
+  if (documents == NULL)
+    return FALSE;
+
+
+  if (!xdp_dbus_documents_call_list_sync (documents, app_id, &apps, NULL, error))
+    return FALSE;
+
+  iter = g_variant_iter_new (apps);
+
+  while (g_variant_iter_next (iter, "{&s^&ay}", &id, &path))
+    g_print ("%s\t%s\n", id, path);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_document_list (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(FlatpakDir) system_dir = NULL;
+  g_autoptr(GError) error = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* APPID */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      user_dir = flatpak_dir_get_user ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, NULL, NULL, NULL,
+                                                              FLATPAK_KINDS_APP, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[1]);
+          }
+      }
+
+      system_dir = flatpak_dir_get_system_default ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (system_dir, NULL, NULL, NULL,
+                                                              FLATPAK_KINDS_APP, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[1]);
+          }
+      }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-document-unexport.c b/app/flatpak-builtins-document-unexport.c
new file mode 100644 (file)
index 0000000..8efeeb7
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+#include "document-portal/xdp-dbus.h"
+
+#include <gio/gunixfdlist.h>
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static GOptionEntry options[] = {
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_document_unexport (int argc, char **argv,
+                                   GCancellable *cancellable,
+                                   GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GDBusConnection) session_bus = NULL;
+  XdpDbusDocuments *documents;
+  const char *file;
+  g_autofree char *doc_id = NULL;
+
+  context = g_option_context_new (_("FILE - Unexport a file to apps"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR,
+                                     NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("FILE must be specified"), error);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  file = argv[1];
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
+  if (session_bus == NULL)
+    return FALSE;
+
+  documents = xdp_dbus_documents_proxy_new_sync (session_bus, 0,
+                                                 "org.freedesktop.portal.Documents",
+                                                 "/org/freedesktop/portal/documents",
+                                                 NULL, error);
+  if (documents == NULL)
+    return FALSE;
+
+  if (!xdp_dbus_documents_call_lookup_sync (documents, file, &doc_id, NULL, error))
+    return FALSE;
+
+  if (strcmp (doc_id, "") == 0)
+    {
+      g_print (_("Not exported\n"));
+      return TRUE;
+    }
+
+  if (!xdp_dbus_documents_call_delete_sync (documents, doc_id, NULL, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_document_unexport (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* FILE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_file (completion, "__FLATPAK_FILE");
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-enter.c b/app/flatpak-builtins-enter.c
new file mode 100644 (file)
index 0000000..e49a424
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-dbus.h"
+#include "flatpak-run.h"
+
+
+static GOptionEntry options[] = {
+  { NULL }
+};
+
+
+gboolean
+flatpak_builtin_enter (int           argc,
+                       char        **argv,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  int rest_argv_start, rest_argc;
+  const char *ns_name[] = { "ipc", "net", "pid", "mnt", "user" };
+  int ns_fd[G_N_ELEMENTS (ns_name)];
+  char pid_ns[256] = { 0 };
+  ssize_t pid_ns_len;
+  char self_ns[256];
+  ssize_t self_ns_len;
+  char *pid_s;
+  int pid, i;
+  g_autofree char *environment_path = NULL;
+  g_autoptr(GPtrArray) argv_array = NULL;
+  g_autoptr(GPtrArray) envp_array = NULL;
+  g_autofree char *environment = NULL;
+  gsize environment_len;
+  char *e;
+  g_autofree char *pulse_path = NULL;
+  g_autofree char *session_bus_path = NULL;
+  g_autofree char *xdg_runtime_dir = NULL;
+  g_autofree char *stat_path = NULL;
+  g_autofree char *root_path = NULL;
+  char root_link[256] = { 0 };
+  gssize root_link_len;
+  g_autofree char *cwd_path = NULL;
+  char cwd_link[256] = { 0 };
+  gssize cwd_link_len;
+  int status;
+  struct stat stat_buf;
+  uid_t uid;
+  gid_t gid;
+
+  context = g_option_context_new (_("SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  rest_argc = 0;
+  for (i = 1; i < argc; i++)
+    {
+      /* The non-option is the command, take it out of the arguments */
+      if (argv[i][0] != '-')
+        {
+          rest_argv_start = i;
+          rest_argc = argc - i;
+          argc = i;
+          break;
+        }
+    }
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (rest_argc < 2)
+    {
+      usage_error (context, _("SANDBOXEDPID and COMMAND must be specified"), error);
+      return FALSE;
+    }
+
+  /* Before further checks, warn if we are not already root */
+  if (geteuid () != 0)
+    g_printerr ("%s\n", _("Not running as root, may be unable to enter namespace"));
+
+  pid_s = argv[rest_argv_start];
+
+  pid = atoi (pid_s);
+  if (pid <= 0)
+    return flatpak_fail (error, _("Invalid pid %s"), pid_s);
+
+  stat_path = g_strdup_printf ("/proc/%d/root", pid);
+  if (stat (stat_path, &stat_buf))
+    return flatpak_fail (error, _("No such pid %s"), pid_s);
+
+  uid = stat_buf.st_uid;
+  gid = stat_buf.st_gid;
+
+  environment_path = g_strdup_printf ("/proc/%d/environ", pid);
+  if (!g_file_get_contents (environment_path, &environment, &environment_len, error))
+    return FALSE;
+
+  cwd_path = g_strdup_printf ("/proc/%d/cwd", pid);
+  cwd_link_len = readlink (cwd_path, cwd_link, sizeof (cwd_link) - 1);
+  if (cwd_link_len <= 0)
+    return flatpak_fail (error, _("Can't read cwd"));
+
+  root_path = g_strdup_printf ("/proc/%d/root", pid);
+  root_link_len = readlink (root_path, root_link, sizeof (root_link) - 1);
+  if (root_link_len <= 0)
+    return flatpak_fail (error, _("Can't read root"));
+
+  for (i = 0; i < G_N_ELEMENTS (ns_name); i++)
+    {
+      g_autofree char *path = g_strdup_printf ("/proc/%d/ns/%s", pid, ns_name[i]);
+      g_autofree char *self_path = g_strdup_printf ("/proc/self/ns/%s", ns_name[i]);
+
+      pid_ns_len = readlink (path, pid_ns, sizeof (pid_ns) - 1);
+      if (pid_ns_len <= 0)
+        return flatpak_fail (error, _("Invalid %s namespace for pid %d"), ns_name[i], pid);
+      pid_ns[pid_ns_len] = 0;
+
+      self_ns_len = readlink (self_path, self_ns, sizeof (self_ns) - 1);
+      if (self_ns_len <= 0)
+        return flatpak_fail (error, _("Invalid %s namespace for self"), ns_name[i]);
+      self_ns[self_ns_len] = 0;
+
+      if (strcmp (self_ns, pid_ns) == 0)
+        {
+          /* No need to setns to the same namespace, it will only fail */
+          ns_fd[i] = -1;
+        }
+      else
+        {
+          ns_fd[i] = open (path, O_RDONLY);
+          if (ns_fd[i] == -1)
+            return flatpak_fail (error, _("Can't open %s namespace: %s"), ns_name[i], g_strerror (errno));
+        }
+    }
+
+  for (i = 0; i < G_N_ELEMENTS (ns_fd); i++)
+    {
+      if (ns_fd[i] != -1)
+        {
+          if (setns (ns_fd[i], 0) == -1)
+            return flatpak_fail (error, _("Can't enter %s namespace: %s"), ns_name[i], g_strerror (errno));
+          close (ns_fd[i]);
+        }
+    }
+
+  if (chdir (cwd_link))
+    return flatpak_fail (error, _("Can't chdir"));
+
+  if (chroot (root_link))
+    return flatpak_fail (error, _("Can't chroot"));
+
+  envp_array = g_ptr_array_new_with_free_func (g_free);
+  for (e = environment; e < environment + environment_len; e = e + strlen (e) + 1)
+    {
+      if (*e != 0 &&
+          !g_str_has_prefix (e, "DISPLAY=") &&
+          !g_str_has_prefix (e, "PULSE_SERVER=") &&
+          !g_str_has_prefix (e, "PULSE_CLIENTCONFIG=") &&
+          !g_str_has_prefix (e, "XDG_RUNTIME_DIR=") &&
+          !g_str_has_prefix (e, "DBUS_SYSTEM_BUS_ADDRESS=") &&
+          !g_str_has_prefix (e, "DBUS_SESSION_BUS_ADDRESS="))
+        {
+          if (g_str_has_prefix (e, "_LD_LIBRARY_PATH="))
+            e++;
+          g_ptr_array_add (envp_array, g_strdup (e));
+        }
+    }
+
+  xdg_runtime_dir = g_strdup_printf ("/run/user/%d", uid);
+  g_ptr_array_add (envp_array, g_strdup_printf ("XDG_RUNTIME_DIR=%s", xdg_runtime_dir));
+
+  if (g_file_test ("/tmp/.X11-unix/X99", G_FILE_TEST_EXISTS))
+    g_ptr_array_add (envp_array, g_strdup ("DISPLAY=:99.0"));
+
+  pulse_path = g_strdup_printf ("/run/user/%d/pulse/native", uid);
+  if (g_file_test (pulse_path, G_FILE_TEST_EXISTS))
+    {
+      g_ptr_array_add (envp_array, g_strdup_printf ("PULSE_SERVER=unix:%s", pulse_path));
+      g_ptr_array_add (envp_array, g_strdup_printf ("PULSE_CLIENTCONFIG=/run/user/%d/pulse/config", uid));
+    }
+
+  session_bus_path = g_strdup_printf ("/run/user/%d/bus", uid);
+  if (g_file_test (session_bus_path, G_FILE_TEST_EXISTS))
+    g_ptr_array_add (envp_array, g_strdup_printf ("DBUS_SESSION_BUS_ADDRESS=unix:%s", session_bus_path));
+
+  if (g_file_test ("/run/dbus/system_bus_socket", G_FILE_TEST_EXISTS))
+    g_ptr_array_add (envp_array, g_strdup ("DBUS_SYSTEM_BUS_ADDRESS=unix:/run/dbus/system_bus_socket"));
+
+  g_ptr_array_add (envp_array, NULL);
+
+  argv_array = g_ptr_array_new_with_free_func (g_free);
+  for (i = 1; i < rest_argc; i++)
+    g_ptr_array_add (argv_array, g_strdup (argv[rest_argv_start + i]));
+  g_ptr_array_add (argv_array, NULL);
+
+  if (setgid (gid))
+    return flatpak_fail (error, _("Can't switch gid"));
+
+  if (setuid (uid))
+    return flatpak_fail (error, _("Can't switch uid"));
+
+  if (!g_spawn_sync (NULL, (char **) argv_array->pdata, (char **) envp_array->pdata,
+                     G_SPAWN_SEARCH_PATH_FROM_ENVP | G_SPAWN_CHILD_INHERITS_STDIN,
+                     NULL, NULL,
+                     NULL, NULL,
+                     &status, error))
+    return FALSE;
+
+  exit (status);
+}
+
+gboolean
+flatpak_complete_enter (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1:
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      break;
+
+    default:
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-info-remote.c b/app/flatpak-builtins-info-remote.c
new file mode 100644 (file)
index 0000000..2c69d5e
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * Copyright © 2017 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+#include "flatpak-table-printer.h"
+
+static char *opt_arch;
+static char *opt_commit;
+static gboolean opt_runtime;
+static gboolean opt_app;
+static gboolean opt_show_ref;
+static gboolean opt_show_commit;
+static gboolean opt_show_parent;
+static gboolean opt_show_metadata;
+static gboolean opt_log;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to install for"), N_("ARCH") },
+  { "commit", 0, 0, G_OPTION_ARG_STRING, &opt_commit, N_("Commit to show info for"), N_("COMMIT") },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Look for runtime with the specified name"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Look for app with the specified name"), NULL },
+  { "log", 0, 0, G_OPTION_ARG_NONE, &opt_log, N_("Display log"), NULL },
+  { "show-ref", 'r', 0, G_OPTION_ARG_NONE, &opt_show_ref, N_("Show ref"), NULL },
+  { "show-commit", 'c', 0, G_OPTION_ARG_NONE, &opt_show_commit, N_("Show commit"), NULL },
+  { "show-parent", 'p', 0, G_OPTION_ARG_NONE, &opt_show_parent, N_("Show parent"), NULL },
+  { "show-metadata", 'm', 0, G_OPTION_ARG_NONE, &opt_show_metadata, N_("Show metadata"), NULL },
+  { NULL }
+};
+
+static void
+maybe_print_space (gboolean *first)
+{
+  if (*first)
+    *first = FALSE;
+  else
+    g_print (" ");
+}
+
+static gchar *
+format_timestamp (guint64  timestamp)
+{
+  GDateTime *dt;
+  gchar *str;
+
+  dt = g_date_time_new_from_unix_utc (timestamp);
+  if (dt == NULL)
+    return g_strdup ("?");
+
+  str = g_date_time_format (dt, "%Y-%m-%d %H:%M:%S +0000");
+  g_date_time_unref (dt);
+
+  return str;
+}
+
+
+gboolean
+flatpak_builtin_info_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(FlatpakDir) preferred_dir = NULL;
+  g_autoptr(GVariant) commit_v = NULL;
+  g_autoptr(GVariant) commit_metadata = NULL;
+  const char *remote;
+  const char *pref;
+  g_autofree char *default_branch = NULL;
+  FlatpakKinds kinds;
+  FlatpakKinds matched_kinds;
+  g_autofree char *id = NULL;
+  g_autofree char *arch = NULL;
+  g_autofree char *branch = NULL;
+  g_auto(GStrv) parts = NULL;
+  FlatpakKinds kind;
+  g_autofree char *ref = NULL;
+  g_autofree char *commit = NULL;
+  g_autofree char *parent = NULL;
+  const char *on = "";
+  const char *off = "";
+  gboolean friendly = TRUE;
+  const char *xa_metadata = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  guint64 installed_size = 0;
+  guint64 download_size = 0;
+  g_autofree char *formatted_installed_size = NULL;
+  g_autofree char *formatted_download_size = NULL;
+  const gchar *subject;
+  const gchar *body;
+  guint64 timestamp;
+  g_autofree char *formatted_timestamp = NULL;
+
+  context = g_option_context_new (_(" REMOTE REF - Show information about an application or runtime in a remote"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (!opt_app && !opt_runtime)
+    opt_app = opt_runtime = TRUE;
+
+  if (argc < 3)
+    return usage_error (context, _("REMOTE and REF must be specified"), error);
+
+  remote = argv[1];
+  pref = argv[2];
+
+  if (!flatpak_resolve_duplicate_remotes (dirs, remote, &preferred_dir, cancellable, error))
+    return FALSE;
+
+  default_branch = flatpak_dir_get_remote_default_branch (preferred_dir, remote);
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  if (!flatpak_split_partial_ref_arg (pref, kinds, opt_arch, NULL,
+                                      &matched_kinds, &id, &arch, &branch, error))
+    return FALSE;
+
+  ref = flatpak_dir_find_remote_ref (preferred_dir, remote, id, branch, default_branch, arch,
+                                     matched_kinds, &kind, cancellable, error);
+  if (ref == NULL)
+    return FALSE;
+
+  commit_v = flatpak_dir_fetch_remote_commit (preferred_dir, remote, ref, opt_commit, &commit, cancellable, error);
+  if (commit_v == NULL)
+    return FALSE;
+
+  if (flatpak_fancy_output ())
+    {
+      on = FLATPAK_ANSI_BOLD_ON;
+      off = FLATPAK_ANSI_BOLD_OFF; /* bold off */
+    }
+
+  if (opt_show_ref || opt_show_commit || opt_show_parent || opt_show_metadata)
+    friendly = FALSE;
+
+  if (friendly)
+    {
+      g_variant_get (commit_v, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL,
+                     &subject, &body, NULL, NULL, NULL);
+
+      parent = ostree_commit_get_parent (commit_v);
+      timestamp = ostree_commit_get_timestamp (commit_v);
+
+      commit_metadata = g_variant_get_child_value (commit_v, 0);
+      g_variant_lookup (commit_metadata, "xa.metadata", "&s", &xa_metadata);
+      if (xa_metadata == NULL)
+        return flatpak_fail (error, "Commit has no metadata");
+
+      if (g_variant_lookup (commit_metadata, "xa.installed-size", "t", &installed_size))
+        installed_size = GUINT64_FROM_BE (installed_size);
+
+      if (g_variant_lookup (commit_metadata, "xa.download-size", "t", &download_size))
+        download_size = GUINT64_FROM_BE (download_size);
+
+      metakey = g_key_file_new ();
+      if (!g_key_file_load_from_data (metakey, xa_metadata, -1, 0, error))
+        return FALSE;
+
+      parts = g_strsplit (ref, "/", 0);
+      formatted_installed_size = g_format_size (installed_size);
+      formatted_download_size = g_format_size (download_size);
+      formatted_timestamp = format_timestamp (timestamp);
+
+      g_print ("%s%s%s %s\n", on, _("Ref:"), off, ref);
+      g_print ("%s%s%s %s\n", on, _("ID:"), off, parts[1]);
+      g_print ("%s%s%s %s\n", on, _("Arch:"), off, parts[2]);
+      g_print ("%s%s%s %s\n", on, _("Branch:"), off, parts[3]);
+      g_print ("%s%s%s %s\n", on, _("Date:"), off, formatted_timestamp);
+      g_print ("%s%s%s %s\n", on, _("Subject:"), off, subject);
+      g_print ("%s%s%s %s\n", on, _("Commit:"), off, commit);
+      g_print ("%s%s%s %s\n", on, _("Parent:"), off, parent ? parent : "-");
+      g_print ("%s%s%s %s\n", on, _("Download size:"), off, formatted_download_size);
+      g_print ("%s%s%s %s\n", on, _("Installed size:"), off, formatted_installed_size);
+      if (strcmp (parts[0], "app") == 0)
+        {
+          g_autofree char *runtime = NULL;
+          runtime = g_key_file_get_string (metakey, "Application", "runtime", error);
+          g_print ("%s%s%s %s\n", on, _("Runtime:"), off, runtime ? runtime : "-");
+        }
+
+      if (opt_log)
+        {
+          g_autofree char *p = g_strdup (parent);
+
+          g_print ("%s%s%s", on, _("History:\n"), off);
+
+          while (p)
+            {
+              g_autofree char *p_parent = NULL;
+              const gchar *p_subject;
+              guint64 p_timestamp;
+              g_autofree char *p_formatted_timestamp = NULL;
+              g_autoptr(GVariant) p_commit_v = NULL;
+
+              p_commit_v = flatpak_dir_fetch_remote_commit (preferred_dir, remote, ref, p, NULL, cancellable, NULL);
+              if (p_commit_v == NULL)
+                break;
+
+              p_parent = ostree_commit_get_parent (p_commit_v);
+              p_timestamp = ostree_commit_get_timestamp (p_commit_v);
+              p_formatted_timestamp = format_timestamp (p_timestamp);
+
+              g_variant_get (p_commit_v, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL,
+                             &p_subject, NULL, NULL, NULL, NULL);
+
+              g_print ("%s%s%s %s\n", on, _(" Subject:"), off, p_subject);
+              g_print ("%s%s%s %s\n", on, _(" Date:"), off, p_formatted_timestamp);
+              g_print ("%s%s%s %s\n", on, _(" Commit:"), off, p);
+
+              g_free (p);
+              p = g_steal_pointer (&p_parent);
+              if (p)
+                g_print ("\n");
+            }
+        }
+    }
+  else
+    {
+      g_autoptr(GVariant) c_v = g_variant_ref (commit_v);
+      g_autofree char *c = g_strdup (commit);
+
+      do
+        {
+          g_autofree char *p = ostree_commit_get_parent (c_v);
+          gboolean first = TRUE;
+
+          if (opt_show_ref)
+            {
+              maybe_print_space (&first);
+              g_print ("%s", ref);
+            }
+
+          if (opt_show_commit)
+            {
+              maybe_print_space (&first);
+              g_print ("%s", c);
+            }
+
+          if (opt_show_parent)
+            {
+              maybe_print_space (&first);
+              g_print ("%s", p ? p : "-");
+            }
+
+          if (!first)
+            g_print ("\n");
+
+          if (opt_show_metadata)
+            g_print ("%s", xa_metadata);
+
+          g_free (c);
+          c = g_steal_pointer (&p);
+
+          g_variant_unref (c_v);
+          c_v = NULL;
+
+          if (c && opt_log)
+            c_v = flatpak_dir_fetch_remote_commit (preferred_dir, remote, ref, c, NULL, cancellable, NULL);
+        }
+      while (c_v != NULL);
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_info_remote (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakKinds kinds;
+  int i;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* REMOTE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          int j;
+          g_auto(GStrv) remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+          if (remotes == NULL)
+            return FALSE;
+          for (j = 0; remotes[j] != NULL; j++)
+            flatpak_complete_word (completion, "%s ", remotes[j]);
+        }
+
+      break;
+
+    default: /* REF */
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          flatpak_complete_partial_ref (completion, kinds, opt_arch, dir, completion->argv[1]);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-info.c b/app/flatpak-builtins-info.c
new file mode 100644 (file)
index 0000000..404d1ca
--- /dev/null
@@ -0,0 +1,389 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-builtins-utils.h"
+
+static gboolean opt_user;
+static gboolean opt_system;
+static gboolean opt_show_ref;
+static gboolean opt_show_commit;
+static gboolean opt_show_origin;
+static gboolean opt_show_size;
+static gboolean opt_show_metadata;
+static gboolean opt_show_extensions;
+static char *opt_arch;
+static char **opt_installations;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to use"), N_("ARCH") },
+  { "user", 0, 0, G_OPTION_ARG_NONE, &opt_user, N_("Show user installations"), NULL },
+  { "system", 0, 0, G_OPTION_ARG_NONE, &opt_system, N_("Show system-wide installations"), NULL },
+  { "installation", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_installations, N_("Show specific system-wide installations"), NULL },
+  { "show-ref", 'r', 0, G_OPTION_ARG_NONE, &opt_show_ref, N_("Show ref"), NULL },
+  { "show-commit", 'c', 0, G_OPTION_ARG_NONE, &opt_show_commit, N_("Show commit"), NULL },
+  { "show-origin", 'o', 0, G_OPTION_ARG_NONE, &opt_show_origin, N_("Show origin"), NULL },
+  { "show-size", 's', 0, G_OPTION_ARG_NONE, &opt_show_size, N_("Show size"), NULL },
+  { "show-metadata", 'm', 0, G_OPTION_ARG_NONE, &opt_show_metadata, N_("Show metadata"), NULL },
+  { "show-extensions", 'e', 0, G_OPTION_ARG_NONE, &opt_show_extensions, N_("Show extensions"), NULL },
+  { NULL }
+};
+
+/* Print space unless this is the first item */
+static void
+maybe_print_space (gboolean *first)
+{
+  if (*first)
+    *first = FALSE;
+  else
+    g_print (" ");
+}
+
+static gchar *
+format_timestamp (guint64  timestamp)
+{
+  GDateTime *dt;
+  gchar *str;
+
+  dt = g_date_time_new_from_unix_utc (timestamp);
+  if (dt == NULL)
+    return g_strdup ("?");
+
+  str = g_date_time_format (dt, "%Y-%m-%d %H:%M:%S +0000");
+  g_date_time_unref (dt);
+
+  return str;
+}
+
+gboolean
+flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autofree char *ref = NULL;
+  FlatpakDir *dir = NULL;
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autoptr(FlatpakDeploy) deploy = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  const char *commit = NULL;
+  const char *alt_id = NULL;
+  const char *pref = NULL;
+  const char *default_branch = NULL;
+  const char *origin = NULL;
+  guint64 size;
+  gboolean search_all = FALSE;
+  gboolean first = TRUE;
+  FlatpakKinds kinds;
+  const char *on = "";
+  const char *off = "";
+  g_auto(GStrv) parts = NULL;
+  g_autofree char *path = NULL;
+  g_autofree char *formatted = NULL;
+  gboolean friendly = TRUE;
+  g_autofree const char **subpaths = NULL;
+
+  context = g_option_context_new (_("NAME [BRANCH] - Get info about installed app and/or runtime"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("NAME must be specified"), error);
+  pref = argv[1];
+
+  if (argc >= 3)
+    default_branch = argv[2];
+
+  if (argc > 3)
+    return usage_error (context, _("Too many arguments"), error);
+
+  kinds = FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME;
+
+  if (!opt_user && !opt_system && opt_installations == NULL)
+    search_all = TRUE;
+
+  dir = flatpak_find_installed_pref (pref, kinds, opt_arch, default_branch,
+                                     search_all, opt_user, opt_system, opt_installations,
+                                     &ref, cancellable, error);
+  if (dir == NULL)
+    return FALSE;
+
+  deploy_data = flatpak_dir_get_deploy_data (dir, ref, cancellable, error);
+  if (deploy_data == NULL)
+    return FALSE;
+
+  deploy = flatpak_find_deploy_for_ref (ref, NULL, error);
+  if (deploy == NULL)
+    return FALSE;
+
+  if (flatpak_fancy_output ())
+    {
+      on = FLATPAK_ANSI_BOLD_ON;
+      off = FLATPAK_ANSI_BOLD_OFF; /* bold off */
+    }
+
+  parts = g_strsplit (ref, "/", 0);
+
+  commit = flatpak_deploy_data_get_commit (deploy_data);
+  alt_id = flatpak_deploy_data_get_alt_id (deploy_data);
+  origin = flatpak_deploy_data_get_origin (deploy_data);
+  size = flatpak_deploy_data_get_installed_size (deploy_data);
+  formatted = g_format_size (size);
+  path = g_file_get_path (flatpak_deploy_get_dir (deploy));
+  subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+
+  metakey = flatpak_deploy_get_metadata (deploy);
+
+  if (opt_show_ref || opt_show_origin || opt_show_commit || opt_show_size || opt_show_metadata)
+    friendly = FALSE;
+
+  if (friendly)
+    {
+      g_autoptr(GVariant) commit_v = NULL;
+      guint64 timestamp;
+      g_autofree char *formatted_timestamp = NULL;
+      const gchar *subject = NULL;
+      const gchar *body = NULL;
+      g_autofree char *parent = NULL;
+      const char *latest;
+
+      latest = flatpak_dir_read_latest (dir, origin, ref, NULL, NULL, NULL);
+      if (latest == NULL)
+        latest = _("ref not present in origin");
+
+      if (ostree_repo_load_commit (flatpak_dir_get_repo (dir), commit, &commit_v, NULL, NULL))
+        {
+          g_variant_get (commit_v, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL,
+                         &subject, &body, NULL, NULL, NULL);
+          parent = ostree_commit_get_parent (commit_v);
+          timestamp = ostree_commit_get_timestamp (commit_v);
+          formatted_timestamp = format_timestamp (timestamp);
+        }
+
+      g_print ("%s%s%s %s\n", on, _("Ref:"), off, ref);
+      g_print ("%s%s%s %s\n", on, _("ID:"), off, parts[1]);
+      g_print ("%s%s%s %s\n", on, _("Arch:"), off, parts[2]);
+      g_print ("%s%s%s %s\n", on, _("Branch:"), off, parts[3]);
+      g_print ("%s%s%s %s\n", on, _("Origin:"), off, origin ? origin : "-");
+      if (formatted_timestamp)
+        g_print ("%s%s%s %s\n", on, _("Date:"), off, formatted_timestamp);
+      if (subject)
+        g_print ("%s%s%s %s\n", on, _("Subject:"), off, subject);
+
+      if (strcmp (commit, latest) != 0)
+        {
+          g_print ("%s%s%s %s\n", on, _("Active commit:"), off, commit);
+          g_print ("%s%s%s %s\n", on, _("Latest commit:"), off, latest);
+        }
+      else
+        g_print ("%s%s%s %s\n", on, _("Commit:"), off, commit);
+      if (alt_id)
+        g_print ("%s%s%s %s\n", on, _("alt-id:"), off, alt_id);
+      g_print ("%s%s%s %s\n", on, _("Parent:"), off, parent ? parent : "-");
+      g_print ("%s%s%s %s\n", on, _("Location:"), off, path);
+      g_print ("%s%s%s %s\n", on, _("Installed size:"), off, formatted);
+      if (strcmp (parts[0], "app") == 0)
+        {
+          g_autofree char *runtime = NULL;
+          runtime = g_key_file_get_string (metakey, "Application", "runtime", error);
+          g_print ("%s%s%s %s\n", on, _("Runtime:"), off, runtime ? runtime : "-");
+        }
+      if (subpaths[0] != NULL)
+        {
+          int i;
+          g_print ("%s%s%s ", on, _("Installed subdirectories:"), off);
+          for (i = 0; subpaths[i] != NULL; i++)
+            g_print (i == 0 ? "%s" : ",%s", subpaths[i]);
+          g_print ("\n");
+        }
+    }
+  else
+    {
+      if (opt_show_ref)
+        {
+          maybe_print_space (&first);
+          g_print ("%s", ref);
+        }
+
+      if (opt_show_origin)
+        {
+          maybe_print_space (&first);
+          g_print ("%s", origin ? origin : "-");
+        }
+
+      if (opt_show_commit)
+        {
+          maybe_print_space (&first);
+          g_print ("%s", commit);
+        }
+
+      if (opt_show_size)
+        {
+          maybe_print_space (&first);
+          g_print ("%s", formatted);
+        }
+
+      if (!first)
+        g_print ("\n");
+
+      if (opt_show_metadata)
+        {
+          g_autoptr(GFile) deploy_dir = NULL;
+          g_autoptr(GFile) file = NULL;
+          g_autofree char *data = NULL;
+          gsize data_size;
+
+          deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable);
+          file = g_file_get_child (deploy_dir, "metadata");
+
+          if (!g_file_load_contents (file, cancellable, &data, &data_size, NULL, error))
+            return FALSE;
+
+          g_print ("%s", data);
+        }
+    }
+
+  if (opt_show_extensions)
+    {
+       GList *extensions, *l;
+
+       extensions = flatpak_list_extensions (metakey, parts[2], parts[3]);
+       for (l = extensions; l; l = l->next)
+         {
+           FlatpakExtension *ext = l->data;
+           g_autofree const char **subpaths = NULL;
+           g_autoptr(GVariant) ext_deploy_data = NULL;
+           g_autofree char *formatted = NULL;
+
+           if (ext->is_unmaintained)
+             {
+               commit = "unmaintained";
+               origin = NULL;
+               size = 0;
+               formatted = g_strdup ("unknown");
+               subpaths = NULL;
+             }
+           else
+             {
+               ext_deploy_data = flatpak_dir_get_deploy_data (dir, ext->ref, cancellable, error);
+               if (ext_deploy_data == NULL)
+                 return FALSE;
+
+               commit = flatpak_deploy_data_get_commit (ext_deploy_data);
+               origin = flatpak_deploy_data_get_origin (ext_deploy_data);
+               size = flatpak_deploy_data_get_installed_size (ext_deploy_data);
+               formatted = g_format_size (size);
+               subpaths = flatpak_deploy_data_get_subpaths (ext_deploy_data);
+             }
+
+           g_print ("\n%s%s%s %s\n", on, _("Extension:"), off, ext->ref);
+           g_print ("%s%s%s %s\n", on, _("ID:"), off, ext->id);
+           g_print ("%s%s%s %s\n", on, _("Origin:"), off, origin ? origin : "-");
+           g_print ("%s%s%s %s\n", on, _("Commit:"), off, commit);
+           g_print ("%s%s%s %s%s\n", on, _("Installed size:"), off, subpaths && subpaths[0] ? "<" : "", formatted);
+
+           if (subpaths && subpaths[0])
+             {
+               g_autofree char *subpath_str = NULL;
+
+               subpath_str = g_strjoinv (",", (char **)subpaths);
+               g_print ("%s%s%s %s\n", on, _("Subpaths:"), off, subpath_str);
+             }
+         }
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_info (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(GError) error = NULL;
+  FlatpakKinds kinds;
+  int i, j;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ALL_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  kinds = FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* NAME */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          g_auto(GStrv) refs = flatpak_dir_find_installed_refs (dir, NULL, NULL, opt_arch,
+                                                                kinds, &error);
+          if (refs == NULL)
+            flatpak_completion_debug ("find local refs error: %s", error->message);
+          for (j = 0; refs != NULL && refs[j] != NULL; j++)
+            {
+              g_auto(GStrv) parts = flatpak_decompose_ref (refs[j], NULL);
+              if (parts)
+                flatpak_complete_word (completion, "%s ", parts[1]);
+            }
+        }
+      break;
+
+    case 2: /* BRANCH */
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          g_auto(GStrv) refs = flatpak_dir_find_installed_refs (dir, completion->argv[1], NULL, opt_arch,
+                                                                kinds, &error);
+          if (refs == NULL)
+            flatpak_completion_debug ("find remote refs error: %s", error->message);
+          for (j = 0; refs != NULL && refs[j] != NULL; j++)
+            {
+              g_auto(GStrv) parts = flatpak_decompose_ref (refs[j], NULL);
+              if (parts)
+                flatpak_complete_word (completion, "%s ", parts[3]);
+            }
+        }
+
+      break;
+
+    default:
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c
new file mode 100644 (file)
index 0000000..f7666f3
--- /dev/null
@@ -0,0 +1,610 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include <gio/gunixinputstream.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-transaction.h"
+#include "flatpak-utils.h"
+#include "lib/flatpak-error.h"
+#include "flatpak-chain-input-stream.h"
+
+static char *opt_arch;
+static char **opt_gpg_file;
+static char **opt_subpaths;
+static gboolean opt_no_pull;
+static gboolean opt_no_deploy;
+static gboolean opt_no_related;
+static gboolean opt_no_deps;
+static gboolean opt_no_static_deltas;
+static gboolean opt_runtime;
+static gboolean opt_app;
+static gboolean opt_bundle;
+static gboolean opt_from;
+static gboolean opt_yes;
+static gboolean opt_reinstall;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to install for"), N_("ARCH") },
+  { "no-pull", 0, 0, G_OPTION_ARG_NONE, &opt_no_pull, N_("Don't pull, only install from local cache"), NULL },
+  { "no-deploy", 0, 0, G_OPTION_ARG_NONE, &opt_no_deploy, N_("Don't deploy, only download to local cache"), NULL },
+  { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, N_("Don't install related refs"), NULL },
+  { "no-deps", 0, 0, G_OPTION_ARG_NONE, &opt_no_deps, N_("Don't verify/install runtime dependencies"), NULL },
+  { "no-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_no_static_deltas, N_("Don't use static deltas"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Look for runtime with the specified name"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Look for app with the specified name"), NULL },
+  { "bundle", 0, 0, G_OPTION_ARG_NONE, &opt_bundle, N_("Assume LOCATION is a .flatpak single-file bundle"), NULL },
+  { "from", 0, 0, G_OPTION_ARG_NONE, &opt_from, N_("Assume LOCATION is a .flatpakref application description"), NULL },
+  { "gpg-file", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_file, N_("Check bundle signatures with GPG key from FILE (- for stdin)"), N_("FILE") },
+  { "subpath", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_subpaths, N_("Only install this subpath"), N_("PATH") },
+  { "assumeyes", 'y', 0, G_OPTION_ARG_NONE, &opt_yes, N_("Automatically answer yes for all questions"), NULL },
+  { "reinstall", 0, 0, G_OPTION_ARG_NONE, &opt_reinstall, N_("Uninstall first if already installed"), NULL },
+  { NULL }
+};
+
+static GBytes *
+read_gpg_data (GCancellable *cancellable,
+               GError      **error)
+{
+  g_autoptr(GInputStream) source_stream = NULL;
+  guint n_keyrings = 0;
+  g_autoptr(GPtrArray) streams = NULL;
+
+  if (opt_gpg_file != NULL)
+    n_keyrings = g_strv_length (opt_gpg_file);
+
+  guint ii;
+
+  streams = g_ptr_array_new_with_free_func (g_object_unref);
+
+  for (ii = 0; ii < n_keyrings; ii++)
+    {
+      GInputStream *input_stream = NULL;
+
+      if (strcmp (opt_gpg_file[ii], "-") == 0)
+        {
+          input_stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
+        }
+      else
+        {
+          g_autoptr(GFile) file = g_file_new_for_commandline_arg (opt_gpg_file[ii]);
+          input_stream = G_INPUT_STREAM (g_file_read (file, cancellable, error));
+
+          if (input_stream == NULL)
+            return NULL;
+        }
+
+      /* Takes ownership. */
+      g_ptr_array_add (streams, input_stream);
+    }
+
+  /* Chain together all the --keyring options as one long stream. */
+  source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
+
+  return flatpak_read_stream (source_stream, FALSE, error);
+}
+
+static gboolean
+remote_is_already_configured (FlatpakDir *dir,
+                              const char *url,
+                              const char *collection_id)
+{
+  g_autofree char *old_remote = NULL;
+
+  old_remote = flatpak_dir_find_remote_by_uri (dir, url, collection_id);
+  if (old_remote == NULL && flatpak_dir_is_user (dir))
+    {
+      g_autoptr(GPtrArray) system_dirs = NULL;
+      int i;
+
+      system_dirs = flatpak_dir_get_system_list (NULL, NULL);
+      if (system_dirs == NULL)
+        return FALSE;
+
+      for (i = 0; i < system_dirs->len; i++)
+        {
+          FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+          old_remote = flatpak_dir_find_remote_by_uri (system_dir, url, collection_id);
+          if (old_remote != NULL)
+            break;
+        }
+    }
+
+  return old_remote != NULL;
+}
+
+static gboolean
+handle_runtime_repo_deps (FlatpakDir *dir, const char *dep_url, GError **error)
+{
+  g_autoptr(GBytes) dep_data = NULL;
+  g_autofree char *runtime_url = NULL;
+  g_autofree char *new_remote = NULL;
+  g_autofree char *basename = NULL;
+  g_autoptr(SoupURI) uri = NULL;
+  g_auto(GStrv) remotes = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  g_autoptr(GBytes) gpg_key = NULL;
+  g_autofree char *group = NULL;
+  g_autofree char *runtime_collection_id = NULL;
+  char *t;
+  int i;
+
+  if (opt_no_deps)
+    return TRUE;
+
+  dep_data = download_uri (dep_url, error);
+  if (dep_data == NULL)
+    {
+      g_prefix_error (error, "Can't load dependent file %s", dep_url);
+      return FALSE;
+    }
+
+  uri = soup_uri_new (dep_url);
+  basename = g_path_get_basename (soup_uri_get_path (uri));
+  /* Strip suffix */
+  t = strchr (basename, '.');
+  if (t != NULL)
+    *t = 0;
+
+  /* Find a free remote name */
+  remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+  i = 0;
+  do
+    {
+      g_clear_pointer (&new_remote, g_free);
+
+      if (i == 0)
+        new_remote = g_strdup (basename);
+      else
+        new_remote = g_strdup_printf ("%s-%d", basename, i);
+      i++;
+    }
+  while (remotes != NULL && g_strv_contains ((const char * const*)remotes, new_remote));
+
+  config = flatpak_dir_parse_repofile (dir, new_remote, FALSE, dep_data, &gpg_key, NULL, error);
+  if (config == NULL)
+    {
+      g_prefix_error (error, "Can't parse dependent file %s: ", dep_url);
+      return FALSE;
+    }
+
+  /* See if it already exists */
+  group = g_strdup_printf ("remote \"%s\"", new_remote);
+  runtime_url = g_key_file_get_string (config, group, "url", NULL);
+  g_assert (runtime_url != NULL);
+#ifdef FLATPAK_ENABLE_P2P
+  runtime_collection_id = g_key_file_get_string (config, group, "collection-id", NULL);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (remote_is_already_configured (dir, runtime_url, runtime_collection_id))
+    return TRUE;
+
+  if (opt_yes ||
+      flatpak_yes_no_prompt (_("This application depends on runtimes from:\n  %s\nConfigure this as new remote '%s'"),
+                             runtime_url, new_remote))
+    {
+      if (opt_yes)
+        g_print (_("Configuring %s as new remote '%s'"), runtime_url, new_remote);
+
+    if (!flatpak_dir_modify_remote (dir, new_remote, config, gpg_key, NULL, error))
+        return FALSE;
+      if (!flatpak_dir_recreate_repo (dir, NULL, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+handle_runtime_repo_deps_from_bundle (FlatpakDir *dir, GFile *file, GError **error)
+{
+  g_autofree char *dep_url = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+
+  if (opt_no_deps)
+    return TRUE;
+
+  metadata = flatpak_bundle_load (file, NULL,
+                                  NULL,
+                                  NULL,
+                                  &dep_url,
+                                  NULL,
+                                  NULL,
+                                  NULL,
+                                  NULL,
+                                  NULL);
+  if (metadata == NULL || dep_url == NULL)
+    return TRUE;
+
+  return handle_runtime_repo_deps (dir, dep_url, error);
+}
+
+static gboolean
+install_bundle (FlatpakDir *dir,
+                GOptionContext *context,
+                int argc, char **argv,
+                GCancellable *cancellable,
+                GError **error)
+{
+  g_autoptr(GFile) file = NULL;
+  const char *filename;
+  g_autoptr(GBytes) gpg_data = NULL;
+  g_autoptr(FlatpakTransaction) transaction = NULL;
+
+  if (argc < 2)
+    return usage_error (context, _("Bundle filename must be specified"), error);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  filename = argv[1];
+
+  file = g_file_new_for_commandline_arg (filename);
+
+  if (!g_file_is_native (file))
+    return flatpak_fail (error, _("Remote bundles are not supported"));
+
+  if (opt_gpg_file != NULL)
+    {
+      /* Override gpg_data from file */
+      gpg_data = read_gpg_data (cancellable, error);
+      if (gpg_data == NULL)
+        return FALSE;
+    }
+
+  if (!handle_runtime_repo_deps_from_bundle (dir, file, error))
+    return FALSE;
+
+  if (!flatpak_dir_ensure_repo (dir, cancellable, error))
+    return FALSE;
+
+  transaction = flatpak_transaction_new (dir, opt_yes, opt_no_pull, opt_no_deploy,
+                                         opt_no_static_deltas, !opt_no_deps, !opt_no_related, opt_reinstall);
+
+  if (!flatpak_transaction_add_install_bundle (transaction, file, gpg_data, error))
+    return FALSE;
+
+  if (!flatpak_transaction_run (transaction, TRUE, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+handle_suggested_remote_name (FlatpakDir *dir, GBytes *data, GError **error)
+{
+  g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+  g_autofree char *suggested_name = NULL;
+  g_autofree char *url = NULL;
+  g_autofree char *collection_id = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  g_autoptr(GBytes) gpg_key = NULL;
+
+  if (!g_key_file_load_from_data (keyfile, g_bytes_get_data (data, NULL), g_bytes_get_size (data),
+                                  0, error))
+    return FALSE;
+
+  suggested_name = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                          FLATPAK_REF_SUGGEST_REMOTE_NAME_KEY, NULL);
+  if (suggested_name == NULL)
+    return TRUE;
+
+  url = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                               FLATPAK_REF_URL_KEY, NULL);
+  if (url == NULL)
+    return TRUE;
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP, FLATPAK_REF_COLLECTION_ID_KEY, NULL);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (remote_is_already_configured (dir, url, collection_id))
+    return TRUE;
+
+  /* The name is already used, ignore */
+  if (ostree_repo_remote_get_url (flatpak_dir_get_repo (dir), suggested_name, NULL, NULL))
+    return TRUE;
+
+  if (opt_yes ||
+      flatpak_yes_no_prompt (_("The remote '%s', at location %s contains additional applications.\nShould the remote be kept for future installations?"),
+                             suggested_name, url))
+    {
+      if (opt_yes)
+        g_print (_("Configuring %s as new remote '%s'"), url, suggested_name);
+
+      config = flatpak_dir_parse_repofile (dir, suggested_name, TRUE, data, &gpg_key, NULL, error);
+      if (config == NULL)
+        return FALSE;
+
+      if (!flatpak_dir_modify_remote (dir, suggested_name, config, gpg_key, NULL, error))
+        return FALSE;
+
+      if (!flatpak_dir_recreate_repo (dir, NULL, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+handle_runtime_repo_deps_from_keyfile (FlatpakDir *dir, GBytes *data, GError **error)
+{
+  g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+  g_autofree char *dep_url = NULL;
+
+  if (opt_no_deps)
+    return TRUE;
+
+  if (!g_key_file_load_from_data (keyfile, g_bytes_get_data (data, NULL), g_bytes_get_size (data),
+                                  0, error))
+    return FALSE;
+
+  dep_url = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                   FLATPAK_REF_RUNTIME_REPO_KEY, NULL);
+  if (dep_url == NULL)
+    return TRUE;
+
+  return handle_runtime_repo_deps (dir, dep_url, error);
+}
+
+static gboolean
+install_from (FlatpakDir *dir,
+              GOptionContext *context,
+              int argc, char **argv,
+              GCancellable *cancellable,
+              GError **error)
+{
+  g_autoptr(GFile) file = NULL;
+  g_autoptr(GBytes) file_data = NULL;
+  g_autofree char *data = NULL;
+  gsize data_len;
+  const char *filename;
+  g_autofree char *remote = NULL;
+  g_autofree char *ref = NULL;
+  const char *slash;
+  FlatpakDir *clone;
+  g_autoptr(FlatpakTransaction) transaction = NULL;
+
+  if (argc < 2)
+    return usage_error (context, _("Filename or uri must be specified"), error);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+
+  filename = argv[1];
+
+  if (g_str_has_prefix (filename, "http:") ||
+      g_str_has_prefix (filename, "https:"))
+    {
+      file_data = download_uri (filename, error);
+      if (file_data == NULL)
+        {
+          g_prefix_error (error, "Can't load uri %s: ", filename);
+          return FALSE;
+        }
+    }
+  else
+    {
+      file = g_file_new_for_commandline_arg (filename);
+
+      if (!g_file_load_contents (file, cancellable, &data, &data_len, NULL, error))
+        return FALSE;
+
+      file_data = g_bytes_new_take (g_steal_pointer (&data), data_len);
+    }
+
+  /* Handle this before the runtime deps, because they might be the same */
+  if (!handle_suggested_remote_name (dir, file_data, error))
+    return FALSE;
+
+  if (!handle_runtime_repo_deps_from_keyfile (dir, file_data, error))
+    return FALSE;
+
+  if (!flatpak_dir_create_remote_for_ref_file (dir, file_data, opt_arch, &remote, &ref, error))
+    return FALSE;
+
+  /* Need to pick up the new config, in case it was applied in the system helper. */
+  clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (clone, cancellable, error))
+    return FALSE;
+
+  slash = strchr (ref, '/');
+  g_print (_("Installing: %s\n"), slash + 1);
+
+  transaction = flatpak_transaction_new (clone, opt_yes, opt_no_pull, opt_no_deploy,
+                                         opt_no_static_deltas, !opt_no_deps, !opt_no_related, opt_reinstall);
+
+  if (!flatpak_transaction_add_install (transaction, remote, ref, (const char **)opt_subpaths, error))
+    return FALSE;
+
+  if (!flatpak_transaction_update_metadata (transaction, FALSE, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_transaction_run (transaction, TRUE, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  const char *remote;
+  g_autofree char *remote_url = NULL;
+  char **prefs = NULL;
+  int i, n_prefs;
+  g_autofree char *target_branch = NULL;
+  g_autofree char *default_branch = NULL;
+  FlatpakKinds kinds;
+  g_autoptr(FlatpakTransaction) transaction = NULL;
+
+  context = g_option_context_new (_("LOCATION/REMOTE [REF...] - Install applications or runtimes"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (!opt_bundle && !opt_from && argc >= 2)
+    {
+      if (flatpak_file_arg_has_suffix (argv[1], ".flatpakref"))
+        opt_from = TRUE;
+      if (flatpak_file_arg_has_suffix (argv[1], ".flatpak"))
+        opt_bundle = TRUE;
+    }
+
+  if (opt_bundle)
+    return install_bundle (dir, context, argc, argv, cancellable, error);
+
+  if (opt_from)
+    return install_from (dir, context, argc, argv, cancellable, error);
+
+  if (argc < 3)
+    return usage_error (context, _("REMOTE and REF must be specified"), error);
+
+  if (g_path_is_absolute (argv[1]) ||
+      g_str_has_prefix (argv[1], "./"))
+    {
+      g_autoptr(GFile) remote_file = g_file_new_for_commandline_arg (argv[1]);
+      remote_url = g_file_get_uri (remote_file);
+      remote = remote_url;
+    }
+  else
+    remote = argv[1];
+  prefs = &argv[2];
+  n_prefs = argc - 2;
+
+  /* Backwards compat for old "REMOTE NAME [BRANCH]" argument version */
+  if (argc == 4 && looks_like_branch (argv[3]))
+    {
+      target_branch = g_strdup (argv[3]);
+      n_prefs = 1;
+    }
+
+  default_branch = flatpak_dir_get_remote_default_branch (dir, remote);
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  transaction = flatpak_transaction_new (dir, opt_yes, opt_no_pull, opt_no_deploy,
+                                         opt_no_static_deltas, !opt_no_deps, !opt_no_related, opt_reinstall);
+
+  for (i = 0; i < n_prefs; i++)
+    {
+      const char *pref = prefs[i];
+      FlatpakKinds matched_kinds;
+      g_autofree char *id = NULL;
+      g_autofree char *arch = NULL;
+      g_autofree char *branch = NULL;
+      FlatpakKinds kind;
+      g_autofree char *ref = NULL;
+
+      if (!flatpak_split_partial_ref_arg (pref, kinds, opt_arch, target_branch,
+                                          &matched_kinds, &id, &arch, &branch, error))
+        return FALSE;
+
+
+      if (opt_no_pull)
+        ref = flatpak_dir_find_local_ref (dir, remote, id, branch, default_branch, arch,
+                                          matched_kinds, &kind, cancellable, error);
+      else
+        ref = flatpak_dir_find_remote_ref (dir, remote, id, branch, default_branch, arch,
+                                           matched_kinds, &kind, cancellable, error);
+
+      if (ref == NULL)
+        return FALSE;
+
+      if (!flatpak_transaction_add_install (transaction, remote, ref, (const char **)opt_subpaths, error))
+        return FALSE;
+    }
+
+  if (!opt_no_pull &&
+      !flatpak_transaction_update_metadata (transaction, FALSE, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_transaction_run (transaction, TRUE, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_install (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  FlatpakKinds kinds;
+  int i;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, &dirs, NULL, NULL))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION/REMOTE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      flatpak_complete_file (completion, "__FLATPAK_BUNDLE_OR_REF_FILE");
+
+      {
+        g_auto(GStrv) remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+        if (remotes != NULL)
+          {
+            for (i = 0; remotes[i] != NULL; i++)
+              flatpak_complete_word (completion, "%s ", remotes[i]);
+          }
+      }
+
+      break;
+
+    default: /* REF */
+      flatpak_complete_partial_ref (completion, kinds, opt_arch, dir, completion->argv[1]);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-list-remotes.c b/app/flatpak-builtins-list-remotes.c
new file mode 100644 (file)
index 0000000..e8e1641
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-table-printer.h"
+
+static gboolean opt_show_details;
+static gboolean opt_show_disabled;
+
+static GOptionEntry options[] = {
+  { "show-details", 'd', 0, G_OPTION_ARG_NONE, &opt_show_details, N_("Show remote details"), NULL },
+  { "show-disabled", 0, 0, G_OPTION_ARG_NONE, &opt_show_disabled, N_("Show disabled remotes"), NULL },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  guint i = 0, j;
+  FlatpakTablePrinter *printer;
+
+  context = g_option_context_new (_(" - List remote repositories"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (argc > 1)
+    return usage_error (context, _("Too many arguments"), error);
+
+  printer = flatpak_table_printer_new ();
+
+  j = 0;
+  flatpak_table_printer_set_column_title (printer, j++, _("Name"));
+  if (opt_show_details)
+    {
+      flatpak_table_printer_set_column_title (printer, j++, _("Title"));
+      flatpak_table_printer_set_column_title (printer, j++, _("URL"));
+      flatpak_table_printer_set_column_title (printer, j++, _("Priority"));
+    }
+  flatpak_table_printer_set_column_title (printer, j++, _("Options"));
+
+  for (j = 0; j < dirs->len; j++)
+    {
+      FlatpakDir *dir = g_ptr_array_index (dirs, j);
+      g_auto(GStrv) remotes = NULL;
+
+      remotes = flatpak_dir_list_remotes (dir, cancellable, error);
+      if (remotes == NULL)
+        return FALSE;
+
+      for (i = 0; remotes[i] != NULL; i++)
+        {
+          char *remote_name = remotes[i];
+          gboolean disabled;
+          g_autofree char *remote_url = NULL;
+          g_autofree char *title = NULL;
+          int prio;
+          g_autofree char *prio_as_string = NULL;
+          gboolean gpg_verify = TRUE;
+
+          disabled = flatpak_dir_get_remote_disabled (dir, remote_name);
+          if (disabled && !opt_show_disabled)
+            continue;
+
+          flatpak_table_printer_add_column (printer, remote_name);
+
+          if (opt_show_details)
+            {
+              title = flatpak_dir_get_remote_title (dir, remote_name);
+              if (title)
+                flatpak_table_printer_add_column (printer, title);
+              else
+                flatpak_table_printer_add_column (printer, "-");
+
+              if (ostree_repo_remote_get_url (flatpak_dir_get_repo (dir), remote_name, &remote_url, NULL))
+                flatpak_table_printer_add_column (printer, remote_url);
+              else
+                flatpak_table_printer_add_column (printer, "-");
+
+              prio = flatpak_dir_get_remote_prio (dir, remote_name);
+              prio_as_string = g_strdup_printf ("%d", prio);
+              flatpak_table_printer_add_column (printer, prio_as_string);
+            }
+
+          flatpak_table_printer_add_column (printer, ""); /* Options */
+
+          if (dirs->len > 1)
+            {
+              g_autofree char *dir_id = flatpak_dir_get_name (dir);
+              flatpak_table_printer_append_with_comma (printer, dir_id);
+            }
+
+          if (disabled)
+            flatpak_table_printer_append_with_comma (printer, "disabled");
+
+          if (flatpak_dir_get_remote_oci (dir, remote_name))
+            flatpak_table_printer_append_with_comma (printer, "oci");
+
+          if (flatpak_dir_get_remote_noenumerate (dir, remote_name))
+            flatpak_table_printer_append_with_comma (printer, "no-enumerate");
+
+          ostree_repo_remote_get_gpg_verify (flatpak_dir_get_repo (dir), remote_name,
+                                             &gpg_verify, NULL);
+          if (!gpg_verify)
+            flatpak_table_printer_append_with_comma (printer, "no-gpg-verify");
+
+          flatpak_table_printer_finish_row (printer);
+        }
+    }
+
+  flatpak_table_printer_print (printer);
+  flatpak_table_printer_free (printer);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_list_remotes (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1:
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-list.c b/app/flatpak-builtins-list.c
new file mode 100644 (file)
index 0000000..6cad2f9
--- /dev/null
@@ -0,0 +1,338 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-table-printer.h"
+
+static gboolean opt_show_details;
+static gboolean opt_runtime;
+static gboolean opt_app;
+static gboolean opt_all;
+static char *opt_arch;
+
+static GOptionEntry options[] = {
+  { "show-details", 'd', 0, G_OPTION_ARG_NONE, &opt_show_details, N_("Show extra information"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("List installed runtimes"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("List installed applications"), NULL },
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to show"), N_("ARCH") },
+  { "all", 'a', 0, G_OPTION_ARG_NONE, &opt_all, N_("List all refs (including locale/debug)"), NULL },
+  { NULL }
+};
+
+/* Associates a flatpak installation's directory with
+ * the list of references for apps and runtimes */
+typedef struct
+{
+  FlatpakDir *dir;
+  GStrv app_refs;
+  GStrv runtime_refs;
+} RefsData;
+
+static RefsData *
+refs_data_new (FlatpakDir *dir, const GStrv app_refs, const GStrv runtime_refs)
+{
+  RefsData *refs_data = g_new0 (RefsData, 1);
+  refs_data->dir = g_object_ref (dir);
+  refs_data->app_refs = g_strdupv ((char **) app_refs);
+  refs_data->runtime_refs = g_strdupv ((char **) runtime_refs);
+  return refs_data;
+}
+
+static void
+refs_data_free (RefsData *refs_data)
+{
+  g_object_unref (refs_data->dir);
+  g_strfreev (refs_data->app_refs);
+  g_strfreev (refs_data->runtime_refs);
+  g_free (refs_data);
+}
+
+static char **
+join_strv (char **a, char **b)
+{
+  gsize len = 1, i, j;
+  char **res;
+
+  if (a)
+    len += g_strv_length (a);
+  if (b)
+    len += g_strv_length (b);
+
+  res = g_new (char *, len);
+
+  i = 0;
+
+  for (j = 0; a != NULL && a[j] != NULL; j++)
+    res[i++] = g_strdup (a[j]);
+
+  for (j = 0; b != NULL && b[j] != NULL; j++)
+    res[i++] = g_strdup (b[j]);
+
+  res[i++] = NULL;
+  return res;
+}
+
+static gboolean
+find_refs_for_dir (FlatpakDir *dir, GStrv *apps, GStrv *runtimes, GCancellable *cancellable, GError **error)
+{
+  if (flatpak_dir_ensure_repo (dir, cancellable, NULL))
+    {
+      if (apps != NULL && !flatpak_dir_list_refs (dir, "app", apps, cancellable, error))
+        return FALSE;
+      if (runtimes != NULL && !flatpak_dir_list_refs (dir, "runtime", runtimes, cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+print_table_for_refs (gboolean print_apps, GPtrArray* refs_array, const char *arch, GCancellable *cancellable, GError **error)
+{
+  FlatpakTablePrinter *printer = flatpak_table_printer_new ();
+  int i;
+
+  i = 0;
+  flatpak_table_printer_set_column_title (printer, i++, _("Ref"));
+  if (opt_show_details)
+    {
+      flatpak_table_printer_set_column_title (printer, i++, _("Origin"));
+      flatpak_table_printer_set_column_title (printer, i++, _("Active commit"));
+      flatpak_table_printer_set_column_title (printer, i++, _("Latest commit"));
+      flatpak_table_printer_set_column_title (printer, i++, _("Installed size"));
+    }
+  flatpak_table_printer_set_column_title (printer, i++, _("Options"));
+
+  for (i = 0; i < refs_array->len; i++)
+    {
+      RefsData *refs_data = NULL;
+      FlatpakDir *dir = NULL;
+      g_auto(GStrv) dir_refs = NULL;
+      g_autoptr(GHashTable) pref_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+      int j;
+
+      refs_data = (RefsData *) g_ptr_array_index (refs_array, i);
+      dir = refs_data->dir;
+      dir_refs = join_strv (refs_data->app_refs, refs_data->runtime_refs);
+
+      for (j = 0; dir_refs[j] != NULL; j++)
+        {
+          char *ref = dir_refs[j];
+          char *partial_ref = flatpak_make_valid_id_prefix (strchr (ref, '/') + 1);
+          g_hash_table_insert (pref_hash, partial_ref, ref);
+        }
+
+      for (j = 0; dir_refs[j] != NULL; j++)
+        {
+          char *ref, *partial_ref;
+          g_auto(GStrv) parts = NULL;
+          const char *repo = NULL;
+          g_autoptr(GVariant) deploy_data = NULL;
+          const char *active;
+          const char *alt_id;
+          g_autofree char *latest = NULL;
+          g_autofree char *size_s = NULL;
+          guint64 size = 0;
+          g_autofree const char **subpaths = NULL;
+
+          ref = dir_refs[j];
+
+          parts = g_strsplit (ref, "/", -1);
+          partial_ref = strchr (ref, '/') + 1;
+
+          if (arch != NULL && strcmp (arch, parts[1]) != 0)
+            continue;
+
+          deploy_data = flatpak_dir_get_deploy_data (dir, ref, cancellable, NULL);
+          if (deploy_data == NULL)
+            continue;
+
+          if (!opt_all && strcmp (parts[0], "runtime") == 0 &&
+              flatpak_id_has_subref_suffix (parts[1]))
+            {
+              g_autofree char *prefix_partial_ref = NULL;
+              char *last_dot = strrchr (parts[1], '.');
+
+              *last_dot = 0;
+              prefix_partial_ref = g_strconcat (parts[1], "/", parts[2], "/", parts[3], NULL);
+              *last_dot = '.';
+
+              if (g_hash_table_lookup (pref_hash, prefix_partial_ref))
+                continue;
+            }
+
+
+          repo = flatpak_deploy_data_get_origin (deploy_data);
+
+          active = flatpak_deploy_data_get_commit (deploy_data);
+          alt_id = flatpak_deploy_data_get_alt_id (deploy_data);
+
+          latest = flatpak_dir_read_latest (dir, repo, ref, NULL, NULL, NULL);
+          if (latest)
+            {
+              if (strcmp (active, latest) == 0)
+                {
+                  g_free (latest);
+                  latest = g_strdup ("-");
+                }
+              else
+                {
+                  latest[MIN (strlen (latest), 12)] = 0;
+                }
+            }
+          else
+            {
+              latest = g_strdup ("?");
+            }
+
+          flatpak_table_printer_add_column (printer, partial_ref);
+
+          if (opt_show_details)
+            {
+              flatpak_table_printer_add_column (printer, repo);
+
+              flatpak_table_printer_add_column_len (printer, active, 12);
+              flatpak_table_printer_add_column_len (printer, latest, 12);
+
+              size = flatpak_deploy_data_get_installed_size (deploy_data);
+              size_s = g_format_size (size);
+              flatpak_table_printer_add_decimal_column (printer, size_s);
+            }
+
+          flatpak_table_printer_add_column (printer, ""); /* Options */
+
+          if (refs_array->len > 1)
+            {
+              g_autofree char *source = flatpak_dir_get_name (dir);
+              flatpak_table_printer_append_with_comma (printer, source);
+            }
+
+          if (alt_id)
+            {
+              g_autofree char *alt_id_str = g_strdup_printf ("alt-id=%.12s", alt_id);
+              flatpak_table_printer_append_with_comma (printer, alt_id_str);
+            }
+
+          if (strcmp (parts[0], "app") == 0)
+            {
+              g_autofree char *current = NULL;
+
+              current = flatpak_dir_current_ref (dir, parts[1], cancellable);
+              if (current && strcmp (ref, current) == 0)
+                flatpak_table_printer_append_with_comma (printer, "current");
+            }
+          else
+            {
+              if (print_apps)
+                flatpak_table_printer_append_with_comma (printer, "runtime");
+            }
+
+          subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+          if (subpaths[0] != NULL)
+            {
+              flatpak_table_printer_append_with_comma (printer, "partial");
+            }
+          flatpak_table_printer_finish_row (printer);
+        }
+    }
+
+  flatpak_table_printer_print (printer);
+  flatpak_table_printer_free (printer);
+
+  return TRUE;
+}
+
+static gboolean
+print_installed_refs (gboolean app, gboolean runtime, GPtrArray *dirs, const char *arch, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GPtrArray) refs_array = NULL;
+  int i;
+
+  refs_array = g_ptr_array_new_with_free_func ((GDestroyNotify) refs_data_free);
+
+  for (i = 0; i < dirs->len; i++)
+    {
+      FlatpakDir *dir = g_ptr_array_index (dirs, i);
+      g_auto(GStrv) apps = NULL;
+      g_auto(GStrv) runtimes = NULL;
+
+      if (!find_refs_for_dir (dir, app ? &apps : NULL, runtime ? &runtimes : NULL, cancellable, error))
+        return FALSE;
+      g_ptr_array_add (refs_array, refs_data_new (dir, apps, runtimes));
+    }
+
+  if (!print_table_for_refs (app, refs_array, arch, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+
+  context = g_option_context_new (_(" - List installed apps and/or runtimes"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ALL_DIRS,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  if (argc > 1)
+    return usage_error (context, _("Too many arguments"), error);
+
+  if (!opt_app && !opt_runtime)
+    {
+      opt_app = TRUE;
+      opt_runtime = TRUE;
+    }
+
+  if (!print_installed_refs (opt_app, opt_runtime,
+                             dirs,
+                             opt_arch,
+                             cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_list (FlatpakCompletion *completion)
+{
+  flatpak_complete_options (completion, global_entries);
+  flatpak_complete_options (completion, options);
+  flatpak_complete_options (completion, user_entries);
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-ls-remote.c b/app/flatpak-builtins-ls-remote.c
new file mode 100644 (file)
index 0000000..c1614a5
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+#include "flatpak-table-printer.h"
+
+static gboolean opt_show_details;
+static gboolean opt_runtime;
+static gboolean opt_app;
+static gboolean opt_all;
+static gboolean opt_only_updates;
+static char *opt_arch;
+
+static GOptionEntry options[] = {
+  { "show-details", 'd', 0, G_OPTION_ARG_NONE, &opt_show_details, N_("Show arches and branches"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Show only runtimes"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Show only apps"), NULL },
+  { "updates", 0, 0, G_OPTION_ARG_NONE, &opt_only_updates, N_("Show only those where updates are available"), NULL },
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Limit to this arch (* for all)"), N_("ARCH") },
+  { "all", 'a', 0, G_OPTION_ARG_NONE, &opt_all, N_("List all refs (including locale/debug)"), NULL },
+  { NULL }
+};
+
+typedef struct RemoteDirPair {
+  gchar *remote_name;
+  FlatpakDir *dir;
+} RemoteDirPair;
+
+static void
+remote_dir_pair_free (RemoteDirPair *pair)
+{
+  g_free (pair->remote_name);
+  g_object_unref (pair->dir);
+  g_free (pair);
+}
+
+static RemoteDirPair *
+remote_dir_pair_new (const char *remote_name, FlatpakDir *dir)
+{
+  RemoteDirPair *pair = g_new (RemoteDirPair, 1);
+  pair->remote_name = g_strdup (remote_name);
+  pair->dir = g_object_ref (dir);
+  return pair;
+}
+
+gboolean
+flatpak_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  GHashTableIter refs_iter;
+  GHashTableIter iter;
+  gpointer refs_key;
+  gpointer refs_value;
+  gpointer key;
+  gpointer value;
+  guint n_keys;
+  g_autofree const char **keys = NULL;
+  int i;
+  const char **arches = flatpak_get_arches ();
+  const char *opt_arches[] = {NULL, NULL};
+  gboolean has_remote;
+  g_autoptr(GHashTable) pref_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  g_autoptr(GHashTable) refs_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, (GDestroyNotify)g_hash_table_unref, (GDestroyNotify)remote_dir_pair_free);
+
+  context = g_option_context_new (_(" [REMOTE] - Show available runtimes and applications"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (!opt_app && !opt_runtime)
+    opt_app = opt_runtime = TRUE;
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  has_remote = (argc == 2);
+
+  if (has_remote)
+    {
+      g_autoptr(FlatpakDir) preferred_dir = NULL;
+      g_autoptr(GHashTable) refs = NULL;
+      RemoteDirPair *remote_dir_pair = NULL;
+
+      if (!flatpak_resolve_duplicate_remotes (dirs, argv[1], &preferred_dir, cancellable, error))
+        return FALSE;
+
+      if (!flatpak_dir_list_remote_refs (preferred_dir,
+                                         argv[1],
+                                         &refs,
+                                         cancellable, error))
+        return FALSE;
+
+      remote_dir_pair = remote_dir_pair_new (argv[1], preferred_dir);
+      g_hash_table_insert (refs_hash, g_steal_pointer (&refs), remote_dir_pair);
+    }
+  else
+    {
+      int i;
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          g_auto(GStrv) remotes = NULL;
+          int j;
+
+          remotes = flatpak_dir_list_remotes (dir, cancellable, error);
+          if (remotes == NULL)
+            return FALSE;
+
+          for (j = 0; remotes[j] != NULL; j++)
+            {
+              g_autoptr(GHashTable) refs = NULL;
+              RemoteDirPair *remote_dir_pair = NULL;
+              const char *remote_name = remotes[j];
+
+              if (!flatpak_dir_list_remote_refs (dir,
+                                                 remote_name,
+                                                 &refs,
+                                                 cancellable, error))
+                return FALSE;
+
+              remote_dir_pair = remote_dir_pair_new (remote_name, dir);
+              g_hash_table_insert (refs_hash, g_steal_pointer (&refs), remote_dir_pair);
+            }
+        }
+    }
+
+  if (opt_arch != NULL)
+    {
+      if (strcmp (opt_arch, "*") == 0)
+        arches = NULL;
+      else
+        {
+          opt_arches[0] = opt_arch;
+          arches = opt_arches;
+        }
+    }
+
+  FlatpakTablePrinter *printer = flatpak_table_printer_new ();
+
+  i = 0;
+  flatpak_table_printer_set_column_title (printer, i++, _("Ref"));
+  if (!has_remote)
+    flatpak_table_printer_set_column_title (printer, i++, _("Origin"));
+  flatpak_table_printer_set_column_title (printer, i++, _("Commit"));
+  flatpak_table_printer_set_column_title (printer, i++, _("Installed size"));
+  flatpak_table_printer_set_column_title (printer, i++, _("Download size"));
+
+  g_hash_table_iter_init (&refs_iter, refs_hash);
+  while (g_hash_table_iter_next (&refs_iter, &refs_key, &refs_value))
+    {
+      GHashTable *refs = refs_key;
+      RemoteDirPair *remote_dir_pair = refs_value;
+      const char *remote = remote_dir_pair->remote_name;
+      FlatpakDir *dir = remote_dir_pair->dir;
+      g_autoptr(GHashTable) names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+      g_hash_table_iter_init (&iter, refs);
+      while (g_hash_table_iter_next (&iter, &key, &value))
+        {
+          char *ref = key;
+          char *partial_ref;
+          const char *slash = strchr (ref, '/');
+
+          if (slash == NULL)
+            {
+              g_debug ("Invalid remote ref %s", ref);
+              continue;
+            }
+
+          partial_ref = flatpak_make_valid_id_prefix (slash + 1);
+          g_hash_table_insert (pref_hash, partial_ref, ref);
+        }
+
+      g_hash_table_iter_init (&iter, refs);
+      while (g_hash_table_iter_next (&iter, &key, &value))
+        {
+          const char *ref = key;
+          const char *checksum = value;
+          const char *name = NULL;
+          g_auto(GStrv) parts = NULL;
+
+          parts = flatpak_decompose_ref (ref, NULL);
+          if (parts == NULL)
+            {
+              g_debug ("Invalid remote ref %s", ref);
+              continue;
+            }
+
+          if (opt_only_updates)
+            {
+              g_autoptr(GVariant) deploy_data = flatpak_dir_get_deploy_data (dir, ref, cancellable, NULL);
+
+              if (deploy_data == NULL)
+                continue;
+
+              if (g_strcmp0 (flatpak_deploy_data_get_commit (deploy_data), checksum) == 0)
+                continue;
+            }
+
+          if (arches != NULL && !g_strv_contains (arches, parts[2]))
+            continue;
+
+          if (strcmp (parts[0], "runtime") == 0 && !opt_runtime)
+            continue;
+
+          if (strcmp (parts[0], "app") == 0 && !opt_app)
+            continue;
+
+          if (!opt_show_details)
+            name = parts[1];
+          else
+            name = ref;
+
+          if (!opt_all &&
+              strcmp (parts[0], "runtime") == 0 &&
+              flatpak_id_has_subref_suffix (parts[1]))
+            {
+              g_autofree char *prefix_partial_ref = NULL;
+              char *last_dot = strrchr (parts[1], '.');
+
+              *last_dot = 0;
+              prefix_partial_ref = g_strconcat (parts[1], "/", parts[2], "/", parts[3], NULL);
+              *last_dot = '.';
+
+              if (g_hash_table_lookup (pref_hash, prefix_partial_ref))
+                continue;
+            }
+
+          if (!opt_all && opt_arch == NULL &&
+              /* Hide non-primary arches if the primary arch exists */
+              strcmp (arches[0], parts[2]) != 0)
+            {
+              g_autofree char *alt_arch_ref = g_strconcat (parts[0], "/", parts[1], "/", arches[0], "/", parts[3], NULL);
+              if (g_hash_table_lookup (refs, alt_arch_ref))
+                continue;
+            }
+
+          if (g_hash_table_lookup (names, name) == NULL)
+            g_hash_table_insert (names, g_strdup (name), g_strdup (checksum));
+        }
+      keys = (const char **) g_hash_table_get_keys_as_array (names, &n_keys);
+      g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) flatpak_strcmp0_ptr, NULL);
+
+      for (i = 0; i < n_keys; i++)
+        {
+          flatpak_table_printer_add_column (printer, keys[i]);
+
+          if (!has_remote)
+              flatpak_table_printer_add_column (printer, remote);
+
+          if (opt_show_details)
+            {
+              g_autofree char *value = NULL;
+              g_autoptr(GVariant) refdata = NULL;
+              g_autoptr(GError) local_error = NULL;
+              guint64 installed_size;
+              guint64 download_size;
+              const char *metadata;
+
+              value = g_strdup ((char *) g_hash_table_lookup (names, keys[i]));
+              value[MIN (strlen (value), 12)] = 0;
+              flatpak_table_printer_add_column (printer, value);
+
+              if (!flatpak_dir_lookup_repo_metadata (dir, remote, cancellable, &local_error,
+                                                     "xa.cache", "v", &refdata))
+                {
+                  if (local_error == NULL)
+                    flatpak_fail (&local_error, _("No ref information available in repository"));
+                  g_propagate_error (error, g_steal_pointer (&local_error));
+                  return FALSE;
+                }
+
+              if (g_variant_lookup (refdata, keys[i], "(tt&s)", &installed_size, &download_size, &metadata))
+                {
+                  g_autofree char *installed = g_format_size (GUINT64_FROM_BE (installed_size));
+                  g_autofree char *download = g_format_size (GUINT64_FROM_BE (download_size));
+
+                  flatpak_table_printer_add_decimal_column (printer, installed);
+                  flatpak_table_printer_add_decimal_column (printer, download);
+                }
+            }
+          flatpak_table_printer_finish_row (printer);
+        }
+    }
+
+  flatpak_table_printer_print (printer);
+  flatpak_table_printer_free (printer);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_ls_remote (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* REMOTE */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          int j;
+          g_auto(GStrv) remotes = flatpak_dir_list_remotes (dir, NULL, NULL);
+          if (remotes == NULL)
+            return FALSE;
+          for (j = 0; remotes[j] != NULL; j++)
+            flatpak_complete_word (completion, "%s ", remotes[j]);
+        }
+
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-make-current.c b/app/flatpak-builtins-make-current.c
new file mode 100644 (file)
index 0000000..8bf752b
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+
+static char *opt_arch;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to make current for"), N_("ARCH") },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_make_current_app (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  g_autoptr(GFile) deploy_base = NULL;
+  const char *pref;
+  const char *default_branch = NULL;
+  g_autofree char *ref = NULL;
+  g_auto(GLnxLockFile) lock = { 0, };
+  g_autofree char *id = NULL;
+  g_autofree char *arch = NULL;
+  g_autofree char *branch = NULL;
+  FlatpakKinds kinds;
+
+  context = g_option_context_new (_("APP BRANCH - Make branch of application current"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (argc < 2)
+    return usage_error (context, _("APP must be specified"), error);
+
+  if (argc > 3)
+    return usage_error (context, _("Too many arguments"), error);
+
+  pref = argv[1];
+
+  if (argc >= 3)
+    default_branch = argv[2];
+
+  if (!flatpak_split_partial_ref_arg (pref, FLATPAK_KINDS_APP, opt_arch, default_branch,
+                                      &kinds, &id, &arch, &branch, error))
+    return FALSE;
+
+  if (branch == NULL)
+    return usage_error (context, _("BRANCH must be specified"), error);
+
+  ref = flatpak_dir_find_installed_ref (dir, id, branch, arch, FLATPAK_KINDS_APP,
+                                        NULL, error);
+  if (ref == NULL)
+    return FALSE;
+
+  if (!flatpak_dir_lock (dir, &lock,
+                         cancellable, error))
+    return FALSE;
+
+  deploy_base = flatpak_dir_get_deploy_dir (dir, ref);
+  if (!g_file_query_exists (deploy_base, cancellable))
+    return flatpak_fail (error, _("App %s branch %s is not installed"), id, branch);
+
+  if (!flatpak_dir_make_current_ref (dir, ref, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_update_exports (dir, id, cancellable, error))
+    return FALSE;
+
+  glnx_release_lock_file (&lock);
+
+  if (!flatpak_dir_mark_changed (dir, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_make_current_app (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  g_autoptr(GError) error = NULL;
+  g_auto(GStrv) refs = NULL;
+  int i;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, &dirs, NULL, NULL))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* NAME */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+
+      refs = flatpak_dir_find_installed_refs (dir, NULL, NULL, opt_arch,
+                                              FLATPAK_KINDS_APP, &error);
+      if (refs == NULL)
+        flatpak_completion_debug ("find installed refs error: %s", error->message);
+      for (i = 0; refs != NULL && refs[i] != NULL; i++)
+        {
+          g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+          if (parts)
+            flatpak_complete_word (completion, "%s ", parts[1]);
+        }
+      break;
+
+    case 2: /* Branch */
+      refs = flatpak_dir_find_installed_refs (dir, completion->argv[1], NULL, opt_arch,
+                                              FLATPAK_KINDS_APP, &error);
+      if (refs == NULL)
+        flatpak_completion_debug ("find installed refs error: %s", error->message);
+      for (i = 0; refs != NULL && refs[i] != NULL; i++)
+        {
+          g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+          if (parts)
+            flatpak_complete_word (completion, "%s ", parts[3]);
+        }
+      break;
+
+    default:
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-override.c b/app/flatpak-builtins-override.c
new file mode 100644 (file)
index 0000000..c971a9d
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-run.h"
+
+static GOptionEntry options[] = {
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_override (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  const char *app;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(FlatpakContext) overrides = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  context = g_option_context_new (_("[APP] - Override settings [for application]"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (argc > 2)
+    return usage_error (context, _("Too many arguments"), error);
+
+  if (argc >= 2)
+    {
+      app = argv[1];
+      if (!flatpak_is_valid_name (app, &my_error))
+        return flatpak_fail (error, _("'%s' is not a valid application name: %s"), app, my_error->message);
+    }
+  else
+    app = NULL;
+
+  metakey = flatpak_load_override_keyfile (app, flatpak_dir_is_user (dir), &my_error);
+  if (metakey == NULL)
+    {
+      if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return FALSE;
+        }
+      metakey = g_key_file_new ();
+    }
+
+  overrides = flatpak_context_new ();
+  if (!flatpak_context_load_metadata (overrides, metakey, error))
+    return FALSE;
+
+  flatpak_context_merge (overrides, arg_context);
+
+  flatpak_context_save_metadata (overrides, FALSE, metakey);
+
+  if (!flatpak_save_override_keyfile (metakey, app, flatpak_dir_is_user (dir), error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_override (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(GError) error = NULL;
+  int i;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+
+  context = g_option_context_new ("");
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* NAME */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_context_complete (arg_context, completion);
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+          int j;
+          g_auto(GStrv) refs = flatpak_dir_find_installed_refs (dir, NULL, NULL, NULL,
+                                                                FLATPAK_KINDS_APP, &error);
+          if (refs == NULL)
+            flatpak_completion_debug ("find local refs error: %s", error->message);
+          for (j = 0; refs != NULL && refs[j] != NULL; j++)
+            {
+              g_auto(GStrv) parts = flatpak_decompose_ref (refs[j], NULL);
+              if (parts)
+                flatpak_complete_word (completion, "%s ", parts[1]);
+            }
+        }
+
+      break;
+
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-repo-update.c b/app/flatpak-builtins-repo-update.c
new file mode 100644 (file)
index 0000000..62b138b
--- /dev/null
@@ -0,0 +1,569 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-builtins-utils.h"
+
+static char *opt_title;
+static char *opt_redirect_url;
+static char *opt_default_branch;
+static char *opt_collection_id = NULL;
+static gboolean opt_deploy_collection_id = FALSE;
+static char **opt_gpg_import;
+static char *opt_generate_delta_from;
+static char *opt_generate_delta_to;
+static char *opt_generate_delta_ref;
+static char *opt_gpg_homedir;
+static char **opt_gpg_key_ids;
+static gboolean opt_prune;
+static gboolean opt_generate_deltas;
+static gint opt_prune_depth = -1;
+
+static GOptionEntry options[] = {
+  { "redirect-url", 0, 0, G_OPTION_ARG_STRING, &opt_redirect_url, N_("Redirect this repo to a new URL"), N_("URL") },
+  { "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, N_("A nice name to use for this repository"), N_("TITLE") },
+  { "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, N_("Default branch to use for this repository"), N_("BRANCH") },
+#ifdef FLATPAK_ENABLE_P2P
+  { "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), N_("COLLECTION-ID") },
+  { "deploy-collection-id", 0, 0, G_OPTION_ARG_NONE, &opt_deploy_collection_id, N_("Permanently deploy collection ID to client remote configurations"), NULL },
+#endif  /* FLATPAK_ENABLE_P2P */
+  { "gpg-import", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_import, N_("Import new default GPG public key from FILE"), N_("FILE") },
+  { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the summary with"), N_("KEY-ID") },
+  { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
+  { "generate-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_generate_deltas, N_("Generate delta files"), NULL },
+  { "prune", 0, 0, G_OPTION_ARG_NONE, &opt_prune, N_("Prune unused objects"), NULL },
+  { "prune-depth", 0, 0, G_OPTION_ARG_INT, &opt_prune_depth, N_("Only traverse DEPTH parents for each commit (default: -1=infinite)"), N_("DEPTH") },
+  { "generate-static-delta-from", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_generate_delta_from, NULL, NULL },
+  { "generate-static-delta-to", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_generate_delta_to, NULL, NULL },
+  { "generate-static-delta-ref", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_generate_delta_ref, NULL, NULL },
+  { NULL }
+};
+
+static void
+_ostree_parse_delta_name (const char  *delta_name,
+                          char        **out_from,
+                          char        **out_to)
+{
+  g_auto(GStrv) parts = g_strsplit (delta_name, "-", 2);
+
+  if (parts[0] && parts[1])
+    {
+      *out_from = g_steal_pointer (&parts[0]);
+      *out_to = g_steal_pointer (&parts[1]);
+    }
+  else
+    {
+      *out_from = NULL;
+      *out_to = g_steal_pointer (&parts[0]);
+    }
+}
+
+static char *
+_ostree_get_relative_static_delta_path (const char *from,
+                                        const char *to,
+                                        const char *target)
+{
+  guint8 csum_to[OSTREE_SHA256_DIGEST_LEN];
+  char to_b64[44];
+  guint8 csum_to_copy[OSTREE_SHA256_DIGEST_LEN];
+  GString *ret = g_string_new ("deltas/");
+
+  ostree_checksum_inplace_to_bytes (to, csum_to);
+  ostree_checksum_b64_inplace_from_bytes (csum_to, to_b64);
+  ostree_checksum_b64_inplace_to_bytes (to_b64, csum_to_copy);
+
+  g_assert (memcmp (csum_to, csum_to_copy, OSTREE_SHA256_DIGEST_LEN) == 0);
+
+  if (from != NULL)
+    {
+      guint8 csum_from[OSTREE_SHA256_DIGEST_LEN];
+      char from_b64[44];
+
+      ostree_checksum_inplace_to_bytes (from, csum_from);
+      ostree_checksum_b64_inplace_from_bytes (csum_from, from_b64);
+
+      g_string_append_c (ret, from_b64[0]);
+      g_string_append_c (ret, from_b64[1]);
+      g_string_append_c (ret, '/');
+      g_string_append (ret, from_b64 + 2);
+      g_string_append_c (ret, '-');
+    }
+
+  g_string_append_c (ret, to_b64[0]);
+  g_string_append_c (ret, to_b64[1]);
+  if (from == NULL)
+    g_string_append_c (ret, '/');
+  g_string_append (ret, to_b64 + 2);
+
+  if (target != NULL)
+    {
+      g_string_append_c (ret, '/');
+      g_string_append (ret, target);
+    }
+
+  return g_string_free (ret, FALSE);
+}
+
+static gboolean
+_ostree_repo_static_delta_delete (OstreeRepo                    *self,
+                                  const char                    *delta_id,
+                                  GCancellable                  *cancellable,
+                                  GError                      **error)
+{
+  gboolean ret = FALSE;
+  g_autofree char *from = NULL;
+  g_autofree char *to = NULL;
+  g_autofree char *deltadir = NULL;
+  struct stat buf;
+  int repo_dir_fd = ostree_repo_get_dfd (self);
+
+  _ostree_parse_delta_name (delta_id, &from, &to);
+  deltadir = _ostree_get_relative_static_delta_path (from, to, NULL);
+
+  if (fstatat (repo_dir_fd, deltadir, &buf, 0) != 0)
+    {
+      if (errno == ENOENT)
+        g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                     "Can't find delta %s", delta_id);
+      else
+        glnx_set_error_from_errno (error);
+
+      goto out;
+    }
+
+  if (!glnx_shutil_rm_rf_at (repo_dir_fd, deltadir,
+                             cancellable, error))
+    goto out;
+
+  ret = TRUE;
+ out:
+  return ret;
+}
+
+static gboolean
+generate_one_delta (OstreeRepo *repo,
+                    const char *from,
+                    const char *to,
+                    const char *ref,
+                    GCancellable *cancellable,
+                    GError **error)
+{
+  g_autoptr(GVariantBuilder) parambuilder = NULL;
+  g_autoptr(GVariant) params = NULL;
+
+  parambuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+  /* Fall back for 1 meg files */
+  g_variant_builder_add (parambuilder, "{sv}",
+                         "min-fallback-size", g_variant_new_uint32 (1));
+  params = g_variant_ref_sink (g_variant_builder_end (parambuilder));
+
+  if (ref == NULL)
+    ref = "";
+
+  if (from == NULL)
+    g_print (_("Generating delta: %s (%.10s)\n"), ref, to);
+  else
+    g_print (_("Generating delta: %s (%.10s-%.10s)\n"), ref, from, to);
+
+  if (!ostree_repo_static_delta_generate (repo, OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR,
+                                          from, to, NULL,
+                                          params,
+                                          cancellable, error))
+    {
+      if (from == NULL)
+        g_prefix_error (error, _("Failed to generate delta %s (%.10s): "),
+                        ref, to);
+      else
+        g_prefix_error (error, _("Failed to generate delta %s (%.10s-%.10s): "),
+                        ref, from, to);
+      return FALSE;
+
+    }
+
+  return TRUE;
+}
+
+
+static void
+delta_generation_done (GObject      *source_object,
+                       GAsyncResult *result,
+                       gpointer      user_data)
+{
+  int *n_spawned_delta_generate = user_data;
+  (*n_spawned_delta_generate)--;
+}
+
+static gboolean
+spawn_delete_generation (GMainContext *context,
+                         int *n_spawned_delta_generate,
+                         OstreeRepo *repo,
+                         GVariant *params,
+                         const char *ref,
+                         const char *from,
+                         const char *to,
+                         GError **error)
+{
+  g_autoptr(GSubprocessLauncher) launcher = g_subprocess_launcher_new (0);
+  g_autoptr(GSubprocess) subprocess = NULL;
+  const char *argv[] = {
+    "/proc/self/exe",
+    "build-update-repo",
+    "--generate-static-delta-ref",
+    ref,
+    "--generate-static-delta-to",
+    to,
+    NULL, NULL, NULL, NULL
+  };
+  int i = 6;
+  g_autofree char *exe = NULL;
+
+  exe = flatpak_readlink ("/proc/self/exe", NULL);
+  if (exe)
+    argv[0] = exe;
+
+  if (from)
+    {
+      argv[i++] = "--generate-static-delta-from";
+      argv[i++] = from;
+    }
+
+  argv[i++] = flatpak_file_get_path_cached (ostree_repo_get_path (repo));
+  argv[i++] = NULL;
+
+  g_assert (i <= G_N_ELEMENTS (argv));
+
+  while (*n_spawned_delta_generate > g_get_num_processors ())
+    g_main_context_iteration (context, TRUE);
+
+  subprocess = g_subprocess_launcher_spawnv (launcher, argv, error);
+  if (subprocess == NULL)
+    return FALSE;
+
+  (*n_spawned_delta_generate)++;
+
+  g_subprocess_wait_async (subprocess, NULL, delta_generation_done, n_spawned_delta_generate);
+
+  return TRUE;
+}
+
+static gboolean
+generate_all_deltas (OstreeRepo *repo,
+                     GPtrArray **unwanted_deltas,
+                     GCancellable *cancellable,
+                     GError **error)
+{
+  g_autoptr(GMainContext) context = g_main_context_new ();
+  g_autoptr(GHashTable) all_refs = NULL;
+  g_autoptr(GHashTable) all_deltas_hash = NULL;
+  g_autoptr(GHashTable) wanted_deltas_hash = NULL;
+  g_autoptr(GPtrArray) all_deltas = NULL;
+  int i;
+  GHashTableIter iter;
+  gpointer key, value;
+  g_autoptr(GVariantBuilder) parambuilder = NULL;
+  g_autoptr(GVariant) params = NULL;
+  int n_spawned_delta_generate = 0;
+
+  g_print ("Generating static deltas\n");
+
+  parambuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+  /* Fall back for 1 meg files */
+  g_variant_builder_add (parambuilder, "{sv}",
+                         "min-fallback-size", g_variant_new_uint32 (1));
+  params = g_variant_ref_sink (g_variant_builder_end (parambuilder));
+
+  if (!ostree_repo_list_static_delta_names (repo, &all_deltas,
+                                            cancellable, error))
+    return FALSE;
+
+  wanted_deltas_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  all_deltas_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  for (i = 0; i < all_deltas->len; i++)
+    g_hash_table_insert (all_deltas_hash,
+                         g_strdup (g_ptr_array_index (all_deltas, i)),
+                         NULL);
+
+  if (!ostree_repo_list_refs (repo, NULL, &all_refs,
+                              cancellable, error))
+    return FALSE;
+
+  g_main_context_push_thread_default (context);
+
+  g_hash_table_iter_init (&iter, all_refs);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *ref = key;
+      const char *commit = value;
+      g_autoptr(GVariant) variant = NULL;
+      g_autoptr(GVariant) parent_variant = NULL;
+      g_autofree char *parent_commit = NULL;
+      g_autofree char *grandparent_commit = NULL;
+
+      if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, commit,
+                                     &variant, NULL))
+        {
+          g_warning ("Couldn't load commit %s", commit);
+          continue;
+        }
+
+      /* From empty */
+      if (!g_hash_table_contains (all_deltas_hash, commit))
+        {
+          if (!spawn_delete_generation (context, &n_spawned_delta_generate, repo, params,
+                                        ref, NULL, commit,
+                                        error))
+            goto error;
+        }
+
+      /* Mark this one as wanted */
+      g_hash_table_insert (wanted_deltas_hash, g_strdup (commit), GINT_TO_POINTER (1));
+
+      parent_commit = ostree_commit_get_parent (variant);
+
+      if (parent_commit != NULL &&
+          !ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, parent_commit,
+                                     &parent_variant, NULL))
+        {
+          g_warning ("Couldn't load parent commit %s", parent_commit);
+          continue;
+        }
+
+      /* From parent */
+      if (parent_variant != NULL)
+        {
+          g_autofree char *from_parent = g_strdup_printf ("%s-%s", parent_commit, commit);
+
+          if (!g_hash_table_contains (all_deltas_hash, from_parent))
+            {
+              if (!spawn_delete_generation (context, &n_spawned_delta_generate, repo, params,
+                                            ref, parent_commit, commit,
+                                            error))
+                goto error;
+            }
+
+          /* Mark parent-to-current as wanted */
+          g_hash_table_insert (wanted_deltas_hash, g_strdup (from_parent), GINT_TO_POINTER (1));
+
+          /* We also want to keep around the parent and the grandparent-to-parent deltas
+           * because otherwise these will be deleted immediately which may cause a race if
+           * someone is currently downloading them.
+           * However, there is no need to generate these if they don't exist.
+           */
+
+          g_hash_table_insert (wanted_deltas_hash, g_strdup (parent_commit), GINT_TO_POINTER (1));
+          grandparent_commit = ostree_commit_get_parent (parent_variant);
+          if (grandparent_commit != NULL)
+            g_hash_table_insert (wanted_deltas_hash,
+                                 g_strdup_printf ("%s-%s", grandparent_commit, parent_commit),
+                                 GINT_TO_POINTER (1));
+        }
+    }
+
+  while (n_spawned_delta_generate > 0)
+    g_main_context_iteration (context, TRUE);
+
+  g_main_context_pop_thread_default (context);
+
+  *unwanted_deltas = g_ptr_array_new_with_free_func (g_free);
+  for (i = 0; i < all_deltas->len; i++)
+    {
+      const char *delta = g_ptr_array_index (all_deltas, i);
+      if (!g_hash_table_contains (wanted_deltas_hash, delta))
+        g_ptr_array_add (*unwanted_deltas, g_strdup (delta));
+    }
+
+  return TRUE;
+
+ error:
+  g_main_context_pop_thread_default (context);
+  return FALSE;
+}
+
+gboolean
+flatpak_builtin_build_update_repo (int argc, char **argv,
+                                   GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) repofile = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  const char *location;
+  g_autoptr(GPtrArray) unwanted_deltas = NULL;
+
+  context = g_option_context_new (_("LOCATION - Update repository metadata"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("LOCATION must be specified"), error);
+
+  location = argv[1];
+
+  repofile = g_file_new_for_commandline_arg (location);
+  repo = ostree_repo_new (repofile);
+
+  if (!ostree_repo_open (repo, cancellable, error))
+    return FALSE;
+
+  if (opt_generate_delta_to)
+    {
+      if (!generate_one_delta (repo, opt_generate_delta_from, opt_generate_delta_to, opt_generate_delta_ref, cancellable, error))
+        return FALSE;
+      return TRUE;
+    }
+
+  if (opt_title &&
+      !flatpak_repo_set_title (repo, opt_title[0] ? opt_title : NULL, error))
+    return FALSE;
+
+  if (opt_redirect_url &&
+      !flatpak_repo_set_redirect_url (repo, opt_redirect_url[0] ? opt_redirect_url : NULL, error))
+    return FALSE;
+
+  if (opt_default_branch &&
+      !flatpak_repo_set_default_branch (repo, opt_default_branch[0] ? opt_default_branch : NULL, error))
+    return FALSE;
+
+  if (opt_collection_id != NULL)
+    {
+      /* Only allow a transition from no collection ID to a non-empty collection ID.
+       * Changing the collection ID between two different non-empty values is too
+       * dangerous: it will break all clients who have previously pulled from the repository.
+       * Require the user to recreate the repository from scratch in that case. */
+#ifdef FLATPAK_ENABLE_P2P
+      const char *old_collection_id = ostree_repo_get_collection_id (repo);
+#else  /* if !FLATPAK_ENABLE_P2P */
+      const char *old_collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+      const char *new_collection_id = opt_collection_id[0] ? opt_collection_id : NULL;
+
+      if (old_collection_id != NULL &&
+          g_strcmp0 (old_collection_id, new_collection_id) != 0)
+        return flatpak_fail (error, "The collection ID of an existing repository cannot be changed. "
+                                    "Recreate the repository to change or clear its collection ID.");
+
+      if (!flatpak_repo_set_collection_id (repo, new_collection_id, error))
+        return FALSE;
+    }
+
+  if (opt_deploy_collection_id &&
+      !flatpak_repo_set_deploy_collection_id (repo, TRUE, error))
+    return FALSE;
+
+  if (opt_gpg_import)
+    {
+      g_autoptr(GBytes) gpg_data = flatpak_load_gpg_keys (opt_gpg_import, cancellable, error);
+      if (gpg_data == NULL)
+        return FALSE;
+
+      if (!flatpak_repo_set_gpg_keys (repo, gpg_data, error))
+        return FALSE;
+    }
+
+  g_print (_("Updating appstream branch\n"));
+  if (!flatpak_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, 0, cancellable, error))
+    return FALSE;
+
+  if (opt_generate_deltas &&
+      !generate_all_deltas (repo, &unwanted_deltas, cancellable, error))
+    return FALSE;
+
+  if (unwanted_deltas != NULL)
+    {
+      int i;
+      for (i = 0; i < unwanted_deltas->len; i++)
+        {
+          const char *delta = g_ptr_array_index (unwanted_deltas, i);
+          g_print ("Deleting unwanted delta: %s\n", delta);
+          g_autoptr(GError) my_error = NULL;
+          if (!_ostree_repo_static_delta_delete (repo, delta, cancellable, &my_error))
+            g_printerr ("Unable to delete delta %s: %s\n", delta, my_error->message);
+        }
+    }
+
+  g_print (_("Updating summary\n"));
+  if (!flatpak_repo_update (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, error))
+    return FALSE;
+
+  if (opt_prune)
+    {
+      gint n_objects_total;
+      gint n_objects_pruned;
+      guint64 objsize_total;
+      g_autofree char *formatted_freed_size = NULL;
+
+      g_print ("Pruning old commits\n");
+      if (!ostree_repo_prune (repo, OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY, opt_prune_depth,
+                              &n_objects_total, &n_objects_pruned, &objsize_total,
+                              cancellable, error))
+        return FALSE;
+
+      formatted_freed_size = g_format_size_full (objsize_total, 0);
+
+      g_print (_("Total objects: %u\n"), n_objects_total);
+      if (n_objects_pruned == 0)
+        g_print (_("No unreachable objects\n"));
+      else
+        g_print (_("Deleted %u objects, %s freed\n"),
+                 n_objects_pruned, formatted_freed_size);
+    }
+
+  return TRUE;
+}
+
+
+gboolean
+flatpak_complete_build_update_repo (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-repo.c b/app/flatpak-builtins-repo.c
new file mode 100644 (file)
index 0000000..6f12520
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * Copyright © 2017 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-table-printer.h"
+
+static void
+print_info (GVariant *meta)
+{
+  g_autoptr(GVariant) cache = NULL;
+  const char *title;
+  const char *collection_id;
+  const char *default_branch;
+  const char *redirect_url;
+  const char *redirect_collection_id;
+  g_autoptr(GVariant) gpg_keys = NULL;
+
+  if (g_variant_lookup (meta, "xa.title", "&s", &title))
+    g_print (_("Title: %s\n"), title);
+
+  if (g_variant_lookup (meta, "collection-id", "&s", &collection_id))
+    g_print (_("Collection ID: %s\n"), collection_id);
+
+  if (g_variant_lookup (meta, "xa.default-branch", "&s", &default_branch))
+    g_print (_("Default branch: %s\n"), default_branch);
+
+  if (g_variant_lookup (meta, "xa.redirect-url", "&s", &redirect_url))
+    g_print (_("Redirect URL: %s\n"), redirect_url);
+
+  if (g_variant_lookup (meta, "xa.collection-id", "&s", &redirect_collection_id))
+    g_print (_("Redirect collection ID: %s\n"), redirect_collection_id);
+
+  if ((gpg_keys = g_variant_lookup_value (meta, "xa.gpg-keys", G_VARIANT_TYPE_BYTESTRING)) != NULL)
+    {
+      const guchar *gpg_data = g_variant_get_data (gpg_keys);
+      gsize gpg_size = g_variant_get_size (gpg_keys);
+      g_autofree gchar *gpg_data_checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA256, gpg_data, gpg_size);
+
+      g_print (_("GPG key hash: %s\n"), gpg_data_checksum);
+    }
+
+  cache = g_variant_lookup_value (meta, "xa.cache", NULL);
+  if (cache)
+    {
+      g_autoptr(GVariant) refdata = NULL;
+
+      refdata = g_variant_get_variant (cache);
+      g_print (_("%zd branches\n"), g_variant_n_children (refdata));
+    }
+}
+
+static void
+print_branches (GVariant *meta)
+{
+  g_autoptr(GVariant) cache = NULL;
+
+  cache = g_variant_lookup_value (meta, "xa.cache", NULL);
+  if (cache)
+    {
+      g_autoptr(GVariant) refdata = NULL;
+      GVariantIter iter;
+      const char *ref;
+      guint64 installed_size;
+      guint64 download_size;
+      const char *metadata;
+      FlatpakTablePrinter *printer;
+
+      printer = flatpak_table_printer_new ();
+      flatpak_table_printer_set_column_title (printer, 0, _("Ref"));
+      flatpak_table_printer_set_column_title (printer, 1, _("Installed"));
+      flatpak_table_printer_set_column_title (printer, 2, _("Download"));
+
+      refdata = g_variant_get_variant (cache);
+      g_variant_iter_init (&iter, refdata);
+      while (g_variant_iter_next (&iter, "{&s(tt&s)}", &ref, &installed_size, &download_size, &metadata))
+        {
+          g_autofree char *installed = g_format_size (GUINT64_FROM_BE (installed_size));
+          g_autofree char *download = g_format_size (GUINT64_FROM_BE (download_size));
+
+          flatpak_table_printer_add_column (printer, ref);
+          flatpak_table_printer_add_decimal_column (printer, installed);
+          flatpak_table_printer_add_decimal_column (printer, download);
+          flatpak_table_printer_finish_row (printer);
+        }
+
+      flatpak_table_printer_print (printer);
+      flatpak_table_printer_free (printer);
+    }
+}
+
+static void
+print_metadata (GVariant   *meta,
+                const char *branch)
+{
+  g_autoptr(GVariant) cache = NULL;
+
+  cache = g_variant_lookup_value (meta, "xa.cache", NULL);
+  if (cache)
+    {
+      g_autoptr(GVariant) refdata = NULL;
+      GVariantIter iter;
+      const char *ref;
+      guint64 installed_size;
+      guint64 download_size;
+      const char *metadata;
+
+      refdata = g_variant_get_variant (cache);
+      g_variant_iter_init (&iter, refdata);
+      while (g_variant_iter_next (&iter, "{&s(tt&s)}", &ref, &installed_size, &download_size, &metadata))
+        {
+          if (strcmp (branch, ref) == 0)
+            g_print ("%s", metadata);
+        }
+    }
+}
+
+static gboolean opt_info;
+static gboolean opt_branches;
+static gchar *opt_metadata_branch;
+
+static GOptionEntry options[] = {
+  { "info", 0, 0, G_OPTION_ARG_NONE, &opt_info, N_("Print general information about the repository"), NULL },
+  { "branches", 0, 0, G_OPTION_ARG_NONE, &opt_branches, N_("List the branches in the repository"), NULL },
+  { "metadata", 0, 0, G_OPTION_ARG_STRING, &opt_metadata_branch, N_("Print metadata for a branch"), N_("BRANCH") },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_repo (int argc, char **argv,
+                      GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GFile) location = NULL;
+  g_autoptr(GVariant) meta = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  const char *ostree_metadata_ref = NULL;
+  g_autofree char *ostree_metadata_checksum = NULL;
+
+  context = g_option_context_new (_("LOCATION - Repository maintenance"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("LOCATION must be specified"), error);
+
+  location = g_file_new_for_commandline_arg (argv[1]);
+  repo = ostree_repo_new (location);
+  if (!ostree_repo_open (repo, cancellable, error))
+    return FALSE;
+
+#ifdef FLATPAK_ENABLE_P2P
+  /* Try loading the metadata from the ostree-metadata branch first. If that
+   * fails, fall back to the summary file. */
+  ostree_metadata_ref = OSTREE_REPO_METADATA_REF;
+  if (!ostree_repo_resolve_rev (repo, ostree_metadata_ref,
+                                TRUE, &ostree_metadata_checksum, error))
+    return FALSE;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (ostree_metadata_checksum != NULL)
+    {
+      g_autoptr(GVariant) commit_v = NULL;
+
+      if (!ostree_repo_load_commit (repo, ostree_metadata_checksum, &commit_v, NULL, error))
+        {
+          g_prefix_error (error, "Error getting repository metadata from %s ref: ", ostree_metadata_ref);
+          return FALSE;
+        }
+
+      meta = g_variant_get_child_value (commit_v, 0);
+    }
+  else
+    {
+      g_autoptr(GVariant) summary = NULL;
+
+      summary = flatpak_repo_load_summary (repo, error);
+      if (summary == NULL)
+        {
+          g_prefix_error (error, "Error getting repository metadata from summary file: ");
+          return FALSE;
+        }
+      meta = g_variant_get_child_value (summary, 1);
+    }
+
+  /* Print out the metadata. */
+  if (opt_info)
+    print_info (meta);
+
+  if (opt_branches)
+    print_branches (meta);
+
+  if (opt_metadata_branch)
+    print_metadata (meta, opt_metadata_branch);
+
+  return TRUE;
+}
+
+
+gboolean
+flatpak_complete_repo (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* LOCATION */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+
+      flatpak_complete_dir (completion);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-run.c b/app/flatpak-builtins-run.c
new file mode 100644 (file)
index 0000000..7067ecb
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+#include "flatpak-error.h"
+#include "flatpak-dbus.h"
+#include "flatpak-run.h"
+
+static char *opt_arch;
+static char *opt_branch;
+static char *opt_command;
+static gboolean opt_devel;
+static gboolean opt_log_session_bus;
+static gboolean opt_log_system_bus;
+static gboolean opt_log_a11y_bus;
+static gboolean opt_file_forwarding;
+static char *opt_runtime;
+static char *opt_runtime_version;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to use"), N_("ARCH") },
+  { "command", 0, 0, G_OPTION_ARG_STRING, &opt_command, N_("Command to run"), N_("COMMAND") },
+  { "branch", 0, 0, G_OPTION_ARG_STRING, &opt_branch, N_("Branch to use"), N_("BRANCH") },
+  { "devel", 'd', 0, G_OPTION_ARG_NONE, &opt_devel, N_("Use development runtime"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_STRING, &opt_runtime, N_("Runtime to use"), N_("RUNTIME") },
+  { "runtime-version", 0, 0, G_OPTION_ARG_STRING, &opt_runtime_version, N_("Runtime version to use"), N_("VERSION") },
+  { "log-session-bus", 0, 0, G_OPTION_ARG_NONE, &opt_log_session_bus, N_("Log session bus calls"), NULL },
+  { "log-system-bus", 0, 0, G_OPTION_ARG_NONE, &opt_log_system_bus, N_("Log system bus calls"), NULL },
+  { "log-a11y-bus", 0, 0, G_OPTION_ARG_NONE, &opt_log_a11y_bus, N_("Log accessibility bus calls"), NULL },
+  { "file-forwarding", 0, 0, G_OPTION_ARG_NONE, &opt_file_forwarding, N_("Enable file forwarding"), NULL },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakDeploy) app_deploy = NULL;
+  g_autofree char *app_ref = NULL;
+  g_autofree char *runtime_ref = NULL;
+  const char *pref;
+  int i;
+  int rest_argv_start, rest_argc;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+  g_autofree char *id = NULL;
+  g_autofree char *arch = NULL;
+  g_autofree char *branch = NULL;
+  FlatpakKinds kinds;
+  g_autoptr(GError) local_error = NULL;
+
+  context = g_option_context_new (_("APP [args...] - Run an app"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  rest_argc = 0;
+  for (i = 1; i < argc; i++)
+    {
+      /* The non-option is the command, take it out of the arguments */
+      if (argv[i][0] != '-')
+        {
+          rest_argv_start = i;
+          rest_argc = argc - i;
+          argc = i;
+          break;
+        }
+    }
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+    return FALSE;
+
+  if (rest_argc == 0)
+    return usage_error (context, _("APP must be specified"), error);
+
+  pref = argv[rest_argv_start];
+
+  if (!flatpak_split_partial_ref_arg (pref, FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME,
+                                      opt_arch, opt_branch,
+                                      &kinds, &id, &arch, &branch, error))
+    return FALSE;
+
+  if (branch == NULL || arch == NULL)
+    {
+      g_autofree char *current_ref = flatpak_find_current_ref (id, NULL, NULL);
+
+      if (current_ref)
+        {
+          g_auto(GStrv) parts = flatpak_decompose_ref (current_ref, NULL);
+          if (parts)
+            {
+              if (branch == NULL)
+                branch = g_strdup (parts[3]);
+              if (arch == NULL)
+                arch = g_strdup (parts[2]);
+            }
+        }
+    }
+
+  if ((kinds & FLATPAK_KINDS_APP) != 0)
+    {
+      app_ref = flatpak_compose_ref (TRUE, id, branch, arch, &local_error);
+      if (app_ref == NULL)
+        return FALSE;
+
+      app_deploy = flatpak_find_deploy_for_ref (app_ref, cancellable, &local_error);
+      if (app_deploy == NULL &&
+          (!g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED) ||
+           (kinds & FLATPAK_KINDS_RUNTIME) == 0))
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          return FALSE;
+        }
+      /* On error, local_error is set after this point so we can reuse
+         this error rather than later errors, as the app-kind error
+         is more likely interesting. */
+    }
+
+  if (app_deploy == NULL)
+    {
+      g_autoptr(FlatpakDeploy) runtime_deploy = NULL;
+      g_autoptr(GError) local_error2 = NULL;
+
+      runtime_ref = flatpak_compose_ref (FALSE, id, branch, arch, error);
+      if (runtime_ref == NULL)
+        return FALSE;
+
+      runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, cancellable, &local_error2);
+      if (runtime_deploy == NULL)
+        {
+          /* Report old app-kind error, as its more likely right */
+          if (local_error != NULL)
+            g_propagate_error (error, g_steal_pointer (&local_error));
+          else
+            g_propagate_error (error, g_steal_pointer (&local_error2));
+          return FALSE;
+        }
+      /* Clear app-kind error */
+      g_clear_error (&local_error);
+    }
+
+  if (!flatpak_run_app (app_deploy ? app_ref : runtime_ref,
+                        app_deploy,
+                        arg_context,
+                        opt_runtime,
+                        opt_runtime_version,
+                        (opt_devel ? FLATPAK_RUN_FLAG_DEVEL : 0) |
+                        (opt_log_session_bus ? FLATPAK_RUN_FLAG_LOG_SESSION_BUS : 0) |
+                        (opt_log_system_bus ? FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS : 0) |
+                        (opt_log_a11y_bus ? FLATPAK_RUN_FLAG_LOG_A11Y_BUS : 0) |
+                        (opt_file_forwarding ? FLATPAK_RUN_FLAG_FILE_FORWARDING : 0),
+                        opt_command,
+                        &argv[rest_argv_start + 1],
+                        rest_argc - 1,
+                        cancellable,
+                        error))
+    return FALSE;
+
+  /* Not actually reached... */
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_run (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  g_autoptr(GError) error = NULL;
+  int i, j;
+  g_autoptr(FlatpakContext) arg_context = NULL;
+
+  context = g_option_context_new ("");
+
+  arg_context = flatpak_context_new ();
+  g_option_context_add_group (context, flatpak_context_get_options (arg_context));
+
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL))
+    return FALSE;
+
+  switch (completion->argc)
+    {
+    case 0:
+    case 1: /* NAME */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_context_complete (arg_context, completion);
+
+      user_dir = flatpak_dir_get_user ();
+      {
+        g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, NULL, NULL, opt_arch,
+                                                              FLATPAK_KINDS_APP, &error);
+        if (refs == NULL)
+          flatpak_completion_debug ("find local refs error: %s", error->message);
+        for (i = 0; refs != NULL && refs[i] != NULL; i++)
+          {
+            g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+            if (parts)
+              flatpak_complete_word (completion, "%s ", parts[1]);
+          }
+      }
+
+      system_dirs = flatpak_dir_get_system_list (NULL, &error);
+      if (system_dirs == NULL) {
+        flatpak_completion_debug ("find system installations error: %s", error->message);
+        break;
+      }
+
+      for (i = 0; i < system_dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (system_dirs, i);
+          g_auto(GStrv) refs = flatpak_dir_find_installed_refs (dir, NULL, NULL, opt_arch,
+                                                                FLATPAK_KINDS_APP, &error);
+          if (refs == NULL)
+            flatpak_completion_debug ("find local refs error: %s", error->message);
+          for (j = 0; refs != NULL && refs[j] != NULL; j++)
+            {
+              g_auto(GStrv) parts = flatpak_decompose_ref (refs[j], NULL);
+              if (parts)
+                flatpak_complete_word (completion, "%s ", parts[1]);
+            }
+        }
+
+      break;
+
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-search.c b/app/flatpak-builtins-search.c
new file mode 100644 (file)
index 0000000..5cf55be
--- /dev/null
@@ -0,0 +1,303 @@
+/*
+ * Copyright © 2017 Patrick Griffis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Patrick Griffis <tingping@tingping.se>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include <appstream-glib.h>
+
+#include "flatpak-builtins.h"
+#include "flatpak-dir.h"
+#include "flatpak-table-printer.h"
+#include "flatpak-utils.h"
+
+static GPtrArray *
+get_remote_stores (GPtrArray *dirs, GCancellable *cancellable)
+{
+  GError *error = NULL;
+  GPtrArray *ret = g_ptr_array_new_with_free_func (g_object_unref);
+  guint i,j;
+  for (i = 0; i < dirs->len; ++i)
+    {
+      FlatpakDir *dir = g_ptr_array_index (dirs, i);
+      g_autofree char *install_path = NULL;
+      g_auto(GStrv) remotes = NULL;
+
+      flatpak_log_dir_access (dir);
+
+      install_path = g_file_get_path (flatpak_dir_get_path (dir));
+      remotes = flatpak_dir_list_enumerated_remotes (dir, cancellable, &error);
+      if (error)
+        {
+          g_warning ("%s", error->message);
+          g_clear_error (&error);
+          continue;
+        }
+      else if (remotes == NULL)
+        continue;
+
+      for (j = 0; remotes[j]; ++j)
+        {
+          g_autofree char *appstream_path = g_build_filename (install_path, "appstream", remotes[j],
+                                                              flatpak_get_arch(), "active", "appstream.xml.gz",
+                                                              NULL);
+          g_autoptr(GFile) appstream_file = g_file_new_for_path (appstream_path);
+          g_autoptr(AsStore) store = as_store_new ();
+#if AS_CHECK_VERSION(0, 6, 1)
+          // We want to see multiple versions/branches of same app-id's, e.g. org.gnome.Platform
+          as_store_set_add_flags (store, as_store_get_add_flags (store) | AS_STORE_ADD_FLAG_USE_UNIQUE_ID);
+#endif
+          as_store_from_file (store, appstream_file, NULL, cancellable, &error);
+          if (error)
+            {
+              // We want to ignore this error as it is harmless and valid
+              // NOTE: appstream-glib doesn't have granular file-not-found error
+              if (!g_str_has_suffix (error->message, "No such file or directory"))
+                g_warning ("%s", error->message);
+              g_clear_error (&error);
+              continue;
+            }
+
+          g_object_set_data_full (G_OBJECT(store), "remote-name", g_strdup(remotes[j]), g_free);
+          g_ptr_array_add (ret, g_steal_pointer (&store));
+        }
+    }
+  return ret;
+}
+
+typedef struct MatchResult {
+  AsApp *app;
+  GPtrArray *remotes;
+  guint score;
+} MatchResult;
+
+static void
+match_result_free (MatchResult *result)
+{
+  g_object_unref (result->app);
+  g_ptr_array_unref (result->remotes);
+  g_free (result);
+}
+
+static MatchResult *
+match_result_new (AsApp *app, guint score)
+{
+  MatchResult *result = g_new (MatchResult, 1);
+  result->app = g_object_ref (app);
+  result->remotes = g_ptr_array_new_with_free_func (g_free);
+  result->score = score;
+  return result;
+}
+
+static void
+match_result_add_remote (MatchResult *self, const char *remote)
+{
+  guint i;
+  for (i = 0; i < self->remotes->len; ++i)
+   {
+     const char *remote_entry = g_ptr_array_index (self->remotes, i);
+     if (!strcmp (remote, remote_entry))
+        return;
+   }
+   g_ptr_array_add (self->remotes, g_strdup(remote));
+}
+
+static int
+compare_by_score (MatchResult *a, MatchResult *b, gpointer user_data)
+{
+  // Reverse order, higher score comes first
+  return (int)b->score - (int)a->score;
+}
+
+#if !AS_CHECK_VERSION(0, 6, 1)
+/* Roughly copied directly from appstream-glib */
+
+static const gchar *
+as_app_fix_unique_nullable (const gchar *tmp)
+{
+  if (tmp == NULL || tmp[0] == '\0')
+    return "*";
+  return tmp;
+}
+
+static char *
+as_app_get_unique_id (AsApp *app)
+{
+  const gchar *id_str = NULL;
+  const gchar *kind_str = NULL;
+  AsAppKind kind = as_app_get_kind (app);
+
+  if (kind != AS_APP_KIND_UNKNOWN)
+    kind_str = as_app_kind_to_string (kind);
+  id_str = as_app_get_id_no_prefix (app);
+  return g_strdup_printf ("%s/%s",
+           as_app_fix_unique_nullable (kind_str),
+           as_app_fix_unique_nullable (id_str));
+}
+
+static gboolean
+as_app_equal (AsApp *app1, AsApp *app2)
+{
+  if (app1 == app2)
+    return TRUE;
+
+  g_autofree char *app1_id = as_app_get_unique_id (app1);
+  g_autofree char *app2_id = as_app_get_unique_id (app2);
+  return strcmp (app1_id, app2_id) == 0;
+}
+#endif
+
+static int
+compare_apps (MatchResult *a, AsApp *b)
+{
+  return !as_app_equal (a->app, b);
+}
+
+static const char *
+get_comment_localized (AsApp *app)
+{
+  const char * const * languages = g_get_language_names ();
+  gsize i;
+
+  for (i = 0; languages[i]; ++i)
+    {
+      const char *comment = as_app_get_comment (app, languages[i]);
+      if (comment != NULL)
+        return comment;
+    }
+  return NULL;
+}
+
+static void
+print_app (MatchResult *res, FlatpakTablePrinter *printer)
+{
+  AsRelease *release = as_app_get_release_default (res->app);
+  const char *version = release ? as_release_get_version (release) : NULL;
+  const char *id = as_app_get_id_filename (res->app);
+  guint i;
+
+  flatpak_table_printer_add_column (printer, id);
+  flatpak_table_printer_add_column (printer, version);
+#if AS_CHECK_VERSION(0, 6, 1)
+  flatpak_table_printer_add_column (printer, as_app_get_branch (res->app));
+#endif
+  flatpak_table_printer_add_column (printer, g_ptr_array_index (res->remotes, 0));
+  for (i = 1; i < res->remotes->len; ++i)
+    flatpak_table_printer_append_with_comma (printer, g_ptr_array_index (res->remotes, i));
+  flatpak_table_printer_add_column (printer, get_comment_localized (res->app));
+  flatpak_table_printer_finish_row (printer);
+}
+
+gboolean
+flatpak_builtin_search (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GPtrArray) dirs = NULL;
+  g_autoptr(GOptionContext) context = g_option_context_new (_("TEXT - Search remote apps/runtimes for text"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, NULL, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, &dirs, cancellable, error))
+    return FALSE;
+
+  if (argc < 2)
+    return usage_error (context, _("TEXT must be specified"), error);
+
+  const char *search_text = argv[1];
+  GSList *matches = NULL;
+  guint j;
+
+  // We want a store for each remote so we keep the remote information
+  // as AsApp doesn't currently contain that information
+  g_autoptr(GPtrArray) remote_stores = get_remote_stores (dirs, cancellable);
+  for (j = 0; j < remote_stores->len; ++j)
+    {
+      AsStore *store = g_ptr_array_index (remote_stores, j);
+      GPtrArray *apps = as_store_get_apps (store);
+      guint i;
+
+      for (i = 0; i < apps->len; ++i)
+        {
+          AsApp *app = g_ptr_array_index (apps, i);
+          guint score = as_app_search_matches (app, search_text);
+          if (score == 0)
+            {
+              const char *app_id = as_app_get_id_filename (app);
+              if (strcasestr (app_id, search_text) != NULL)
+                score = 50;
+              else
+                continue;
+            }
+
+          // Avoid duplicate entries, but show multiple remotes
+          GSList *list_entry = g_slist_find_custom (matches, app,
+                                 (GCompareFunc)compare_apps);
+          MatchResult *result = NULL;
+          if (list_entry != NULL)
+            result = list_entry->data;
+          else
+            {
+              result = match_result_new (app, score);
+              matches = g_slist_insert_sorted_with_data (matches, result,
+                          (GCompareDataFunc)compare_by_score, NULL);
+            }
+          match_result_add_remote (result,
+                                   g_object_get_data (G_OBJECT(store), "remote-name"));
+        }
+    }
+
+  if (matches != NULL)
+    {
+      FlatpakTablePrinter *printer = flatpak_table_printer_new ();
+      int col = 0;
+
+      flatpak_table_printer_set_column_title (printer, col++, _("Application ID"));
+      flatpak_table_printer_set_column_title (printer, col++, _("Version"));
+#if AS_CHECK_VERSION(0, 6, 1)
+      flatpak_table_printer_set_column_title (printer, col++, _("Branch"));
+#endif
+      flatpak_table_printer_set_column_title (printer, col++, _("Remotes"));
+      flatpak_table_printer_set_column_title (printer, col++, _("Description"));
+      g_slist_foreach (matches, (GFunc)print_app, printer);
+      flatpak_table_printer_print (printer);
+      flatpak_table_printer_free (printer);
+
+      g_slist_free_full (matches, (GDestroyNotify)match_result_free);
+    }
+  else
+    {
+      g_print ("%s\n", _("No matches found"));
+    }
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_search (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, NULL, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS, NULL, NULL, NULL))
+    return FALSE;
+
+  flatpak_complete_options (completion, global_entries);
+  flatpak_complete_options (completion, user_entries);
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-uninstall.c b/app/flatpak-builtins-uninstall.c
new file mode 100644 (file)
index 0000000..40eeb6d
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+
+static char *opt_arch;
+static gboolean opt_keep_ref;
+static gboolean opt_force_remove;
+static gboolean opt_no_related;
+static gboolean opt_runtime;
+static gboolean opt_app;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to uninstall"), N_("ARCH") },
+  { "keep-ref", 0, 0, G_OPTION_ARG_NONE, &opt_keep_ref, N_("Keep ref in local repository"), NULL },
+  { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, N_("Don't uninstall related refs"), NULL },
+  { "force-remove", 0, 0, G_OPTION_ARG_NONE, &opt_force_remove, N_("Remove files even if running"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Look for runtime with the specified name"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Look for app with the specified name"), NULL },
+  { NULL }
+};
+
+gboolean
+flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  char **prefs = NULL;
+  int i, j, n_prefs;
+  const char *default_branch = NULL;
+  g_autofree char *ref = NULL;
+  FlatpakHelperUninstallFlags flags = 0;
+  g_autoptr(GPtrArray) related = NULL;
+  FlatpakKinds kinds;
+  FlatpakKinds kind;
+  g_autoptr(GHashTable) uninstall_refs_hash = NULL;
+  g_autoptr(GPtrArray) uninstall_refs = NULL;
+
+  context = g_option_context_new (_("REF... - Uninstall an application"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  if (argc < 2)
+    return usage_error (context, _("Must specify at least one REF"), error);
+
+  prefs = &argv[1];
+  n_prefs = argc - 1;
+
+  /* Backwards compat for old "REPOSITORY NAME [BRANCH]" argument version */
+  if (argc == 3 && looks_like_branch (argv[2]))
+    {
+      default_branch = argv[2];
+      n_prefs = 1;
+    }
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+  uninstall_refs = g_ptr_array_new_with_free_func (g_free);
+  uninstall_refs_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  for (j = 0; j < n_prefs; j++)
+    {
+      const char *pref = NULL;
+      FlatpakKinds matched_kinds;
+      g_autofree char *id = NULL;
+      g_autofree char *arch = NULL;
+      g_autofree char *branch = NULL;
+      g_autoptr(GError) local_error = NULL;
+      g_autofree char *origin = NULL;
+
+      pref = prefs[j];
+
+      if (!flatpak_split_partial_ref_arg (pref, kinds, opt_arch, default_branch,
+                                          &matched_kinds, &id, &arch, &branch, error))
+        return FALSE;
+
+      ref = flatpak_dir_find_installed_ref (dir, id, branch, arch,
+                                            kinds, &kind, error);
+      if (ref == NULL)
+        return FALSE;
+
+      if (g_hash_table_insert (uninstall_refs_hash, g_strdup (ref), NULL))
+        g_ptr_array_add (uninstall_refs, g_strdup (ref));
+
+      /* TODO: when removing runtimes, look for apps that use it, require --force */
+
+      if (opt_no_related)
+        continue;
+
+      origin = flatpak_dir_get_origin (dir, ref, NULL, NULL);
+      if (origin == NULL)
+        continue;
+
+      related = flatpak_dir_find_local_related (dir, ref, origin,
+                                                NULL, &local_error);
+      if (related == NULL)
+        {
+          g_printerr (_("Warning: Problem looking for related refs: %s\n"),
+                      local_error->message);
+          continue;
+        }
+
+      for (i = 0; i < related->len; i++)
+        {
+          FlatpakRelated *rel = g_ptr_array_index (related, i);
+          g_autoptr(GVariant) deploy_data = NULL;
+
+          if (!rel->delete)
+            continue;
+
+          deploy_data = flatpak_dir_get_deploy_data (dir, rel->ref, NULL, NULL);
+
+          if (deploy_data != NULL &&
+              g_hash_table_insert (uninstall_refs_hash, g_strdup (rel->ref), NULL))
+            g_ptr_array_add (uninstall_refs, g_strdup (rel->ref));
+        }
+    }
+
+  if (opt_keep_ref)
+    flags |= FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF;
+  if (opt_force_remove)
+    flags |= FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE;
+
+  for (i = 0; i < uninstall_refs->len; i++)
+    {
+      const char *ref = (char *)g_ptr_array_index (uninstall_refs, i);
+      const char *pref = strchr (ref, '/') + 1;
+      g_print (_("Uninstalling: %s\n"), pref);
+      if (!flatpak_dir_uninstall (dir, ref, flags,
+                                  cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_uninstall (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  FlatpakKinds kinds;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, &dirs, NULL, NULL))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  switch (completion->argc)
+    {
+    case 0:
+    default: /* REF */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+      flatpak_complete_partial_ref (completion, kinds, opt_arch, dir, NULL);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-update.c b/app/flatpak-builtins-update.c
new file mode 100644 (file)
index 0000000..68f0e7f
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-transaction.h"
+#include "flatpak-utils.h"
+#include "flatpak-error.h"
+
+static char *opt_arch;
+static char *opt_commit;
+static char **opt_subpaths;
+static gboolean opt_force_remove;
+static gboolean opt_no_pull;
+static gboolean opt_no_deploy;
+static gboolean opt_no_related;
+static gboolean opt_no_deps;
+static gboolean opt_no_static_deltas;
+static gboolean opt_runtime;
+static gboolean opt_app;
+static gboolean opt_appstream;
+static gboolean opt_yes;
+
+static GOptionEntry options[] = {
+  { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Arch to update for"), N_("ARCH") },
+  { "commit", 0, 0, G_OPTION_ARG_STRING, &opt_commit, N_("Commit to deploy"), N_("COMMIT") },
+  { "force-remove", 0, 0, G_OPTION_ARG_NONE, &opt_force_remove, N_("Remove old files even if running"), NULL },
+  { "no-pull", 0, 0, G_OPTION_ARG_NONE, &opt_no_pull, N_("Don't pull, only update from local cache"), NULL },
+  { "no-deploy", 0, 0, G_OPTION_ARG_NONE, &opt_no_deploy, N_("Don't deploy, only download to local cache"), NULL },
+  { "no-related", 0, 0, G_OPTION_ARG_NONE, &opt_no_related, N_("Don't update related refs"), NULL},
+  { "no-deps", 0, 0, G_OPTION_ARG_NONE, &opt_no_deps, N_("Don't verify/install runtime dependencies"), NULL },
+  { "no-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_no_static_deltas, N_("Don't use static deltas"), NULL },
+  { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, N_("Look for runtime with the specified name"), NULL },
+  { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Look for app with the specified name"), NULL },
+  { "appstream", 0, 0, G_OPTION_ARG_NONE, &opt_appstream, N_("Update appstream for remote"), NULL },
+  { "subpath", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_subpaths, N_("Only update this subpath"), N_("PATH") },
+  { "assumeyes", 'y', 0, G_OPTION_ARG_NONE, &opt_yes, N_("Automatically answer yes for all questions"), NULL },
+  { NULL }
+};
+
+static void
+no_progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
+{
+}
+
+static gboolean
+update_appstream (GPtrArray *dirs, const char *remote, GCancellable *cancellable, GError **error)
+{
+  gboolean changed;
+  gboolean res;
+  int i, j;
+
+  if (opt_arch == NULL)
+    opt_arch = (char *)flatpak_get_arch ();
+
+  if (remote == NULL)
+    {
+      g_auto(GStrv) remotes = NULL;
+
+      for (j = 0; j < dirs->len; j++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, j);
+
+          remotes = flatpak_dir_list_remotes (dir, cancellable, error);
+          if (remotes == NULL)
+            return FALSE;
+
+          for (i = 0; remotes[i] != NULL; i++)
+            {
+              g_autoptr(GError) local_error = NULL;
+              g_autoptr(OstreeAsyncProgress) progress = NULL;
+
+              if (flatpak_dir_get_remote_disabled (dir, remotes[i]) ||
+                  flatpak_dir_get_remote_noenumerate (dir, remotes[i]) ||
+                  !flatpak_dir_check_for_appstream_update (dir, remotes[i], opt_arch))
+                continue;
+
+              if (flatpak_dir_is_user (dir))
+                g_print (_("Updating appstream data for user remote %s\n"), remotes[i]);
+              else
+                g_print (_("Updating appstream data for remote %s\n"), remotes[i]);
+              progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+              if (!flatpak_dir_update_appstream (dir, remotes[i], opt_arch, &changed,
+                                                 progress, cancellable, &local_error))
+                g_printerr (_("Error updating: %s\n"), local_error->message);
+              ostree_async_progress_finish (progress);
+            }
+        }
+    }
+  else
+    {
+      gboolean found = FALSE;
+
+      for (j = 0; j < dirs->len; j++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, j);
+
+          if (flatpak_dir_has_remote (dir, remote) &&
+              flatpak_dir_check_for_appstream_update (dir, remote, opt_arch))
+            {
+              g_autoptr(OstreeAsyncProgress) progress = NULL;
+
+              found = TRUE;
+
+              progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+              res = flatpak_dir_update_appstream (dir, remote, opt_arch, &changed,
+                                                  progress, cancellable, error);
+              ostree_async_progress_finish (progress);
+              if (!res)
+                return FALSE;
+            }
+        }
+
+      if (!found)
+        return flatpak_fail (error, _("Remote \"%s\" not found"), remote);
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_builtin_update (int           argc,
+                        char        **argv,
+                        GCancellable *cancellable,
+                        GError      **error)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  char **prefs = NULL;
+  int i, j, k, n_prefs;
+  const char *default_branch = NULL;
+  FlatpakKinds kinds;
+  g_autoptr(GPtrArray) transactions = NULL;
+
+  context = g_option_context_new (_("[REF...] - Update applications or runtimes"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  if (!flatpak_option_context_parse (context, options, &argc, &argv,
+                                     FLATPAK_BUILTIN_FLAG_STANDARD_DIRS,
+                                     &dirs, cancellable, error))
+    return FALSE;
+
+  if (opt_appstream)
+    return update_appstream (dirs, argc >= 2 ? argv[1] : NULL, cancellable, error);
+
+  prefs = &argv[1];
+  n_prefs = argc - 1;
+
+  /* Backwards compat for old "REPOSITORY NAME [BRANCH]" argument version */
+  if (argc == 3 && looks_like_branch (argv[2]))
+    {
+      default_branch = argv[2];
+      n_prefs = 1;
+    }
+
+  transactions = g_ptr_array_new_with_free_func ((GDestroyNotify)flatpak_transaction_free);
+
+  for (k = 0; k < dirs->len; k++)
+    {
+      FlatpakTransaction *transaction = flatpak_transaction_new (g_ptr_array_index (dirs, k),
+                                                                 opt_yes, opt_no_pull, opt_no_deploy,
+                                                                 opt_no_static_deltas, !opt_no_deps, !opt_no_related, FALSE);
+      g_ptr_array_add (transactions, transaction);
+    }
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  g_print (_("Looking for updates...\n"));
+
+  for (j = 0; j == 0 || j < n_prefs; j++)
+    {
+      const char *pref = NULL;
+      FlatpakKinds matched_kinds;
+      g_autofree char *id = NULL;
+      g_autofree char *arch = NULL;
+      g_autofree char *branch = NULL;
+      gboolean found = FALSE;
+
+      if (n_prefs == 0)
+        {
+          matched_kinds = kinds;
+        }
+      else
+        {
+          pref = prefs[j];
+          if (!flatpak_split_partial_ref_arg (pref, kinds, opt_arch, default_branch,
+                                              &matched_kinds, &id, &arch, &branch, error))
+            return FALSE;
+        }
+
+      for (k = 0; k < dirs->len; k++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, k);
+          FlatpakTransaction *transaction = g_ptr_array_index (transactions, k);
+
+          if (kinds & FLATPAK_KINDS_APP)
+            {
+              g_auto(GStrv) refs = NULL;
+
+              if (!flatpak_dir_list_refs (dir, "app", &refs,
+                                          cancellable,
+                                          error))
+                return FALSE;
+
+              for (i = 0; refs != NULL && refs[i] != NULL; i++)
+                {
+                  g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], error);
+                  if (parts == NULL)
+                    return FALSE;
+
+                  if (id != NULL && strcmp (parts[1], id) != 0)
+                    continue;
+
+                  if (arch != NULL && strcmp (parts[2], arch) != 0)
+                    continue;
+
+                  if (branch != NULL && strcmp (parts[3], branch) != 0)
+                    continue;
+
+                  found = TRUE;
+                  if (!flatpak_transaction_add_update (transaction, refs[i], (const char **)opt_subpaths, opt_commit, error))
+                    return FALSE;
+                }
+            }
+
+          if (kinds & FLATPAK_KINDS_RUNTIME)
+            {
+              g_auto(GStrv) refs = NULL;
+
+              if (!flatpak_dir_list_refs (dir, "runtime", &refs,
+                                          cancellable,
+                                          error))
+                return FALSE;
+
+              for (i = 0; refs != NULL && refs[i] != NULL; i++)
+                {
+                  g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], error);
+
+                  if (parts == NULL)
+                    return FALSE;
+
+                  if (id != NULL && strcmp (parts[1], id) != 0)
+                    continue;
+
+                  if (arch != NULL && strcmp (parts[2], arch) != 0)
+                    continue;
+
+                  if (branch != NULL && strcmp (parts[3], branch) != 0)
+                    continue;
+
+                  found = TRUE;
+                  if (!flatpak_transaction_add_update (transaction, refs[i], (const char **)opt_subpaths, opt_commit, error))
+                    return FALSE;
+                }
+            }
+        }
+
+      if (n_prefs > 0 && !found)
+        {
+          g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                       "%s not installed", pref);
+          return FALSE;
+        }
+    }
+
+  for (k = 0; k < dirs->len; k++)
+    {
+      FlatpakTransaction *transaction = g_ptr_array_index (transactions, k);
+
+      if (!flatpak_transaction_is_empty (transaction))
+        {
+          if (!flatpak_transaction_update_metadata (transaction, n_prefs == 0, cancellable, error))
+            return FALSE;
+
+          if (!flatpak_transaction_run (transaction, FALSE, cancellable, error))
+            return FALSE;
+        }
+    }
+
+  if (n_prefs == 0)
+    return update_appstream (dirs, NULL, cancellable, error);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_complete_update (FlatpakCompletion *completion)
+{
+  g_autoptr(GOptionContext) context = NULL;
+  g_autoptr(GPtrArray) dirs = NULL;
+  FlatpakDir *dir;
+  FlatpakKinds kinds;
+
+  context = g_option_context_new ("");
+  if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv,
+                                     FLATPAK_BUILTIN_FLAG_ONE_DIR, &dirs, NULL, NULL))
+    return FALSE;
+
+  dir = g_ptr_array_index (dirs, 0);
+
+  kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
+
+  switch (completion->argc)
+    {
+    case 0:
+    default: /* REF */
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, options);
+      flatpak_complete_options (completion, user_entries);
+      flatpak_complete_partial_ref (completion, kinds, opt_arch, dir, NULL);
+      break;
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
new file mode 100644 (file)
index 0000000..0c87491
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+
+#include <gio/gunixinputstream.h>
+#include "flatpak-chain-input-stream.h"
+
+#include "flatpak-builtins-utils.h"
+#include "flatpak-utils.h"
+
+
+gboolean
+looks_like_branch (const char *branch)
+{
+  const char *dot;
+
+  /* In particular, / is not a valid branch char, so
+     this lets us distinguish full or partial refs as
+     non-branches. */
+  if (!flatpak_is_valid_branch (branch, NULL))
+    return FALSE;
+
+  /* Dots are allowed in branches, but not really used much, while
+     app ids require at least two, so thats a good check to
+     distinguish the two */
+  dot = strchr (branch, '.');
+  if (dot != NULL)
+    {
+      if (strchr (dot + 1, '.') != NULL)
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static SoupSession *
+get_soup_session (void)
+{
+  static SoupSession *soup_session = NULL;
+
+  if (soup_session == NULL)
+    {
+      const char *http_proxy;
+
+      soup_session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, "flatpak-builder ",
+                                                    SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
+                                                    SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
+                                                    SOUP_SESSION_TIMEOUT, 60,
+                                                    SOUP_SESSION_IDLE_TIMEOUT, 60,
+                                                    NULL);
+      http_proxy = g_getenv ("http_proxy");
+      if (http_proxy)
+        {
+          g_autoptr(SoupURI) proxy_uri = soup_uri_new (http_proxy);
+          if (!proxy_uri)
+            g_warning ("Invalid proxy URI '%s'", http_proxy);
+          else
+            g_object_set (soup_session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
+        }
+    }
+
+  return soup_session;
+}
+
+GBytes *
+download_uri (const char     *url,
+              GError        **error)
+{
+  SoupSession *session;
+  g_autoptr(SoupRequest) req = NULL;
+  g_autoptr(GInputStream) input = NULL;
+  g_autoptr(GOutputStream) out = NULL;
+
+  session = get_soup_session ();
+
+  req = soup_session_request (session, url, error);
+  if (req == NULL)
+    return NULL;
+
+  input = soup_request_send (req, NULL, error);
+  if (input == NULL)
+    return NULL;
+
+  out = g_memory_output_stream_new_resizable ();
+  if (!g_output_stream_splice (out,
+                               input,
+                               G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+                               NULL,
+                               error))
+    return NULL;
+
+  return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (out));
+}
+
+FlatpakDir *
+flatpak_find_installed_pref (const char *pref, FlatpakKinds kinds, const char *default_arch, const char *default_branch,
+                             gboolean search_all, gboolean search_user, gboolean search_system, char **search_installations,
+                             char **out_ref, GCancellable *cancellable, GError **error)
+{
+  g_autofree char *id = NULL;
+  g_autofree char *arch = NULL;
+  g_autofree char *branch = NULL;
+  g_autoptr(GError) lookup_error = NULL;
+  FlatpakDir *dir = NULL;
+  g_autofree char *ref = NULL;
+  FlatpakKinds kind = 0;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(FlatpakDir) system_dir = NULL;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+
+  if (!flatpak_split_partial_ref_arg (pref, kinds, default_arch, default_branch,
+                                      &kinds, &id, &arch, &branch, error))
+    return NULL;
+
+  if (search_user || search_all)
+    {
+      user_dir = flatpak_dir_get_user ();
+
+      ref = flatpak_dir_find_installed_ref (user_dir,
+                                            id,
+                                            branch,
+                                            arch,
+                                            kinds, &kind,
+                                            &lookup_error);
+      if (ref)
+        dir = user_dir;
+
+      if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
+        {
+          g_propagate_error (error, g_steal_pointer (&lookup_error));
+          return NULL;
+        }
+    }
+
+  if (ref == NULL && search_all)
+    {
+      int i;
+
+      system_dirs = flatpak_dir_get_system_list (cancellable, error);
+      if (system_dirs == NULL)
+        return FALSE;
+
+      for (i = 0; i < system_dirs->len; i++)
+        {
+          FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+
+          g_clear_error (&lookup_error);
+
+          ref = flatpak_dir_find_installed_ref (system_dir,
+                                                id,
+                                                branch,
+                                                arch,
+                                                kinds, &kind,
+                                                &lookup_error);
+          if (ref)
+            {
+              dir = system_dir;
+              break;
+            }
+
+          if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
+            {
+              g_propagate_error (error, g_steal_pointer (&lookup_error));
+              return NULL;
+            }
+        }
+    }
+  else
+    {
+      if (ref == NULL && search_installations != NULL)
+        {
+          int i = 0;
+
+          for (i = 0; search_installations[i] != NULL; i++)
+            {
+              g_autoptr(FlatpakDir) installation_dir = NULL;
+
+              installation_dir = flatpak_dir_get_system_by_id (search_installations[i], cancellable, error);
+              if (installation_dir == NULL)
+                return FALSE;
+
+              if (installation_dir)
+                {
+                  g_clear_error (&lookup_error);
+
+                  ref = flatpak_dir_find_installed_ref (installation_dir,
+                                                        id,
+                                                        branch,
+                                                        arch,
+                                                        kinds, &kind,
+                                                        &lookup_error);
+                  if (ref)
+                    {
+                      dir = installation_dir;
+                      break;
+                    }
+
+                  if (g_error_matches (lookup_error, G_IO_ERROR, G_IO_ERROR_FAILED))
+                    {
+                      g_propagate_error (error, g_steal_pointer (&lookup_error));
+                      return NULL;
+                    }
+                }
+            }
+        }
+
+      if (ref == NULL && search_system)
+        {
+          system_dir = flatpak_dir_get_system_default ();
+
+          g_clear_error (&lookup_error);
+
+          ref = flatpak_dir_find_installed_ref (system_dir,
+                                                id,
+                                                branch,
+                                                arch,
+                                                kinds, &kind,
+                                                &lookup_error);
+
+          if (ref)
+            dir = system_dir;
+        }
+    }
+
+  if (ref == NULL)
+    {
+      g_propagate_error (error, g_steal_pointer (&lookup_error));
+      return NULL;
+    }
+
+  *out_ref = g_steal_pointer (&ref);
+  return g_object_ref (dir);
+}
+
+
+static gboolean
+open_source_stream (char **gpg_import,
+                    GInputStream **out_source_stream,
+                    GCancellable  *cancellable,
+                    GError       **error)
+{
+  g_autoptr(GInputStream) source_stream = NULL;
+  guint n_keyrings = 0;
+  g_autoptr(GPtrArray) streams = NULL;
+
+  if (gpg_import != NULL)
+    n_keyrings = g_strv_length (gpg_import);
+
+  guint ii;
+
+  streams = g_ptr_array_new_with_free_func (g_object_unref);
+
+  for (ii = 0; ii < n_keyrings; ii++)
+    {
+      GInputStream *input_stream = NULL;
+
+      if (strcmp (gpg_import[ii], "-") == 0)
+        {
+          input_stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
+        }
+      else
+        {
+          g_autoptr(GFile) file = g_file_new_for_commandline_arg (gpg_import[ii]);
+          input_stream = G_INPUT_STREAM (g_file_read (file, cancellable, error));
+
+          if (input_stream == NULL)
+            {
+              g_prefix_error (error, "The file %s specified for --gpg-import was not found: ", gpg_import[ii]);
+              return FALSE;
+            }
+        }
+
+      /* Takes ownership. */
+      g_ptr_array_add (streams, input_stream);
+    }
+
+  /* Chain together all the --keyring options as one long stream. */
+  source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
+
+  *out_source_stream = g_steal_pointer (&source_stream);
+
+  return TRUE;
+}
+
+GBytes *
+flatpak_load_gpg_keys (char **gpg_import,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  g_autoptr(GInputStream) input_stream = NULL;
+  g_autoptr(GOutputStream) output_stream = NULL;
+  gssize n_bytes_written;
+
+  if (!open_source_stream (gpg_import, &input_stream, cancellable, error))
+    return FALSE;
+
+  output_stream = g_memory_output_stream_new_resizable ();
+
+  n_bytes_written = g_output_stream_splice (output_stream, input_stream,
+                                            G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
+                                            G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
+                                            NULL, error);
+  if (n_bytes_written < 0)
+    return NULL;
+
+  return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (output_stream));
+}
+
+gboolean
+flatpak_resolve_duplicate_remotes (GPtrArray    *dirs,
+                                   const char   *remote_name,
+                                   FlatpakDir  **out_dir,
+                                   GCancellable *cancellable,
+                                   GError      **error)
+{
+  g_autoptr(GPtrArray) dirs_with_remote = NULL;
+  int chosen = 0;
+  int i;
+
+  dirs_with_remote = g_ptr_array_new ();
+  for (i = 0; i < dirs->len; i++)
+    {
+      FlatpakDir *dir = g_ptr_array_index (dirs, i);
+      g_auto(GStrv) remotes = NULL;
+      int j = 0;
+
+      remotes = flatpak_dir_list_remotes (dir, cancellable, error);
+      if (remotes == NULL)
+        return FALSE;
+
+      for (j = 0; remotes[j] != NULL; j++)
+        {
+          const char *this_remote = remotes[j];
+
+          if (g_strcmp0 (remote_name, this_remote) == 0)
+            g_ptr_array_add (dirs_with_remote, dir);
+        }
+    }
+
+  if (dirs_with_remote->len == 1)
+    chosen = 1;
+  else if (dirs_with_remote->len > 1)
+    {
+      g_print (_("Remote ‘%s’ found in multiple installations:\n"), remote_name);
+      for (i = 0; i < dirs_with_remote->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs_with_remote, i);
+          g_autofree char *dir_name = flatpak_dir_get_name (dir);
+          g_print("%d) %s\n", i + 1, dir_name);
+        }
+      chosen = flatpak_number_prompt (1, dirs_with_remote->len, _("Which do you want to use (0 to abort)?"));
+      if (chosen == 0)
+        return flatpak_fail (error, _("No remote chosen to resolve ‘%s’ which exists in multiple installations"), remote_name);
+    }
+
+  if (out_dir)
+    {
+      if (dirs_with_remote->len == 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                       "Remote \"%s\" not found", remote_name);
+          return FALSE;
+        }
+      else
+        *out_dir = g_object_ref (g_ptr_array_index (dirs_with_remote, chosen - 1));
+    }
+
+  return TRUE;
+}
diff --git a/app/flatpak-builtins-utils.h b/app/flatpak-builtins-utils.h
new file mode 100644 (file)
index 0000000..1ce4aaf
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_BUILTINS_UTILS_H__
+#define __FLATPAK_BUILTINS_UTILS_H__
+
+#include <glib.h>
+#include "libglnx/libglnx.h"
+#include "flatpak-utils.h"
+#include "flatpak-dir.h"
+
+gboolean    looks_like_branch (const char  *branch);
+GBytes *    download_uri      (const char  *url,
+                               GError     **error);
+
+GBytes * flatpak_load_gpg_keys (char **gpg_import,
+                                GCancellable *cancellable,
+                                GError      **error);
+
+FlatpakDir * flatpak_find_installed_pref (const char *pref,
+                                          FlatpakKinds kinds,
+                                          const char *default_arch,
+                                          const char *default_branch,
+                                          gboolean search_all,
+                                          gboolean search_user,
+                                          gboolean search_system,
+                                          char **search_installations,
+                                          char **out_ref,
+                                          GCancellable *cancellable,
+                                          GError **error);
+
+gboolean flatpak_resolve_duplicate_remotes (GPtrArray    *dirs,
+                                            const char   *remote_name,
+                                            FlatpakDir  **out_dir,
+                                            GCancellable *cancellable,
+                                            GError      **error);
+
+#endif /* __FLATPAK_BUILTINS_UTILS_H__ */
diff --git a/app/flatpak-builtins.h b/app/flatpak-builtins.h
new file mode 100644 (file)
index 0000000..17c4ced
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_BUILTINS_H__
+#define __FLATPAK_BUILTINS_H__
+
+#include <ostree.h>
+#include <gio/gio.h>
+
+#include "flatpak-utils.h"
+#include "flatpak-dir.h"
+
+G_BEGIN_DECLS
+
+typedef enum {
+  FLATPAK_BUILTIN_FLAG_NO_DIR = 1 << 0,
+  FLATPAK_BUILTIN_FLAG_OPTIONAL_REPO = 1 << 1,
+  FLATPAK_BUILTIN_FLAG_ONE_DIR = 1 << 2,
+  FLATPAK_BUILTIN_FLAG_STANDARD_DIRS = 1 << 3,
+  FLATPAK_BUILTIN_FLAG_ALL_DIRS = 1 << 4,
+} FlatpakBuiltinFlags;
+
+gboolean flatpak_option_context_parse (GOptionContext     *context,
+                                       const GOptionEntry *main_entries,
+                                       int                *argc,
+                                       char             ***argv,
+                                       FlatpakBuiltinFlags flags,
+                                       GPtrArray         **out_dirs,
+                                       GCancellable       *cancellable,
+                                       GError            **error);
+
+extern GOptionEntry user_entries[];
+extern GOptionEntry global_entries[];
+
+gboolean usage_error (GOptionContext *context,
+                      const char     *message,
+                      GError        **error);
+
+#define BUILTINPROTO(name) \
+  gboolean flatpak_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError * *error); \
+  gboolean flatpak_complete_ ## name (FlatpakCompletion *completion);
+
+
+BUILTINPROTO (add_remote)
+BUILTINPROTO (modify_remote)
+BUILTINPROTO (delete_remote)
+BUILTINPROTO (ls_remote)
+BUILTINPROTO (info_remote)
+BUILTINPROTO (list_remotes)
+BUILTINPROTO (install)
+BUILTINPROTO (update)
+BUILTINPROTO (make_current_app)
+BUILTINPROTO (uninstall)
+BUILTINPROTO (install_bundle)
+BUILTINPROTO (list)
+BUILTINPROTO (info)
+BUILTINPROTO (run)
+BUILTINPROTO (enter)
+BUILTINPROTO (build_init)
+BUILTINPROTO (build)
+BUILTINPROTO (build_finish)
+BUILTINPROTO (build_sign)
+BUILTINPROTO (build_export)
+BUILTINPROTO (build_bundle)
+BUILTINPROTO (build_import)
+BUILTINPROTO (build_commit_from)
+BUILTINPROTO (build_update_repo)
+BUILTINPROTO (document_export)
+BUILTINPROTO (document_unexport)
+BUILTINPROTO (document_info)
+BUILTINPROTO (document_list)
+BUILTINPROTO (override)
+BUILTINPROTO (repo)
+BUILTINPROTO (config)
+BUILTINPROTO (search)
+
+#undef BUILTINPROTO
+
+G_END_DECLS
+
+#endif /* __FLATPAK_BUILTINS_H__ */
diff --git a/app/flatpak-main.c b/app/flatpak-main.c
new file mode 100644 (file)
index 0000000..a34ed9e
--- /dev/null
@@ -0,0 +1,617 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include "libglnx/libglnx.h"
+
+#include "flatpak-builtins.h"
+#include "flatpak-utils.h"
+
+static int opt_verbose;
+static gboolean opt_ostree_verbose;
+static gboolean opt_version;
+static gboolean opt_default_arch;
+static gboolean opt_supported_arches;
+static gboolean opt_gl_drivers;
+static gboolean opt_user;
+static gboolean opt_system;
+static char **opt_installations;
+
+static gboolean is_in_complete;
+
+typedef struct
+{
+  const char *name;
+  const char *description;
+  gboolean (*fn)(int           argc,
+                 char        **argv,
+                 GCancellable *cancellable,
+                 GError      **error);
+  gboolean (*complete)(FlatpakCompletion *completion);
+  gboolean    deprecated;
+} FlatpakCommand;
+
+static FlatpakCommand commands[] = {
+   /* translators: please keep the leading space */
+  { N_(" Manage installed apps and runtimes") },
+  { "install", N_("Install an application or runtime"), flatpak_builtin_install, flatpak_complete_install },
+  { "update", N_("Update an installed application or runtime"), flatpak_builtin_update, flatpak_complete_update },
+  { "uninstall", N_("Uninstall an installed application or runtime"), flatpak_builtin_uninstall, flatpak_complete_uninstall },
+  { "list", N_("List installed apps and/or runtimes"), flatpak_builtin_list, flatpak_complete_list },
+  { "info", N_("Show info for installed app or runtime"), flatpak_builtin_info, flatpak_complete_info },
+  { "config", N_("Configure flatpak"), flatpak_builtin_config, flatpak_complete_config },
+
+   /* translators: please keep the leading newline and space */
+  { N_("\n Finding applications and runtimes") },
+  { "search", N_("Search for remote apps/runtimes"), flatpak_builtin_search, flatpak_complete_search },
+
+   /* translators: please keep the leading newline and space */
+  { N_("\n Running applications") },
+  { "run", N_("Run an application"), flatpak_builtin_run, flatpak_complete_run },
+  { "override", N_("Override permissions for an application"), flatpak_builtin_override, flatpak_complete_override },
+  { "make-current", N_("Specify default version to run"), flatpak_builtin_make_current_app, flatpak_complete_make_current_app },
+  { "enter", N_("Enter the namespace of a running application"), flatpak_builtin_enter, flatpak_complete_enter },
+
+   /* translators: please keep the leading newline and space */
+  { N_("\n Manage file access") },
+  { "document-export", N_("Grant an application access to a specific file"), flatpak_builtin_document_export, flatpak_complete_document_export },
+  { "document-unexport", N_("Revoke access to a specific file"), flatpak_builtin_document_unexport, flatpak_complete_document_unexport },
+  { "document-info", N_("Show information about a specific file"), flatpak_builtin_document_info, flatpak_complete_document_info },
+  { "document-list", N_("List exported files"), flatpak_builtin_document_list, flatpak_complete_document_list },
+
+   /* translators: please keep the leading newline and space */
+  { N_("\n Manage remote repositories") },
+  { "remotes", N_("List all configured remotes"), flatpak_builtin_list_remotes, flatpak_complete_list_remotes },
+  { "remote-add", N_("Add a new remote repository (by URL)"), flatpak_builtin_add_remote, flatpak_complete_add_remote },
+  { "remote-modify", N_("Modify properties of a configured remote"), flatpak_builtin_modify_remote, flatpak_complete_modify_remote },
+  { "remote-delete", N_("Delete a configured remote"), flatpak_builtin_delete_remote, flatpak_complete_delete_remote },
+  { "remote-list", NULL, flatpak_builtin_list_remotes, flatpak_complete_list_remotes, TRUE },
+  { "remote-ls", N_("List contents of a configured remote"), flatpak_builtin_ls_remote, flatpak_complete_ls_remote },
+  { "remote-info", N_("Show information about a remote app or runtime"), flatpak_builtin_info_remote, flatpak_complete_info_remote },
+
+   /* translators: please keep the leading newline and space */
+  { N_("\n Build applications") },
+  { "build-init", N_("Initialize a directory for building"), flatpak_builtin_build_init, flatpak_complete_build_init },
+  { "build", N_("Run a build command inside the build dir"), flatpak_builtin_build, flatpak_complete_build  },
+  { "build-finish", N_("Finish a build dir for export"), flatpak_builtin_build_finish, flatpak_complete_build_finish },
+  { "build-export", N_("Export a build dir to a repository"), flatpak_builtin_build_export, flatpak_complete_build_export },
+  { "build-bundle", N_("Create a bundle file from a build directory"), flatpak_builtin_build_bundle, flatpak_complete_build_bundle },
+  { "build-import-bundle", N_("Import a bundle file"), flatpak_builtin_build_import, flatpak_complete_build_import },
+  { "build-sign", N_("Sign an application or runtime"), flatpak_builtin_build_sign, flatpak_complete_build_sign },
+  { "build-update-repo", N_("Update the summary file in a repository"), flatpak_builtin_build_update_repo, flatpak_complete_build_update_repo },
+  { "build-commit-from", N_("Create new commit based on existing ref"), flatpak_builtin_build_commit_from, flatpak_complete_build_commit_from },
+  { "repo", N_("Print information about a repo"), flatpak_builtin_repo, flatpak_complete_repo },
+
+  { NULL }
+};
+
+static gboolean
+opt_verbose_cb (const gchar *option_name,
+                const gchar *value,
+                gpointer     data,
+                GError     **error)
+{
+  opt_verbose++;
+  return TRUE;
+}
+
+
+GOptionEntry global_entries[] = {
+  { "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &opt_verbose_cb, N_("Print debug information during command processing, -vv for more detail"), NULL },
+  { "ostree-verbose", 0, 0, G_OPTION_ARG_NONE, &opt_ostree_verbose, N_("Print OSTree debug information during command processing"), NULL },
+  { "help", '?', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, N_("Show help options"), NULL, NULL },
+  { NULL }
+};
+
+static GOptionEntry empty_entries[] = {
+  { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, N_("Print version information and exit"), NULL },
+  { "default-arch", 0, 0, G_OPTION_ARG_NONE, &opt_default_arch, N_("Print default arch and exit"), NULL },
+  { "supported-arches", 0, 0, G_OPTION_ARG_NONE, &opt_supported_arches, N_("Print supported arches and exit"), NULL },
+  { "gl-drivers", 0, 0, G_OPTION_ARG_NONE, &opt_gl_drivers, N_("Print active gl drivers and exit"), NULL },
+  { NULL }
+};
+
+GOptionEntry user_entries[] = {
+  { "user", 0, 0, G_OPTION_ARG_NONE, &opt_user, N_("Work on user installations"), NULL },
+  { "system", 0, 0, G_OPTION_ARG_NONE, &opt_system, N_("Work on system-wide installations (default)"), NULL },
+  { "installation", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_installations, N_("Work on specific system-wide installation(s)"), N_("NAME") },
+  { NULL }
+};
+
+static void
+message_handler (const gchar   *log_domain,
+                 GLogLevelFlags log_level,
+                 const gchar   *message,
+                 gpointer       user_data)
+{
+  /* Make this look like normal console output */
+  if (log_level & G_LOG_LEVEL_DEBUG)
+    g_printerr ("F: %s\n", message);
+  else
+    g_printerr ("%s: %s\n", g_get_prgname (), message);
+}
+
+static GOptionContext *
+flatpak_option_context_new_with_commands (FlatpakCommand *commands)
+{
+  GOptionContext *context;
+  GString *summary;
+
+  context = g_option_context_new (_("COMMAND"));
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+
+  summary = g_string_new (_("Builtin Commands:"));
+
+  while (commands->name != NULL)
+    {
+      if (!commands->deprecated)
+        {
+          if (commands->fn != NULL)
+            {
+              g_string_append_printf (summary, "\n  %s", commands->name);
+              if (commands->description)
+                g_string_append_printf (summary, "%*s%s", (int) (20 - strlen (commands->name)), "", _(commands->description));
+            }
+          else
+            {
+              g_string_append_printf (summary, "\n%s", _(commands->name));
+            }
+        }
+      commands++;
+    }
+
+  g_option_context_set_summary (context, summary->str);
+
+  g_string_free (summary, TRUE);
+
+  return context;
+}
+
+static int
+flatpak_usage (FlatpakCommand *commands,
+               gboolean        is_error)
+{
+  GOptionContext *context;
+  g_autofree char *help = NULL;
+
+  context = flatpak_option_context_new_with_commands (commands);
+
+  g_option_context_add_main_entries (context, global_entries, NULL);
+
+  help = g_option_context_get_help (context, FALSE, NULL);
+
+  if (is_error)
+    g_printerr ("%s", help);
+  else
+    g_print ("%s", help);
+
+  g_option_context_free (context);
+
+  return is_error ? 1 : 0;
+}
+
+gboolean
+flatpak_option_context_parse (GOptionContext     *context,
+                              const GOptionEntry *main_entries,
+                              int                *argc,
+                              char             ***argv,
+                              FlatpakBuiltinFlags flags,
+                              GPtrArray         **out_dirs,
+                              GCancellable       *cancellable,
+                              GError            **error)
+{
+  g_autoptr(GPtrArray) dirs = NULL;
+
+  if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR) &&
+      !(flags & FLATPAK_BUILTIN_FLAG_ONE_DIR) &&
+      !(flags & FLATPAK_BUILTIN_FLAG_STANDARD_DIRS) &&
+      !(flags & FLATPAK_BUILTIN_FLAG_ALL_DIRS))
+    g_assert_not_reached ();
+
+  if (flags & FLATPAK_BUILTIN_FLAG_NO_DIR &&
+      (flags & FLATPAK_BUILTIN_FLAG_ONE_DIR ||
+       flags & FLATPAK_BUILTIN_FLAG_STANDARD_DIRS ||
+       flags & FLATPAK_BUILTIN_FLAG_ALL_DIRS))
+    g_assert_not_reached ();
+
+  if (flags & FLATPAK_BUILTIN_FLAG_ONE_DIR &&
+      (flags & FLATPAK_BUILTIN_FLAG_STANDARD_DIRS ||
+       flags & FLATPAK_BUILTIN_FLAG_ALL_DIRS))
+    g_assert_not_reached ();
+
+  if (flags & FLATPAK_BUILTIN_FLAG_STANDARD_DIRS &&
+      flags & FLATPAK_BUILTIN_FLAG_ALL_DIRS)
+    g_assert_not_reached ();
+
+  if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
+    g_option_context_add_main_entries (context, user_entries, NULL);
+
+  if (main_entries != NULL)
+    g_option_context_add_main_entries (context, main_entries, NULL);
+
+  g_option_context_add_main_entries (context, global_entries, NULL);
+
+  if (!g_option_context_parse (context, argc, argv, error))
+    return FALSE;
+
+  /* We never want verbose output in the complete case, that breaks completion */
+  if (!is_in_complete)
+    {
+      if (opt_verbose > 0)
+        g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+      if (opt_verbose > 1)
+        g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG, message_handler, NULL);
+
+      if (opt_ostree_verbose)
+        g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG, message_handler, NULL);
+    }
+
+  if (opt_version)
+    {
+      g_print ("%s\n", PACKAGE_STRING);
+      exit (EXIT_SUCCESS);
+    }
+
+  if (opt_default_arch)
+    {
+      g_print ("%s\n", flatpak_get_arch ());
+      exit (EXIT_SUCCESS);
+    }
+
+  if (opt_supported_arches)
+    {
+      const char **arches = flatpak_get_arches ();
+      int i;
+      for (i = 0; arches[i] != NULL; i++)
+        g_print ("%s\n", arches[i]);
+      exit (EXIT_SUCCESS);
+    }
+
+  if (opt_gl_drivers)
+    {
+      const char **drivers = flatpak_get_gl_drivers ();
+      int i;
+      for (i = 0; drivers[i] != NULL; i++)
+        g_print ("%s\n", drivers[i]);
+      exit (EXIT_SUCCESS);
+    }
+
+  if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
+    {
+      dirs = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+      int i;
+
+      if (!(flags & FLATPAK_BUILTIN_FLAG_ONE_DIR))
+        {
+          /*
+           * FLATPAK_BUILTIN_FLAG_STANDARD_DIRS or FLATPAK_BUILTIN_FLAG_ALL_DIRS
+           * must be set.
+           */
+          if (opt_user || (!opt_system && opt_installations == NULL))
+            g_ptr_array_add (dirs, flatpak_dir_get_user ());
+
+          if (opt_system || (!opt_user && opt_installations == NULL))
+            g_ptr_array_add (dirs, flatpak_dir_get_system_default ());
+
+          if (opt_installations != NULL)
+            {
+              for (i = 0; opt_installations[i] != NULL; i++)
+                {
+                  FlatpakDir *installation_dir = NULL;
+
+                  /* Already included the default system installation */
+                  if (opt_system && g_strcmp0 (opt_installations[i], "default") == 0)
+                    continue;
+
+                  installation_dir = flatpak_dir_get_system_by_id (opt_installations[i], cancellable, error);
+                  if (installation_dir == NULL)
+                    return FALSE;
+
+                  g_ptr_array_add (dirs, installation_dir);
+                }
+            }
+
+          if (flags & FLATPAK_BUILTIN_FLAG_ALL_DIRS &&
+              opt_installations == NULL && !opt_user && !opt_system)
+            {
+              g_autoptr(GPtrArray) system_dirs = NULL;
+
+              g_ptr_array_set_size (dirs, 0);
+              g_ptr_array_add (dirs, flatpak_dir_get_user ());
+
+              system_dirs = flatpak_dir_get_system_list (cancellable, error);
+              for (i = 0; i < system_dirs->len; i++)
+                {
+                  FlatpakDir *dir = g_ptr_array_index (system_dirs, i);
+                  g_ptr_array_add (dirs, g_object_ref (dir));
+                }
+            }
+        }
+      else /* FLATPAK_BUILTIN_FLAG_ONE_DIR */
+        {
+          FlatpakDir *dir;
+
+          if (opt_system || (!opt_user && opt_installations == NULL))
+            dir = flatpak_dir_get_system_default ();
+          else if (opt_user)
+            dir = flatpak_dir_get_user ();
+          else if (opt_installations != NULL)
+            {
+              if (g_strv_length (opt_installations) > 1)
+                return usage_error (context, _("The --installation option was used multiple times"
+                                               "for a command that works on one installation"), error);
+              dir = flatpak_dir_get_system_by_id (opt_installations[0], cancellable, error);
+              if (dir == NULL)
+                return FALSE;
+            }
+          else
+            g_assert_not_reached ();
+
+          g_ptr_array_add (dirs, dir);
+        }
+
+      for (i = 0; i < dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (dirs, i);
+
+          if (flags & FLATPAK_BUILTIN_FLAG_OPTIONAL_REPO)
+            {
+              if (!flatpak_dir_maybe_ensure_repo (dir, cancellable, error))
+                return FALSE;
+            }
+          else
+            {
+              if (!flatpak_dir_ensure_repo (dir, cancellable, error))
+                return FALSE;
+            }
+
+          flatpak_log_dir_access (dir);
+        }
+    }
+
+  if (out_dirs)
+    *out_dirs = g_steal_pointer (&dirs);
+
+  return TRUE;
+}
+
+gboolean
+usage_error (GOptionContext *context, const char *message, GError **error)
+{
+  g_autofree gchar *help = g_option_context_get_help (context, TRUE, NULL);
+
+  g_printerr ("%s", help);
+  g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message);
+  return FALSE;
+}
+
+static FlatpakCommand *
+extract_command (int     *argc,
+                 char   **argv,
+                 const char **command_name_out)
+{
+  FlatpakCommand *command;
+  const char *command_name = NULL;
+  int in, out;
+
+  /*
+   * Parse the global options. We rearrange the options as
+   * necessary, in order to pass relevant options through
+   * to the commands, but also have them take effect globally.
+   */
+  for (in = 1, out = 1; in < *argc; in++, out++)
+    {
+      /* The non-option is the command, take it out of the arguments */
+      if (argv[in][0] != '-')
+        {
+          if (command_name == NULL)
+            {
+              command_name = argv[in];
+              out--;
+              continue;
+            }
+        }
+
+      argv[out] = argv[in];
+    }
+
+  *argc = out;
+  argv[out] = NULL;
+
+  command = commands;
+  while (command->name)
+    {
+      if (command->fn != NULL &&
+          g_strcmp0 (command_name, command->name) == 0)
+        break;
+      command++;
+    }
+
+  *command_name_out = command_name;
+
+  return command;
+}
+
+
+static int
+flatpak_run (int      argc,
+             char   **argv,
+             GError **res_error)
+{
+  FlatpakCommand *command;
+  GError *error = NULL;
+  GCancellable *cancellable = NULL;
+  g_autofree char *prgname = NULL;
+  gboolean success = FALSE;
+  const char *command_name = NULL;
+
+  command = extract_command (&argc, argv, &command_name);
+
+  if (!command->fn)
+    {
+      GOptionContext *context;
+      g_autofree char *help = NULL;
+
+      context = flatpak_option_context_new_with_commands (commands);
+
+      if (command_name != NULL)
+        {
+          g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       _("Unknown command '%s'"), command_name);
+        }
+      else
+        {
+          /* This will not return for some options (e.g. --version). */
+          if (flatpak_option_context_parse (context, empty_entries, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, &error))
+            {
+              g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                                   _("No command specified"));
+            }
+        }
+
+      help = g_option_context_get_help (context, FALSE, NULL);
+      g_printerr ("%s", help);
+
+      g_option_context_free (context);
+
+      goto out;
+    }
+
+  prgname = g_strdup_printf ("%s %s", g_get_prgname (), command_name);
+  g_set_prgname (prgname);
+
+  if (!command->fn (argc, argv, cancellable, &error))
+    goto out;
+
+  success = TRUE;
+out:
+  g_assert (success || error);
+
+  if (error)
+    {
+      g_propagate_error (res_error, error);
+      return 1;
+    }
+  return 0;
+}
+
+static int
+complete (int    argc,
+          char **argv)
+{
+  FlatpakCommand *command;
+  FlatpakCompletion *completion;
+  const char *command_name = NULL;
+
+  is_in_complete = TRUE;
+
+  completion = flatpak_completion_new (argv[2], argv[3], argv[4]);
+  if (completion == NULL)
+    return 1;
+
+  command = extract_command (&completion->argc, completion->argv, &command_name);
+  flatpak_completion_debug ("command=%p '%s'", command->fn, command->name);
+
+  if (!command->fn)
+    {
+      FlatpakCommand *c = commands;
+      while (c->name)
+        {
+          if (c->fn != NULL)
+            flatpak_complete_word (completion, "%s ", c->name);
+          c++;
+        }
+
+      flatpak_complete_options (completion, global_entries);
+      flatpak_complete_options (completion, empty_entries);
+      flatpak_complete_options (completion, user_entries);
+    }
+  else if (command->complete)
+    {
+      if (!command->complete (completion))
+        return 1;
+    }
+  else
+    {
+      flatpak_complete_options (completion, global_entries);
+    }
+
+  return 0;
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  GError *error = NULL;
+  g_autofree const char *old_env = NULL;
+  int ret;
+
+  setlocale (LC_ALL, "");
+  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+
+  g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, message_handler, NULL);
+
+  g_set_prgname (argv[0]);
+
+  /* avoid gvfs (http://bugzilla.gnome.org/show_bug.cgi?id=526454) */
+  old_env = g_strdup (g_getenv ("GIO_USE_VFS"));
+  g_setenv ("GIO_USE_VFS", "local", TRUE);
+  g_vfs_get_default ();
+  if (old_env)
+    g_setenv ("GIO_USE_VFS", old_env, TRUE);
+  else
+    g_unsetenv ("GIO_USE_VFS");
+
+  if (argc >= 4 && strcmp (argv[1], "complete") == 0)
+    return complete (argc, argv);
+
+  flatpak_migrate_from_xdg_app ();
+
+  ret = flatpak_run (argc, argv, &error);
+  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
+    flatpak_usage (commands, TRUE);
+
+  if (error != NULL)
+    {
+      const char *prefix = "";
+      const char *suffix = "";
+      if (flatpak_fancy_output ())
+        {
+          prefix = FLATPAK_ANSI_RED FLATPAK_ANSI_BOLD_ON;
+          suffix = FLATPAK_ANSI_BOLD_OFF FLATPAK_ANSI_COLOR_RESET;
+        }
+      g_printerr ("%s%s %s%s\n", prefix, _("error:"), suffix, error->message);
+      g_error_free (error);
+    }
+
+  return ret;
+}
diff --git a/app/flatpak-transaction.c b/app/flatpak-transaction.c
new file mode 100644 (file)
index 0000000..8b62f6f
--- /dev/null
@@ -0,0 +1,864 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <glib/gi18n.h>
+
+#include "flatpak-transaction.h"
+#include "flatpak-utils.h"
+#include "flatpak-builtins-utils.h"
+#include "flatpak-error.h"
+
+typedef struct FlatpakTransactionOp FlatpakTransactionOp;
+
+typedef enum {
+  FLATPAK_TRANSACTION_OP_KIND_INSTALL,
+  FLATPAK_TRANSACTION_OP_KIND_UPDATE,
+  FLATPAK_TRANSACTION_OP_KIND_INSTALL_OR_UPDATE,
+  FLATPAK_TRANSACTION_OP_KIND_BUNDLE
+} FlatpakTransactionOpKind;
+
+struct FlatpakTransactionOp {
+  char *remote;
+  char *ref;
+  /* NULL means unspecified (normally keep whatever was there before), [] means force everything */
+  char **subpaths;
+  char *commit;
+  GFile *bundle;
+  FlatpakTransactionOpKind kind;
+  gboolean non_fatal;
+};
+
+struct FlatpakTransaction {
+  FlatpakDir *dir;
+  GHashTable *refs;
+  GPtrArray *system_dirs;
+  GList *ops;
+  GPtrArray *added_origin_remotes;
+
+  gboolean no_interaction;
+  gboolean no_pull;
+  gboolean no_deploy;
+  gboolean no_static_deltas;
+  gboolean add_deps;
+  gboolean add_related;
+  gboolean reinstall;
+};
+
+static gboolean
+remote_name_is_file (const char *remote_name)
+{
+  return remote_name != NULL &&
+    g_str_has_prefix (remote_name, "file://");
+}
+
+/* Check if the ref is in the dir, or in the system dir, in case its a
+ * user-dir or another system-wide installation. We want to avoid depending
+ * on user-installed things when installing to the system dir.
+ */
+static gboolean
+ref_is_installed (FlatpakTransaction *self,
+                  const char *ref,
+                  GError **error)
+{
+  g_autoptr(GFile) deploy_dir = NULL;
+  FlatpakDir *dir = self->dir;
+  int i;
+
+  deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, NULL);
+  if (deploy_dir != NULL)
+    return TRUE;
+
+  /* Don't try to fallback for the system's default directory. */
+  if (!flatpak_dir_is_user (dir) && flatpak_dir_get_id (dir) == NULL)
+    return FALSE;
+
+  /* Lazy initialization of this, once per transaction */
+  if (self->system_dirs == NULL)
+    {
+      self->system_dirs = flatpak_dir_get_system_list (NULL, error);
+      if (self->system_dirs == NULL)
+        return FALSE;
+    }
+
+  for (i = 0; i < self->system_dirs->len; i++)
+    {
+      FlatpakDir *system_dir = g_ptr_array_index (self->system_dirs, i);
+
+      if (g_strcmp0 (flatpak_dir_get_id (dir), flatpak_dir_get_id (system_dir)) == 0)
+        continue;
+
+      deploy_dir = flatpak_dir_get_if_deployed (system_dir, ref, NULL, NULL);
+      if (deploy_dir != NULL)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+dir_ref_is_installed (FlatpakDir *dir, const char *ref, char **remote_out, GVariant **deploy_data_out)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+
+  deploy_data = flatpak_dir_get_deploy_data (dir, ref, NULL, NULL);
+  if (deploy_data == NULL)
+    return FALSE;
+
+  if (remote_out)
+    *remote_out = g_strdup (flatpak_deploy_data_get_origin (deploy_data));
+
+  if (deploy_data_out)
+    *deploy_data_out = g_variant_ref (deploy_data);
+
+  return TRUE;
+}
+
+static FlatpakTransactionOp *
+flatpak_transaction_operation_new (const char *remote,
+                                   const char *ref,
+                                   const char **subpaths,
+                                   const char *commit,
+                                   GFile *bundle,
+                                   FlatpakTransactionOpKind kind)
+{
+  FlatpakTransactionOp *self = g_new0 (FlatpakTransactionOp, 1);
+
+  self->remote = g_strdup (remote);
+  self->ref = g_strdup (ref);
+  self->subpaths = g_strdupv ((char **)subpaths);
+  self->commit = g_strdup (commit);
+  if (bundle)
+    self->bundle = g_object_ref (bundle);
+  self->kind = kind;
+
+  return self;
+}
+
+static void
+flatpak_transaction_operation_free (FlatpakTransactionOp *self)
+{
+  g_free (self->remote);
+  g_free (self->ref);
+  g_free (self->commit);
+  g_strfreev (self->subpaths);
+  g_clear_object (&self->bundle);
+  g_free (self);
+}
+
+gboolean
+flatpak_transaction_is_empty (FlatpakTransaction  *self)
+{
+  return self->ops == NULL;
+}
+
+FlatpakTransaction *
+flatpak_transaction_new (FlatpakDir *dir,
+                         gboolean no_interaction,
+                         gboolean no_pull,
+                         gboolean no_deploy,
+                         gboolean no_static_deltas,
+                         gboolean add_deps,
+                         gboolean add_related,
+                         gboolean reinstall)
+{
+  FlatpakTransaction *t = g_new0 (FlatpakTransaction, 1);
+
+  t->dir = g_object_ref (dir);
+  t->refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  t->added_origin_remotes = g_ptr_array_new_with_free_func (g_free);
+
+  t->no_interaction = no_interaction;
+  t->no_pull = no_pull;
+  t->no_deploy = no_deploy;
+  t->no_static_deltas = no_static_deltas;
+  t->add_deps = add_deps;
+  t->add_related = add_related;
+  t->reinstall = reinstall;
+  return t;
+}
+
+void
+flatpak_transaction_free (FlatpakTransaction *self)
+{
+  g_hash_table_unref (self->refs);
+  g_list_free_full (self->ops, (GDestroyNotify)flatpak_transaction_operation_free);
+  g_object_unref (self->dir);
+
+  g_ptr_array_unref (self->added_origin_remotes);
+
+  if (self->system_dirs != NULL)
+    g_ptr_array_free (self->system_dirs, TRUE);
+
+  g_free (self);
+}
+
+static gboolean
+flatpak_transaction_contains_ref (FlatpakTransaction *self,
+                                  const char *ref)
+{
+  FlatpakTransactionOp *op;
+
+  op = g_hash_table_lookup (self->refs, ref);
+
+  return op != NULL;
+}
+
+
+static char *
+subpaths_to_string (const char **subpaths)
+{
+  GString *s = NULL;
+  int i;
+
+  if (subpaths == NULL)
+    return g_strdup ("[$old]");
+
+  if (*subpaths == 0)
+    return g_strdup ("[*]");
+
+  s = g_string_new ("[");
+  for (i = 0; subpaths[i] != NULL; i++)
+    {
+      if (i != 0)
+        g_string_append (s, ", ");
+      g_string_append (s, subpaths[i]);
+    }
+  g_string_append (s, "]");
+
+  return g_string_free (s, FALSE);
+}
+
+static const char *
+kind_to_str (FlatpakTransactionOpKind kind)
+{
+  switch (kind)
+    {
+    case FLATPAK_TRANSACTION_OP_KIND_INSTALL:
+      return "install";
+    case FLATPAK_TRANSACTION_OP_KIND_UPDATE:
+      return "update";
+    case FLATPAK_TRANSACTION_OP_KIND_INSTALL_OR_UPDATE:
+      return "install/update";
+    case FLATPAK_TRANSACTION_OP_KIND_BUNDLE:
+      return "install bundle";
+    }
+  return "unknown";
+}
+
+static FlatpakTransactionOp *
+flatpak_transaction_add_op (FlatpakTransaction *self,
+                            const char *remote,
+                            const char *ref,
+                            const char **subpaths,
+                            const char *commit,
+                            GFile *bundle,
+                            FlatpakTransactionOpKind kind)
+{
+  FlatpakTransactionOp *op;
+  g_autofree char *subpaths_str = NULL;
+
+  subpaths_str = subpaths_to_string (subpaths);
+  g_debug ("Transaction: %s %s:%s%s%s%s",
+           kind_to_str (kind), remote, ref,
+           commit != NULL ? "@" : "",
+           commit != NULL ? commit : "",
+           subpaths_str);
+
+  op = g_hash_table_lookup (self->refs, ref);
+  if (op != NULL)
+    {
+      g_auto(GStrv) old_subpaths = op->subpaths;
+      op->subpaths = flatpak_subpaths_merge (old_subpaths, (char **)subpaths);
+
+      return op;
+    }
+
+  op = flatpak_transaction_operation_new (remote, ref, subpaths, commit, bundle, kind);
+  g_hash_table_insert (self->refs, g_strdup (ref), op);
+  self->ops = g_list_prepend (self->ops, op);
+
+  return op;
+}
+
+static char *
+ask_for_remote (FlatpakTransaction *self, const char **remotes)
+{
+  int n_remotes = g_strv_length ((char **)remotes);
+  int chosen = 0;
+  int i;
+
+  if (self->no_interaction)
+    {
+      chosen = 1;
+      g_print (_("Found in remote %s\n"), remotes[0]);
+    }
+  else if (n_remotes == 1)
+    {
+      if (flatpak_yes_no_prompt (_("Found in remote %s, do you want to install it?"), remotes[0]))
+        chosen = 1;
+    }
+  else
+    {
+      g_print (_("Found in several remotes:\n"));
+      for (i = 0; remotes[i] != NULL; i++)
+        {
+          g_print ("%d) %s\n", i + 1, remotes[i]);
+        }
+      chosen = flatpak_number_prompt (0, n_remotes, _("Which do you want to install (0 to abort)?"));
+    }
+
+  if (chosen == 0)
+    return NULL;
+
+  return g_strdup (remotes[chosen-1]);
+}
+
+static gboolean
+add_related (FlatpakTransaction *self,
+             const char *remote,
+             const char *ref,
+             GError **error)
+{
+  g_autoptr(GPtrArray) related = NULL;
+  g_autoptr(GError) local_error = NULL;
+  int i;
+
+  if (!self->add_related)
+    return TRUE;
+
+  if (self->no_pull)
+    related = flatpak_dir_find_local_related (self->dir, ref, remote, NULL, &local_error);
+  else
+    related = flatpak_dir_find_remote_related (self->dir, ref, remote, NULL, &local_error);
+  if (related == NULL)
+    {
+      g_printerr (_("Warning: Problem looking for related refs: %s\n"), local_error->message);
+      g_clear_error (&local_error);
+    }
+  else
+    {
+      for (i = 0; i < related->len; i++)
+        {
+          FlatpakRelated *rel = g_ptr_array_index (related, i);
+          FlatpakTransactionOp *op;
+
+          if (!rel->download)
+            continue;
+
+          op = flatpak_transaction_add_op (self, remote, rel->ref,
+                                           (const char **)rel->subpaths,
+                                           NULL, NULL,
+                                           FLATPAK_TRANSACTION_OP_KIND_INSTALL_OR_UPDATE);
+          op->non_fatal = TRUE;
+        }
+    }
+
+  return TRUE;
+}
+
+static gboolean
+add_deps (FlatpakTransaction *self,
+          GKeyFile *metakey,
+          const char *remote,
+          const char *ref,
+          GError **error)
+{
+  g_autofree char *runtime_ref = NULL;
+  g_autofree char *full_runtime_ref = NULL;
+  g_autofree char *runtime_remote = NULL;
+  const char *pref;
+
+  if (!g_str_has_prefix (ref, "app/"))
+    return TRUE;
+
+  if (metakey)
+    runtime_ref = g_key_file_get_string (metakey, "Application", "runtime", NULL);
+  if (runtime_ref == NULL)
+    return TRUE;
+
+  pref = strchr (ref, '/') + 1;
+
+  full_runtime_ref = g_strconcat ("runtime/", runtime_ref, NULL);
+
+  if (!flatpak_transaction_contains_ref (self, full_runtime_ref))
+    {
+      g_autoptr(GError) local_error = NULL;
+
+      if (!ref_is_installed (self, full_runtime_ref, &local_error))
+        {
+          g_auto(GStrv) remotes = NULL;
+
+          if (local_error != NULL)
+            {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              return FALSE;
+            }
+
+          g_print (_("Required runtime for %s (%s) is not installed, searching...\n"),
+                   pref, runtime_ref);
+
+          remotes = flatpak_dir_search_for_dependency (self->dir, full_runtime_ref, NULL, NULL);
+          if (remotes == NULL || *remotes == NULL)
+            {
+              g_print (_("The required runtime %s was not found in a configured remote.\n"),
+                       runtime_ref);
+            }
+          else
+            {
+              runtime_remote = ask_for_remote (self, (const char **)remotes);
+            }
+
+          if (runtime_remote == NULL)
+            return flatpak_fail (error,
+                                 "The Application %s requires the runtime %s which is not installed",
+                                 pref, runtime_ref);
+
+          flatpak_transaction_add_op (self, runtime_remote, full_runtime_ref, NULL, NULL, NULL,
+                                      FLATPAK_TRANSACTION_OP_KIND_INSTALL_OR_UPDATE);
+        }
+      else
+        {
+          /* Update if in same dir */
+          if (dir_ref_is_installed (self->dir, full_runtime_ref, &runtime_remote, NULL))
+            {
+              FlatpakTransactionOp *op;
+              g_debug ("Updating dependent runtime %s", full_runtime_ref);
+              op = flatpak_transaction_add_op (self, runtime_remote, full_runtime_ref, NULL, NULL, NULL,
+                                               FLATPAK_TRANSACTION_OP_KIND_UPDATE);
+              op->non_fatal = TRUE;
+            }
+        }
+    }
+
+  if (runtime_remote != NULL &&
+      !add_related (self, runtime_remote, full_runtime_ref, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_transaction_add_ref (FlatpakTransaction *self,
+                             const char *remote,
+                             const char *ref,
+                             const char **subpaths,
+                             const char *commit,
+                             FlatpakTransactionOpKind kind,
+                             GFile *bundle,
+                             const char *metadata,
+                             GError **error)
+{
+  g_autofree char *origin = NULL;
+  const char *pref;
+  g_autofree char *remote_metadata = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GError) local_error = NULL;
+  g_autofree char *origin_remote = NULL;
+
+  if (remote_name_is_file (remote))
+    {
+      g_auto(GStrv) parts = NULL;
+      parts = g_strsplit (ref, "/", -1);
+
+      origin_remote = flatpak_dir_create_origin_remote (self->dir,
+                                                        remote, /* uri */
+                                                        parts[1],
+                                                        "Local repo",
+                                                        ref,
+                                                        NULL,
+                                                        NULL,
+                                                        NULL, error);
+      if (origin_remote == NULL)
+        return FALSE;
+
+      g_ptr_array_add (self->added_origin_remotes, g_strdup (origin_remote));
+
+      remote = origin_remote;
+    }
+
+  pref = strchr (ref, '/') + 1;
+
+  if (kind == FLATPAK_TRANSACTION_OP_KIND_UPDATE)
+    {
+      if (!dir_ref_is_installed (self->dir, ref, &origin, NULL))
+        {
+          g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                       _("%s not installed"), pref);
+          return FALSE;
+        }
+
+      if (flatpak_dir_get_remote_disabled (self->dir, origin))
+        {
+          g_debug (_("Remote %s disabled, ignoring %s update"), origin, pref);
+          return TRUE;
+        }
+      remote = origin;
+    }
+  else if (kind == FLATPAK_TRANSACTION_OP_KIND_INSTALL)
+    {
+      g_assert (remote != NULL);
+      if (!self->reinstall &&
+          dir_ref_is_installed (self->dir, ref, &origin, NULL))
+        {
+          if (strcmp (remote, origin) == 0)
+            {
+              g_printerr (_("%s already installed, skipping\n"), pref);
+              return TRUE;
+            }
+          else
+            {
+              g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                           _("%s is already installed from other remote (%s)"), pref, origin);
+              return FALSE;
+            }
+        }
+    }
+
+  if (metadata == NULL && remote != NULL)
+    {
+      if (flatpak_dir_fetch_ref_cache (self->dir, remote, ref, NULL, NULL, &remote_metadata, NULL, &local_error))
+        metadata = remote_metadata;
+      else
+        {
+          g_print (_("Warning: Can't find dependencies: %s\n"), local_error->message);
+          g_clear_error (&local_error);
+        }
+    }
+
+  if (metadata)
+    {
+      metakey = g_key_file_new ();
+      if (!g_key_file_load_from_data (metakey, metadata, -1, 0, NULL))
+        g_clear_object (&metakey);
+    }
+
+  if (metakey)
+    {
+      g_autofree char *required_version = NULL;
+      const char *group;
+      int required_major, required_minor, required_micro;
+
+      if (g_str_has_prefix (ref, "app/"))
+        group = "Application";
+      else
+        group = "Runtime";
+
+      required_version = g_key_file_get_string (metakey, group, "required-flatpak", NULL);
+      if (required_version)
+        {
+          if (sscanf (required_version, "%d.%d.%d", &required_major, &required_minor, &required_micro) != 3)
+            g_print (_("Invalid require-flatpak argument %s\n"), required_version);
+          else
+            {
+              if (required_major > PACKAGE_MAJOR_VERSION ||
+                  (required_major == PACKAGE_MAJOR_VERSION && required_minor > PACKAGE_MINOR_VERSION) ||
+                  (required_major == PACKAGE_MAJOR_VERSION && required_minor == PACKAGE_MINOR_VERSION && required_micro > PACKAGE_MICRO_VERSION))
+                return flatpak_fail (error, _("%s needs a later flatpak version (%s)"), ref, required_version);
+            }
+        }
+    }
+
+  if (self->add_deps)
+    {
+      if (!add_deps (self, metakey, remote, ref, error))
+        return FALSE;
+    }
+
+  flatpak_transaction_add_op (self, remote, ref, subpaths, commit, bundle, kind);
+
+  if (!add_related (self, remote, ref, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_transaction_add_install (FlatpakTransaction *self,
+                                 const char *remote,
+                                 const char *ref,
+                                 const char **subpaths,
+                                 GError **error)
+{
+  const char *all_paths[] = { NULL };
+
+  /* If we install with no special args pull all subpaths */
+  if (subpaths == NULL)
+    subpaths = all_paths;
+
+  return flatpak_transaction_add_ref (self, remote, ref, subpaths, NULL, FLATPAK_TRANSACTION_OP_KIND_INSTALL, NULL, NULL, error);
+}
+
+gboolean
+flatpak_transaction_add_install_bundle (FlatpakTransaction *self,
+                                        GFile               *file,
+                                        GBytes              *gpg_data,
+                                        GError **error)
+{
+  g_autofree char *remote = NULL;
+  g_autofree char *ref = NULL;
+  g_autofree char *metadata = NULL;
+  gboolean created_remote;
+
+  remote = flatpak_dir_ensure_bundle_remote (self->dir, file, gpg_data,
+                                             &ref, &metadata, &created_remote,
+                                             NULL, error);
+  if (remote == NULL)
+    return FALSE;
+
+  if (!flatpak_dir_recreate_repo (self->dir, NULL, error))
+    return FALSE;
+
+  return flatpak_transaction_add_ref (self, remote, ref, NULL, NULL, FLATPAK_TRANSACTION_OP_KIND_BUNDLE, file, metadata, error);
+}
+
+gboolean
+flatpak_transaction_add_update (FlatpakTransaction *self,
+                                const char *ref,
+                                const char **subpaths,
+                                const char *commit,
+                                GError **error)
+{
+  const char *all_paths[] = { NULL };
+
+  /* If specify an empty subpath, that means all subpaths */
+  if (subpaths != NULL && subpaths[0] != NULL && subpaths[0][0] == 0)
+    subpaths = all_paths;
+
+  return flatpak_transaction_add_ref (self, NULL, ref, subpaths, commit, FLATPAK_TRANSACTION_OP_KIND_UPDATE, NULL, NULL, error);
+}
+
+gboolean
+flatpak_transaction_update_metadata (FlatpakTransaction  *self,
+                                     gboolean             all_remotes,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  g_auto(GStrv) remotes = NULL;
+  int i;
+  GList *l;
+
+  /* Collect all dir+remotes used in this transaction */
+
+  if (all_remotes)
+    {
+      remotes = flatpak_dir_list_remotes (self->dir, NULL, error);
+      if (remotes == NULL)
+        return FALSE;
+    }
+  else
+    {
+      g_autoptr(GHashTable) ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+      for (l = self->ops; l != NULL; l = l->next)
+        {
+          FlatpakTransactionOp *op = l->data;
+          g_hash_table_add (ht, g_strdup (op->remote));
+        }
+      remotes = (char **)g_hash_table_get_keys_as_array (ht, NULL);
+      g_hash_table_steal_all (ht); /* Move ownership to remotes */
+    }
+
+  /* Update metadata for said remotes */
+  for (i = 0; remotes[i] != NULL; i++)
+    {
+      char *remote = remotes[i];
+      g_autoptr(GError) my_error = NULL;
+
+      g_debug ("Updating remote metadata for %s", remote);
+      if (!flatpak_dir_update_remote_configuration (self->dir, remote, cancellable, &my_error))
+        g_printerr (_("Error updating remote metadata for '%s': %s\n"), remote, my_error->message);
+    }
+
+  /* Reload changed configuration */
+  if (!flatpak_dir_recreate_repo (self->dir, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_transaction_run (FlatpakTransaction *self,
+                         gboolean stop_on_first_error,
+                         GCancellable *cancellable,
+                         GError **error)
+{
+  GList *l;
+  gboolean succeeded = TRUE;
+  int i;
+
+  self->ops = g_list_reverse (self->ops);
+
+  for (l = self->ops; l != NULL; l = l->next)
+    {
+      FlatpakTransactionOp *op = l->data;
+      g_autoptr(GError) local_error = NULL;
+      gboolean res = TRUE;
+      const char *pref;
+      const char *opname;
+      FlatpakTransactionOpKind kind;
+      FlatpakTerminalProgress terminal_progress = { 0 };
+
+      kind = op->kind;
+      if (kind == FLATPAK_TRANSACTION_OP_KIND_INSTALL_OR_UPDATE)
+        {
+          g_autoptr(GVariant) deploy_data = NULL;
+
+          if (dir_ref_is_installed (self->dir, op->ref, NULL, &deploy_data))
+            {
+              /* Don't use the remote from related ref on update, always use
+                 the current remote. */
+              g_free (op->remote);
+              op->remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data));
+
+              kind = FLATPAK_TRANSACTION_OP_KIND_UPDATE;
+            }
+          else
+            kind = FLATPAK_TRANSACTION_OP_KIND_INSTALL;
+        }
+
+      pref = strchr (op->ref, '/') + 1;
+
+
+      if (kind == FLATPAK_TRANSACTION_OP_KIND_INSTALL)
+        {
+          g_autoptr(OstreeAsyncProgress) progress = flatpak_progress_new (flatpak_terminal_progress_cb, &terminal_progress);
+          opname = _("install");
+          if (flatpak_dir_is_user (self->dir))
+            g_print (_("Installing for user: %s from %s\n"), pref, op->remote);
+          else
+            g_print (_("Installing: %s from %s\n"), pref, op->remote);
+          res = flatpak_dir_install (self->dir ,
+                                     self->no_pull,
+                                     self->no_deploy,
+                                     self->no_static_deltas,
+                                     self->reinstall,
+                                     op->ref, op->remote,
+                                     (const char **)op->subpaths,
+                                     progress,
+                                     cancellable, &local_error);
+          ostree_async_progress_finish (progress);
+          flatpak_terminal_progress_end (&terminal_progress);
+        }
+      else if (kind == FLATPAK_TRANSACTION_OP_KIND_UPDATE)
+        {
+          g_auto(OstreeRepoFinderResultv) check_results = NULL;
+
+          opname = _("update");
+          g_autofree char *target_commit = flatpak_dir_check_for_update (self->dir, op->ref, op->remote, op->commit,
+                                                                         (const char **)op->subpaths,
+                                                                         self->no_pull,
+                                                                         &check_results,
+                                                                         cancellable, &local_error);
+          if (target_commit != NULL)
+            {
+              if (flatpak_dir_is_user (self->dir))
+                g_print (_("Updating for user: %s from %s\n"), pref, op->remote);
+              else
+                g_print (_("Updating: %s from %s\n"), pref, op->remote);
+              g_autoptr(OstreeAsyncProgress) progress = flatpak_progress_new (flatpak_terminal_progress_cb, &terminal_progress);
+              res = flatpak_dir_update (self->dir,
+                                        self->no_pull,
+                                        self->no_deploy,
+                                        self->no_static_deltas,
+                                        op->commit != NULL, /* Allow downgrade if we specify commit */
+                                        op->ref, op->remote, target_commit,
+                                        (const OstreeRepoFinderResult * const *) check_results,
+                                        (const char **)op->subpaths,
+                                        progress,
+                                        cancellable, &local_error);
+              ostree_async_progress_finish (progress);
+              flatpak_terminal_progress_end (&terminal_progress);
+              if (res)
+                {
+                  g_autoptr(GVariant) deploy_data = NULL;
+                  g_autofree char *commit = NULL;
+                  deploy_data = flatpak_dir_get_deploy_data (self->dir, op->ref, NULL, NULL);
+                  commit = g_strndup (flatpak_deploy_data_get_commit (deploy_data), 12);
+                  g_print (_("Now at %s.\n"), commit);
+                }
+
+              /* Handle noop-updates */
+              if (!res && g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
+                {
+                  g_print (_("No updates.\n"));
+                  res = TRUE;
+                  g_clear_error (&local_error);
+                }
+            }
+          else
+            {
+              res = FALSE;
+              if (g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
+                {
+                  res = TRUE;
+                  g_clear_error (&local_error);
+                }
+            }
+        }
+      else if (kind == FLATPAK_TRANSACTION_OP_KIND_BUNDLE)
+        {
+          g_autofree char *bundle_basename = g_file_get_basename (op->bundle);
+          opname = _("install bundle");
+          if (flatpak_dir_is_user (self->dir))
+            g_print (_("Installing for user: %s from bundle %s\n"), pref, bundle_basename);
+          else
+            g_print (_("Installing: %s from bundle %s\n"), pref, bundle_basename);
+          res = flatpak_dir_install_bundle (self->dir, op->bundle,
+                                            op->remote, NULL,
+                                            cancellable, &local_error);
+        }
+      else
+        g_assert_not_reached ();
+
+      if (!res)
+        {
+          if (op->non_fatal)
+            {
+              g_printerr (_("Warning: Failed to %s %s: %s\n"),
+                          opname, pref, local_error->message);
+            }
+          else if (!stop_on_first_error)
+            {
+              g_printerr (_("Error: Failed to %s %s: %s\n"),
+                          opname, pref, local_error->message);
+              if (succeeded)
+                {
+                  succeeded = FALSE;
+                  flatpak_fail (error, _("One or more operations failed"));
+                }
+            }
+          else
+            {
+              succeeded = FALSE;
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              goto out;
+            }
+        }
+    }
+
+ out:
+
+  for (i = 0; i < self->added_origin_remotes->len; i++)
+    flatpak_dir_prune_origin_remote (self->dir, g_ptr_array_index (self->added_origin_remotes, i));
+
+  return succeeded;
+}
diff --git a/app/flatpak-transaction.h b/app/flatpak-transaction.h
new file mode 100644 (file)
index 0000000..4e51572
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_TRANSACTION_H__
+#define __FLATPAK_TRANSACTION_H__
+
+#include <glib.h>
+#include "libglnx/libglnx.h"
+
+#include "flatpak-dir.h"
+
+typedef struct FlatpakTransaction FlatpakTransaction;
+
+FlatpakTransaction *flatpak_transaction_new         (FlatpakDir          *dir,
+                                                     gboolean             no_interaction,
+                                                     gboolean             no_pull,
+                                                     gboolean             no_deploy,
+                                                     gboolean             no_static_deltas,
+                                                     gboolean             add_deps,
+                                                     gboolean             add_related,
+                                                     gboolean             reinstall);
+void                flatpak_transaction_free        (FlatpakTransaction  *self);
+gboolean            flatpak_transaction_update_metadata (FlatpakTransaction  *self,
+                                                         gboolean             all_remotes,
+                                                         GCancellable        *cancellable,
+                                                         GError             **error);
+gboolean            flatpak_transaction_run         (FlatpakTransaction  *self,
+                                                     gboolean             stop_on_first_errror,
+                                                     GCancellable        *cancellable,
+                                                     GError             **error);
+gboolean            flatpak_transaction_add_install (FlatpakTransaction  *self,
+                                                     const char          *remote,
+                                                     const char          *ref,
+                                                     const char         **subpaths,
+                                                     GError             **error);
+gboolean            flatpak_transaction_add_install_bundle (FlatpakTransaction  *self,
+                                                            GFile               *file,
+                                                            GBytes              *gpg_data,
+                                                            GError             **error);
+gboolean            flatpak_transaction_add_update  (FlatpakTransaction  *self,
+                                                     const char          *ref,
+                                                     const char         **subpaths,
+                                                     const char          *commit,
+                                                     GError             **error);
+gboolean            flatpak_transaction_is_empty   (FlatpakTransaction  *self);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakTransaction, flatpak_transaction_free)
+
+#endif /* __FLATPAK_TRANSACTION_H__ */
diff --git a/bubblewrap/Makefile-bwrap.am.inc b/bubblewrap/Makefile-bwrap.am.inc
new file mode 100644 (file)
index 0000000..a3e6909
--- /dev/null
@@ -0,0 +1,13 @@
+
+bwrap_SOURCES = \
+       bubblewrap/bubblewrap.c \
+       bubblewrap/bind-mount.h \
+       bubblewrap/bind-mount.c \
+       bubblewrap/network.h \
+       bubblewrap/network.c \
+       bubblewrap/utils.h \
+       bubblewrap/utils.c \
+       $(NULL)
+
+bwrap_CFLAGS = $(AM_CFLAGS)
+bwrap_LDADD = $(SELINUX_LIBS)
diff --git a/bubblewrap/bind-mount.c b/bubblewrap/bind-mount.c
new file mode 100644 (file)
index 0000000..7d3543f
--- /dev/null
@@ -0,0 +1,440 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "config.h"
+
+#include <sys/mount.h>
+
+#include "utils.h"
+#include "bind-mount.h"
+
+static char *
+skip_token (char *line, bool eat_whitespace)
+{
+  while (*line != ' ' && *line != '\n')
+    line++;
+
+  if (eat_whitespace && *line == ' ')
+    line++;
+
+  return line;
+}
+
+static char *
+unescape_inline (char *escaped)
+{
+  char *unescaped, *res;
+  const char *end;
+
+  res = escaped;
+  end = escaped + strlen (escaped);
+
+  unescaped = escaped;
+  while (escaped < end)
+    {
+      if (*escaped == '\\')
+        {
+          *unescaped++ =
+            ((escaped[1] - '0') << 6) |
+            ((escaped[2] - '0') << 3) |
+            ((escaped[3] - '0') << 0);
+          escaped += 4;
+        }
+      else
+        {
+          *unescaped++ = *escaped++;
+        }
+    }
+  *unescaped = 0;
+  return res;
+}
+
+static bool
+match_token (const char *token, const char *token_end, const char *str)
+{
+  while (token != token_end && *token == *str)
+    {
+      token++;
+      str++;
+    }
+  if (token == token_end)
+    return *str == 0;
+
+  return FALSE;
+}
+
+static unsigned long
+decode_mountoptions (const char *options)
+{
+  const char *token, *end_token;
+  int i;
+  unsigned long flags = 0;
+  static const struct  { int   flag;
+                         char *name;
+  } flags_data[] = {
+    { 0, "rw" },
+    { MS_RDONLY, "ro" },
+    { MS_NOSUID, "nosuid" },
+    { MS_NODEV, "nodev" },
+    { MS_NOEXEC, "noexec" },
+    { MS_NOATIME, "noatime" },
+    { MS_NODIRATIME, "nodiratime" },
+    { MS_RELATIME, "relatime" },
+    { 0, NULL }
+  };
+
+  token = options;
+  do
+    {
+      end_token = strchr (token, ',');
+      if (end_token == NULL)
+        end_token = token + strlen (token);
+
+      for (i = 0; flags_data[i].name != NULL; i++)
+        {
+          if (match_token (token, end_token, flags_data[i].name))
+            {
+              flags |= flags_data[i].flag;
+              break;
+            }
+        }
+
+      if (*end_token != 0)
+        token = end_token + 1;
+      else
+        token = NULL;
+    }
+  while (token != NULL);
+
+  return flags;
+}
+
+typedef struct MountInfo MountInfo;
+struct MountInfo {
+  char *mountpoint;
+  unsigned long options;
+};
+
+typedef MountInfo *MountTab;
+
+static void
+mount_tab_free (MountTab tab)
+{
+  int i;
+
+  for (i = 0; tab[i].mountpoint != NULL; i++)
+    free (tab[i].mountpoint);
+  free (tab);
+}
+
+static inline void
+cleanup_mount_tabp (void *p)
+{
+  void **pp = (void **) p;
+
+  if (*pp)
+    mount_tab_free ((MountTab)*pp);
+}
+
+#define cleanup_mount_tab __attribute__((cleanup (cleanup_mount_tabp)))
+
+typedef struct MountInfoLine MountInfoLine;
+struct MountInfoLine {
+  const char *mountpoint;
+  const char *options;
+  bool covered;
+  int id;
+  int parent_id;
+  MountInfoLine *first_child;
+  MountInfoLine *next_sibling;
+};
+
+static unsigned int
+count_lines (const char *data)
+{
+  unsigned int count = 0;
+  const char *p = data;
+
+  while (*p != 0)
+    {
+      if (*p == '\n')
+        count++;
+      p++;
+    }
+
+  /* If missing final newline, add one */
+  if (p > data && *(p-1) != '\n')
+    count++;
+
+  return count;
+}
+
+static int
+count_mounts (MountInfoLine *line)
+{
+  MountInfoLine *child;
+  int res = 0;
+
+  if (!line->covered)
+    res += 1;
+
+  child = line->first_child;
+  while (child != NULL)
+    {
+      res += count_mounts (child);
+      child = child->next_sibling;
+    }
+
+  return res;
+}
+
+static MountInfo *
+collect_mounts (MountInfo *info, MountInfoLine *line)
+{
+  MountInfoLine *child;
+
+  if (!line->covered)
+    {
+      info->mountpoint = xstrdup (line->mountpoint);
+      info->options = decode_mountoptions (line->options);
+      info ++;
+    }
+
+  child = line->first_child;
+  while (child != NULL)
+    {
+      info = collect_mounts (info, child);
+      child = child->next_sibling;
+    }
+
+  return info;
+}
+
+static MountTab
+parse_mountinfo (int  proc_fd,
+                 const char *root_mount)
+{
+  cleanup_free char *mountinfo = NULL;
+  cleanup_free MountInfoLine *lines = NULL;
+  cleanup_free MountInfoLine **by_id = NULL;
+  cleanup_mount_tab MountTab mount_tab = NULL;
+  MountInfo *end_tab;
+  int n_mounts;
+  char *line;
+  int i;
+  int max_id;
+  unsigned int n_lines;
+  int root;
+
+  mountinfo = load_file_at (proc_fd, "self/mountinfo");
+  if (mountinfo == NULL)
+    die_with_error ("Can't open /proc/self/mountinfo");
+
+  n_lines = count_lines (mountinfo);
+  lines = xcalloc (n_lines * sizeof (MountInfoLine));
+
+  max_id = 0;
+  line = mountinfo;
+  i = 0;
+  root = -1;
+  while (*line != 0)
+    {
+      int rc, consumed = 0;
+      unsigned int maj, min;
+      char *end;
+      char *rest;
+      char *mountpoint;
+      char *mountpoint_end;
+      char *options;
+      char *options_end;
+      char *next_line;
+
+      assert (i < n_lines);
+
+      end = strchr (line, '\n');
+      if (end != NULL)
+        {
+          *end = 0;
+          next_line = end + 1;
+        }
+      else
+        next_line = line + strlen (line);
+
+      rc = sscanf (line, "%d %d %u:%u %n", &lines[i].id, &lines[i].parent_id, &maj, &min, &consumed);
+      if (rc != 4)
+        die ("Can't parse mountinfo line");
+      rest = line + consumed;
+
+      rest = skip_token (rest, TRUE); /* mountroot */
+      mountpoint = rest;
+      rest = skip_token (rest, FALSE); /* mountpoint */
+      mountpoint_end = rest++;
+      options = rest;
+      rest = skip_token (rest, FALSE); /* vfs options */
+      options_end = rest;
+
+      *mountpoint_end = 0;
+      lines[i].mountpoint = unescape_inline (mountpoint);
+
+      *options_end = 0;
+      lines[i].options = options;
+
+      if (lines[i].id > max_id)
+        max_id = lines[i].id;
+      if (lines[i].parent_id > max_id)
+        max_id = lines[i].parent_id;
+
+      if (path_equal (lines[i].mountpoint, root_mount))
+        root = i;
+
+      i++;
+      line = next_line;
+    }
+  assert (i == n_lines);
+
+  if (root == -1)
+    {
+      mount_tab = xcalloc (sizeof (MountInfo) * (1));
+      return steal_pointer (&mount_tab);
+    }
+
+  by_id = xcalloc ((max_id + 1) * sizeof (MountInfoLine*));
+  for (i = 0; i < n_lines; i++)
+    by_id[lines[i].id] = &lines[i];
+
+  for (i = 0; i < n_lines; i++)
+    {
+      MountInfoLine *this = &lines[i];
+      MountInfoLine *parent = by_id[this->parent_id];
+      MountInfoLine **to_sibling;
+      MountInfoLine *sibling;
+      bool covered = FALSE;
+
+      if (!has_path_prefix (this->mountpoint, root_mount))
+        continue;
+
+      if (parent == NULL)
+        continue;
+
+      if (strcmp (parent->mountpoint, this->mountpoint) == 0)
+        parent->covered = TRUE;
+
+      to_sibling = &parent->first_child;
+      sibling = parent->first_child;
+      while (sibling != NULL)
+        {
+          /* If this mountpoint is a path prefix of the sibling,
+           * say this->mp=/foo/bar and sibling->mp=/foo, then it is
+           * covered by the sibling, and we drop it. */
+          if (has_path_prefix (this->mountpoint, sibling->mountpoint))
+            {
+              covered = TRUE;
+              break;
+            }
+
+          /* If the sibling is a path prefix of this mount point,
+           * say this->mp=/foo and sibling->mp=/foo/bar, then the sibling
+           * is covered, and we drop it.
+            */
+          if (has_path_prefix (sibling->mountpoint, this->mountpoint))
+            *to_sibling = sibling->next_sibling;
+          else
+            to_sibling = &sibling->next_sibling;
+          sibling = sibling->next_sibling;
+        }
+
+      if (covered)
+          continue;
+
+      *to_sibling = this;
+    }
+
+  n_mounts = count_mounts (&lines[root]);
+  mount_tab = xcalloc (sizeof (MountInfo) * (n_mounts + 1));
+
+  end_tab = collect_mounts (&mount_tab[0], &lines[root]);
+  assert (end_tab == &mount_tab[n_mounts]);
+
+  return steal_pointer (&mount_tab);
+}
+
+int
+bind_mount (int           proc_fd,
+            const char   *src,
+            const char   *dest,
+            bind_option_t options)
+{
+  bool readonly = (options & BIND_READONLY) != 0;
+  bool devices = (options & BIND_DEVICES) != 0;
+  bool recursive = (options & BIND_RECURSIVE) != 0;
+  unsigned long current_flags, new_flags;
+  cleanup_mount_tab MountTab mount_tab = NULL;
+  cleanup_free char *resolved_dest = NULL;
+  int i;
+
+  if (src)
+    {
+      if (mount (src, dest, NULL, MS_MGC_VAL | MS_BIND | (recursive ? MS_REC : 0), NULL) != 0)
+        return 1;
+    }
+
+  /* The mount operation will resolve any symlinks in the destination
+     path, so to find it in the mount table we need to do that too. */
+  resolved_dest = realpath (dest, NULL);
+  if (resolved_dest == NULL)
+    return 2;
+
+  mount_tab = parse_mountinfo (proc_fd, resolved_dest);
+  if (mount_tab[0].mountpoint == NULL)
+    {
+      errno = EINVAL;
+      return 2; /* No mountpoint at dest */
+    }
+
+  assert (path_equal (mount_tab[0].mountpoint, resolved_dest));
+  current_flags = mount_tab[0].options;
+  new_flags = current_flags | (devices ? 0 : MS_NODEV) | MS_NOSUID | (readonly ? MS_RDONLY : 0);
+  if (new_flags != current_flags &&
+      mount ("none", resolved_dest,
+             NULL, MS_MGC_VAL | MS_BIND | MS_REMOUNT | new_flags, NULL) != 0)
+    return 3;
+
+  /* We need to work around the fact that a bind mount does not apply the flags, so we need to manually
+   * apply the flags to all submounts in the recursive case.
+   * Note: This does not apply the flags to mounts which are later propagated into this namespace.
+   */
+  if (recursive)
+    {
+      for (i = 1; mount_tab[i].mountpoint != NULL; i++)
+        {
+          current_flags = mount_tab[i].options;
+          new_flags = current_flags | (devices ? 0 : MS_NODEV) | MS_NOSUID | (readonly ? MS_RDONLY : 0);
+          if (new_flags != current_flags &&
+              mount ("none", mount_tab[i].mountpoint,
+                     NULL, MS_MGC_VAL | MS_BIND | MS_REMOUNT | new_flags, NULL) != 0)
+            {
+              /* If we can't read the mountpoint we can't remount it, but that should
+                 be safe to ignore because its not something the user can access. */
+              if (errno != EACCES)
+                return 5;
+            }
+        }
+    }
+
+  return 0;
+}
diff --git a/bubblewrap/bind-mount.h b/bubblewrap/bind-mount.h
new file mode 100644 (file)
index 0000000..c763763
--- /dev/null
@@ -0,0 +1,30 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+typedef enum {
+  BIND_READONLY = (1 << 0),
+  BIND_DEVICES = (1 << 2),
+  BIND_RECURSIVE = (1 << 3),
+} bind_option_t;
+
+int bind_mount (int           proc_fd,
+                const char   *src,
+                const char   *dest,
+                bind_option_t options);
diff --git a/bubblewrap/bubblewrap.c b/bubblewrap/bubblewrap.c
new file mode 100644 (file)
index 0000000..a8dfd76
--- /dev/null
@@ -0,0 +1,2223 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "config.h"
+
+#include <poll.h>
+#include <sched.h>
+#include <pwd.h>
+#include <grp.h>
+#include <sys/mount.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <sys/eventfd.h>
+#include <sys/fsuid.h>
+#include <sys/signalfd.h>
+#include <sys/capability.h>
+#include <sys/prctl.h>
+#include <linux/sched.h>
+#include <linux/seccomp.h>
+#include <linux/filter.h>
+
+#include "utils.h"
+#include "network.h"
+#include "bind-mount.h"
+
+#ifndef CLONE_NEWCGROUP
+#define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace */
+#endif
+
+/* Globals to avoid having to use getuid(), since the uid/gid changes during runtime */
+static uid_t real_uid;
+static gid_t real_gid;
+static uid_t overflow_uid;
+static gid_t overflow_gid;
+static bool is_privileged;
+static const char *argv0;
+static const char *host_tty_dev;
+static int proc_fd = -1;
+static char *opt_exec_label = NULL;
+static char *opt_file_label = NULL;
+
+char *opt_chdir_path = NULL;
+bool opt_unshare_user = FALSE;
+bool opt_unshare_user_try = FALSE;
+bool opt_unshare_pid = FALSE;
+bool opt_unshare_ipc = FALSE;
+bool opt_unshare_net = FALSE;
+bool opt_unshare_uts = FALSE;
+bool opt_unshare_cgroup = FALSE;
+bool opt_unshare_cgroup_try = FALSE;
+bool opt_needs_devpts = FALSE;
+bool opt_new_session = FALSE;
+bool opt_die_with_parent = FALSE;
+uid_t opt_sandbox_uid = -1;
+gid_t opt_sandbox_gid = -1;
+int opt_sync_fd = -1;
+int opt_block_fd = -1;
+int opt_info_fd = -1;
+int opt_seccomp_fd = -1;
+char *opt_sandbox_hostname = NULL;
+
+typedef enum {
+  SETUP_BIND_MOUNT,
+  SETUP_RO_BIND_MOUNT,
+  SETUP_DEV_BIND_MOUNT,
+  SETUP_MOUNT_PROC,
+  SETUP_MOUNT_DEV,
+  SETUP_MOUNT_TMPFS,
+  SETUP_MOUNT_MQUEUE,
+  SETUP_MAKE_DIR,
+  SETUP_MAKE_FILE,
+  SETUP_MAKE_BIND_FILE,
+  SETUP_MAKE_RO_BIND_FILE,
+  SETUP_MAKE_SYMLINK,
+  SETUP_REMOUNT_RO_NO_RECURSIVE,
+  SETUP_SET_HOSTNAME,
+} SetupOpType;
+
+typedef enum {
+  NO_CREATE_DEST = (1 << 0),
+} SetupOpFlag;
+
+typedef struct _SetupOp SetupOp;
+
+struct _SetupOp
+{
+  SetupOpType type;
+  const char *source;
+  const char *dest;
+  int         fd;
+  SetupOpFlag flags;
+  SetupOp    *next;
+};
+
+typedef struct _LockFile LockFile;
+
+struct _LockFile
+{
+  const char *path;
+  LockFile   *next;
+};
+
+static SetupOp *ops = NULL;
+static SetupOp *last_op = NULL;
+static LockFile *lock_files = NULL;
+static LockFile *last_lock_file = NULL;
+
+enum {
+  PRIV_SEP_OP_DONE,
+  PRIV_SEP_OP_BIND_MOUNT,
+  PRIV_SEP_OP_PROC_MOUNT,
+  PRIV_SEP_OP_TMPFS_MOUNT,
+  PRIV_SEP_OP_DEVPTS_MOUNT,
+  PRIV_SEP_OP_MQUEUE_MOUNT,
+  PRIV_SEP_OP_REMOUNT_RO_NO_RECURSIVE,
+  PRIV_SEP_OP_SET_HOSTNAME,
+};
+
+typedef struct
+{
+  uint32_t op;
+  uint32_t flags;
+  uint32_t arg1_offset;
+  uint32_t arg2_offset;
+} PrivSepOp;
+
+static SetupOp *
+setup_op_new (SetupOpType type)
+{
+  SetupOp *op = xcalloc (sizeof (SetupOp));
+
+  op->type = type;
+  op->fd = -1;
+  op->flags = 0;
+  if (last_op != NULL)
+    last_op->next = op;
+  else
+    ops = op;
+
+  last_op = op;
+  return op;
+}
+
+static LockFile *
+lock_file_new (const char *path)
+{
+  LockFile *lock = xcalloc (sizeof (LockFile));
+
+  lock->path = path;
+  if (last_lock_file != NULL)
+    last_lock_file->next = lock;
+  else
+    lock_files = lock;
+
+  last_lock_file = lock;
+  return lock;
+}
+
+
+static void
+usage (int ecode, FILE *out)
+{
+  fprintf (out, "usage: %s [OPTIONS...] COMMAND [ARGS...]\n\n", argv0);
+
+  fprintf (out,
+           "    --help                       Print this help\n"
+           "    --version                    Print version\n"
+           "    --args FD                    Parse nul-separated args from FD\n"
+           "    --unshare-all                Unshare every namespace we support by default\n"
+           "    --share-net                  Retain the network namespace (can only combine with --unshare-all)\n"
+           "    --unshare-user               Create new user namespace (may be automatically implied if not setuid)\n"
+           "    --unshare-user-try           Create new user namespace if possible else continue by skipping it\n"
+           "    --unshare-ipc                Create new ipc namespace\n"
+           "    --unshare-pid                Create new pid namespace\n"
+           "    --unshare-net                Create new network namespace\n"
+           "    --unshare-uts                Create new uts namespace\n"
+           "    --unshare-cgroup             Create new cgroup namespace\n"
+           "    --unshare-cgroup-try         Create new cgroup namespace if possible else continue by skipping it\n"
+           "    --uid UID                    Custom uid in the sandbox (requires --unshare-user)\n"
+           "    --gid GID                    Custon gid in the sandbox (requires --unshare-user)\n"
+           "    --hostname NAME              Custom hostname in the sandbox (requires --unshare-uts)\n"
+           "    --chdir DIR                  Change directory to DIR\n"
+           "    --setenv VAR VALUE           Set an environment variable\n"
+           "    --unsetenv VAR               Unset an environment variable\n"
+           "    --lock-file DEST             Take a lock on DEST while sandbox is running\n"
+           "    --sync-fd FD                 Keep this fd open while sandbox is running\n"
+           "    --bind SRC DEST              Bind mount the host path SRC on DEST\n"
+           "    --dev-bind SRC DEST          Bind mount the host path SRC on DEST, allowing device access\n"
+           "    --ro-bind SRC DEST           Bind mount the host path SRC readonly on DEST\n"
+           "    --remount-ro DEST            Remount DEST as readonly, it doesn't recursively remount\n"
+           "    --exec-label LABEL           Exec Label for the sandbox\n"
+           "    --file-label LABEL           File label for temporary sandbox content\n"
+           "    --proc DEST                  Mount procfs on DEST\n"
+           "    --dev DEST                   Mount new dev on DEST\n"
+           "    --tmpfs DEST                 Mount new tmpfs on DEST\n"
+           "    --mqueue DEST                Mount new mqueue on DEST\n"
+           "    --dir DEST                   Create dir at DEST\n"
+           "    --file FD DEST               Copy from FD to dest DEST\n"
+           "    --bind-data FD DEST          Copy from FD to file which is bind-mounted on DEST\n"
+           "    --ro-bind-data FD DEST       Copy from FD to file which is readonly bind-mounted on DEST\n"
+           "    --symlink SRC DEST           Create symlink at DEST with target SRC\n"
+           "    --seccomp FD                 Load and use seccomp rules from FD\n"
+           "    --block-fd FD                Block on FD until some data to read is available\n"
+           "    --info-fd FD                 Write information about the running container to FD\n"
+           "    --new-session                Create a new terminal session\n"
+           "    --die-with-parent            Kills with SIGKILL child process (COMMAND) when bwrap or bwrap's parent dies.\n"
+          );
+  exit (ecode);
+}
+
+/* If --die-with-parent was specified, use PDEATHSIG to ensure SIGKILL
+ * is sent to the current process when our parent dies.
+ */
+static void
+handle_die_with_parent (void)
+{
+  if (opt_die_with_parent && prctl (PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0)
+    die_with_error ("prctl");
+}
+
+static void
+block_sigchild (void)
+{
+  sigset_t mask;
+  int status;
+
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGCHLD);
+
+  if (sigprocmask (SIG_BLOCK, &mask, NULL) == -1)
+    die_with_error ("sigprocmask");
+
+  /* Reap any outstanding zombies that we may have inherited */
+  while (waitpid (-1, &status, WNOHANG) > 0)
+    ;
+}
+
+static void
+unblock_sigchild (void)
+{
+  sigset_t mask;
+
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGCHLD);
+
+  if (sigprocmask (SIG_UNBLOCK, &mask, NULL) == -1)
+    die_with_error ("sigprocmask");
+}
+
+/* Closes all fd:s except 0,1,2 and the passed in array of extra fds */
+static int
+close_extra_fds (void *data, int fd)
+{
+  int *extra_fds = (int *) data;
+  int i;
+
+  for (i = 0; extra_fds[i] != -1; i++)
+    if (fd == extra_fds[i])
+      return 0;
+
+  if (fd <= 2)
+    return 0;
+
+  close (fd);
+  return 0;
+}
+
+static int
+propagate_exit_status (int status)
+{
+  if (WIFEXITED (status))
+    return WEXITSTATUS (status);
+
+  /* The process died of a signal, we can't really report that, but we
+   * can at least be bash-compatible. The bash manpage says:
+   *   The return value of a simple command is its
+   *   exit status, or 128+n if the command is
+   *   terminated by signal n.
+   */
+  if (WIFSIGNALED (status))
+    return 128 + WTERMSIG (status);
+
+  /* Weird? */
+  return 255;
+}
+
+/* This stays around for as long as the initial process in the app does
+ * and when that exits it exits, propagating the exit status. We do this
+ * by having pid 1 in the sandbox detect this exit and tell the monitor
+ * the exit status via a eventfd. We also track the exit of the sandbox
+ * pid 1 via a signalfd for SIGCHLD, and exit with an error in this case.
+ * This is to catch e.g. problems during setup. */
+static void
+monitor_child (int event_fd, pid_t child_pid)
+{
+  int res;
+  uint64_t val;
+  ssize_t s;
+  int signal_fd;
+  sigset_t mask;
+  struct pollfd fds[2];
+  int num_fds;
+  struct signalfd_siginfo fdsi;
+  int dont_close[] = { event_fd, -1 };
+  pid_t died_pid;
+  int died_status;
+
+  /* Close all extra fds in the monitoring process.
+     Any passed in fds have been passed on to the child anyway. */
+  fdwalk (proc_fd, close_extra_fds, dont_close);
+
+  sigemptyset (&mask);
+  sigaddset (&mask, SIGCHLD);
+
+  signal_fd = signalfd (-1, &mask, SFD_CLOEXEC | SFD_NONBLOCK);
+  if (signal_fd == -1)
+    die_with_error ("Can't create signalfd");
+
+  num_fds = 1;
+  fds[0].fd = signal_fd;
+  fds[0].events = POLLIN;
+  if (event_fd != -1)
+    {
+      fds[1].fd = event_fd;
+      fds[1].events = POLLIN;
+      num_fds++;
+    }
+
+  while (1)
+    {
+      fds[0].revents = fds[1].revents = 0;
+      res = poll (fds, num_fds, -1);
+      if (res == -1 && errno != EINTR)
+        die_with_error ("poll");
+
+      /* Always read from the eventfd first, if pid 2 died then pid 1 often
+       * dies too, and we could race, reporting that first and we'd lose
+       * the real exit status. */
+      if (event_fd != -1)
+        {
+          s = read (event_fd, &val, 8);
+          if (s == -1 && errno != EINTR && errno != EAGAIN)
+            die_with_error ("read eventfd");
+          else if (s == 8)
+            exit ((int) val - 1);
+        }
+
+      /* We need to read the signal_fd, or it will keep polling as read,
+       * however we ignore the details as we get them from waitpid
+       * below anway */
+      s = read (signal_fd, &fdsi, sizeof (struct signalfd_siginfo));
+      if (s == -1 && errno != EINTR && errno != EAGAIN)
+        die_with_error ("read signalfd");
+
+      /* We may actually get several sigchld compressed into one
+         SIGCHLD, so we have to handle all of them. */
+      while ((died_pid = waitpid (-1, &died_status, WNOHANG)) > 0)
+        {
+          /* We may be getting sigchild from other children too. For instance if
+             someone created a child process, and then exec:ed bubblewrap. Ignore them */
+          if (died_pid == child_pid)
+            exit (propagate_exit_status (died_status));
+        }
+    }
+}
+
+/* This is pid 1 in the app sandbox. It is needed because we're using
+ * pid namespaces, and someone has to reap zombies in it. We also detect
+ * when the initial process (pid 2) dies and report its exit status to
+ * the monitor so that it can return it to the original spawner.
+ *
+ * When there are no other processes in the sandbox the wait will return
+ * ECHILD, and we then exit pid 1 to clean up the sandbox. */
+static int
+do_init (int event_fd, pid_t initial_pid, struct sock_fprog *seccomp_prog)
+{
+  int initial_exit_status = 1;
+  LockFile *lock;
+
+  for (lock = lock_files; lock != NULL; lock = lock->next)
+    {
+      int fd = open (lock->path, O_RDONLY | O_CLOEXEC);
+      if (fd == -1)
+        die_with_error ("Unable to open lock file %s", lock->path);
+
+      struct flock l = {
+        .l_type = F_RDLCK,
+        .l_whence = SEEK_SET,
+        .l_start = 0,
+        .l_len = 0
+      };
+
+      if (fcntl (fd, F_SETLK, &l) < 0)
+        die_with_error ("Unable to lock file %s", lock->path);
+
+      /* Keep fd open to hang on to lock */
+    }
+
+  /* Optionally bind our lifecycle to that of the caller */
+  handle_die_with_parent ();
+
+  if (seccomp_prog != NULL &&
+      prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, seccomp_prog) != 0)
+    die_with_error ("prctl(PR_SET_SECCOMP)");
+
+  while (TRUE)
+    {
+      pid_t child;
+      int status;
+
+      child = wait (&status);
+      if (child == initial_pid && event_fd != -1)
+        {
+          uint64_t val;
+          int res UNUSED;
+
+          initial_exit_status = propagate_exit_status (status);
+
+          val = initial_exit_status + 1;
+          res = write (event_fd, &val, 8);
+          /* Ignore res, if e.g. the parent died and closed event_fd
+             we don't want to error out here */
+        }
+
+      if (child == -1 && errno != EINTR)
+        {
+          if (errno != ECHILD)
+            die_with_error ("init wait()");
+          break;
+        }
+    }
+
+  return initial_exit_status;
+}
+
+/* low 32bit caps needed */
+#define REQUIRED_CAPS_0 (CAP_TO_MASK (CAP_SYS_ADMIN) | CAP_TO_MASK (CAP_SYS_CHROOT) | CAP_TO_MASK (CAP_NET_ADMIN) | CAP_TO_MASK (CAP_SETUID) | CAP_TO_MASK (CAP_SETGID))
+/* high 32bit caps needed */
+#define REQUIRED_CAPS_1 0
+
+static void
+set_required_caps (void)
+{
+  struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 };
+  struct __user_cap_data_struct data[2] = { { 0 } };
+
+  /* Drop all non-require capabilities */
+  data[0].effective = REQUIRED_CAPS_0;
+  data[0].permitted = REQUIRED_CAPS_0;
+  data[0].inheritable = 0;
+  data[1].effective = REQUIRED_CAPS_1;
+  data[1].permitted = REQUIRED_CAPS_1;
+  data[1].inheritable = 0;
+  if (capset (&hdr, data) < 0)
+    die_with_error ("capset failed");
+}
+
+static void
+drop_all_caps (void)
+{
+  struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 };
+  struct __user_cap_data_struct data[2] = { { 0 } };
+
+  if (capset (&hdr, data) < 0)
+    die_with_error ("capset failed");
+}
+
+static bool
+has_caps (void)
+{
+  struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 };
+  struct __user_cap_data_struct data[2] = { { 0 } };
+
+  if (capget (&hdr, data)  < 0)
+    die_with_error ("capget failed");
+
+  return data[0].permitted != 0 || data[1].permitted != 0;
+}
+
+static void
+drop_cap_bounding_set (void)
+{
+  unsigned long cap;
+
+  /* We ignore both EINVAL and EPERM, as we are actually relying
+   * on PR_SET_NO_NEW_PRIVS to ensure the right capabilities are
+   * available.  EPERM in particular can happen with old, buggy
+   * kernels.  See:
+   *  https://github.com/projectatomic/bubblewrap/pull/175#issuecomment-278051373
+   *  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/security/commoncap.c?id=160da84dbb39443fdade7151bc63a88f8e953077
+   */
+  for (cap = 0; cap <= 63; cap++)
+    {
+      int res = prctl (PR_CAPBSET_DROP, cap, 0, 0, 0);
+      if (res == -1 && !(errno == EINVAL || errno == EPERM))
+        die_with_error ("Dropping capability %ld from bounds", cap);
+    }
+}
+
+/* This acquires the privileges that the bwrap will need it to work.
+ * If bwrap is not setuid, then this does nothing, and it relies on
+ * unprivileged user namespaces to be used. This case is
+ * "is_privileged = FALSE".
+ *
+ * If bwrap is setuid, then we do things in phases.
+ * The first part is run as euid 0, but with with fsuid as the real user.
+ * The second part, inside the child, is run as the real user but with
+ * capabilities.
+ * And finally we drop all capabilities.
+ * The reason for the above dance is to avoid having the setup phase
+ * being able to read files the user can't, while at the same time
+ * working around various kernel issues. See below for details.
+ */
+static void
+acquire_privs (void)
+{
+  uid_t euid, new_fsuid;
+
+  euid = geteuid ();
+
+  /* Are we setuid ? */
+  if (real_uid != euid)
+    {
+      if (euid == 0)
+        is_privileged = TRUE;
+      else
+        die ("Unexpected setuid user %d, should be 0", euid);
+
+      /* We want to keep running as euid=0 until at the clone()
+       * operation because doing so will make the user namespace be
+       * owned by root, which makes it not ptrace:able by the user as
+       * it otherwise would be. After that we will run fully as the
+       * user, which is necessary e.g. to be able to read from a fuse
+       * mount from the user.
+       *
+       * However, we don't want to accidentally mis-use euid=0 for
+       * escalated filesystem access before the clone(), so we set
+       * fsuid to the uid.
+       */
+      if (setfsuid (real_uid) < 0)
+        die_with_error ("Unable to set fsuid");
+
+      /* setfsuid can't properly report errors, check that it worked (as per manpage) */
+      new_fsuid = setfsuid (-1);
+      if (new_fsuid != real_uid)
+        die ("Unable to set fsuid (was %d)", (int)new_fsuid);
+
+      /* We never need capabilies after execve(), so lets drop everything from the bounding set */
+      drop_cap_bounding_set ();
+
+      /* Keep only the required capabilities for setup */
+      set_required_caps ();
+    }
+  else if (real_uid != 0 && has_caps ())
+    {
+      /* We have some capabilities in the non-setuid case, which should not happen.
+         Probably caused by the binary being setcap instead of setuid which we
+         don't support anymore */
+      die ("Unexpected capabilities but not setuid, old file caps config?");
+    }
+
+  /* Else, we try unprivileged user namespaces */
+}
+
+/* This is called once we're inside the namespace */
+static void
+switch_to_user_with_privs (void)
+{
+  /* If we're in a new user namespace, we got back the bounding set, clear it again */
+  if (opt_unshare_user)
+    drop_cap_bounding_set ();
+
+  if (!is_privileged)
+    return;
+
+  /* Tell kernel not clear capabilities when later dropping root uid */
+  if (prctl (PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0)
+    die_with_error ("prctl(PR_SET_KEEPCAPS) failed");
+
+  if (setuid (opt_sandbox_uid) < 0)
+    die_with_error ("unable to drop root uid");
+
+  /* Regain effective required capabilities from permitted */
+  set_required_caps ();
+}
+
+static void
+drop_privs (void)
+{
+  if (!is_privileged)
+    return;
+
+  /* Drop root uid */
+  if (setuid (opt_sandbox_uid) < 0)
+    die_with_error ("unable to drop root uid");
+
+  drop_all_caps ();
+}
+
+static char *
+get_newroot_path (const char *path)
+{
+  while (*path == '/')
+    path++;
+  return strconcat ("/newroot/", path);
+}
+
+static char *
+get_oldroot_path (const char *path)
+{
+  while (*path == '/')
+    path++;
+  return strconcat ("/oldroot/", path);
+}
+
+static void
+write_uid_gid_map (uid_t sandbox_uid,
+                   uid_t parent_uid,
+                   uid_t sandbox_gid,
+                   uid_t parent_gid,
+                   pid_t pid,
+                   bool  deny_groups,
+                   bool  map_root)
+{
+  cleanup_free char *uid_map = NULL;
+  cleanup_free char *gid_map = NULL;
+  cleanup_free char *dir = NULL;
+  cleanup_fd int dir_fd = -1;
+  uid_t old_fsuid = -1;
+
+  if (pid == -1)
+    dir = xstrdup ("self");
+  else
+    dir = xasprintf ("%d", pid);
+
+  dir_fd = openat (proc_fd, dir, O_RDONLY | O_PATH);
+  if (dir_fd < 0)
+    die_with_error ("open /proc/%s failed", dir);
+
+  if (map_root && parent_uid != 0 && sandbox_uid != 0)
+    uid_map = xasprintf ("0 %d 1\n"
+                         "%d %d 1\n", overflow_uid, sandbox_uid, parent_uid);
+  else
+    uid_map = xasprintf ("%d %d 1\n", sandbox_uid, parent_uid);
+
+  if (map_root && parent_gid != 0 && sandbox_gid != 0)
+    gid_map = xasprintf ("0 %d 1\n"
+                         "%d %d 1\n", overflow_gid, sandbox_gid, parent_gid);
+  else
+    gid_map = xasprintf ("%d %d 1\n", sandbox_gid, parent_gid);
+
+  /* We have to be root to be allowed to write to the uid map
+   * for setuid apps, so temporary set fsuid to 0 */
+  if (is_privileged)
+    old_fsuid = setfsuid (0);
+
+  if (write_file_at (dir_fd, "uid_map", uid_map) != 0)
+    die_with_error ("setting up uid map");
+
+  if (deny_groups &&
+      write_file_at (dir_fd, "setgroups", "deny\n") != 0)
+    {
+      /* If /proc/[pid]/setgroups does not exist, assume we are
+       * running a linux kernel < 3.19, i.e. we live with the
+       * vulnerability known as CVE-2014-8989 in older kernels
+       * where setgroups does not exist.
+       */
+      if (errno != ENOENT)
+        die_with_error ("error writing to setgroups");
+    }
+
+  if (write_file_at (dir_fd, "gid_map", gid_map) != 0)
+    die_with_error ("setting up gid map");
+
+  if (is_privileged)
+    {
+      setfsuid (old_fsuid);
+      if (setfsuid (-1) != real_uid)
+        die ("Unable to re-set fsuid");
+    }
+}
+
+static void
+privileged_op (int         privileged_op_socket,
+               uint32_t    op,
+               uint32_t    flags,
+               const char *arg1,
+               const char *arg2)
+{
+  if (privileged_op_socket != -1)
+    {
+      uint32_t buffer[2048];  /* 8k, but is int32 to guarantee nice alignment */
+      PrivSepOp *op_buffer = (PrivSepOp *) buffer;
+      size_t buffer_size = sizeof (PrivSepOp);
+      uint32_t arg1_offset = 0, arg2_offset = 0;
+
+      /* We're unprivileged, send this request to the privileged part */
+
+      if (arg1 != NULL)
+        {
+          arg1_offset = buffer_size;
+          buffer_size += strlen (arg1) + 1;
+        }
+      if (arg2 != NULL)
+        {
+          arg2_offset = buffer_size;
+          buffer_size += strlen (arg2) + 1;
+        }
+
+      if (buffer_size >= sizeof (buffer))
+        die ("privilege separation operation to large");
+
+      op_buffer->op = op;
+      op_buffer->flags = flags;
+      op_buffer->arg1_offset = arg1_offset;
+      op_buffer->arg2_offset = arg2_offset;
+      if (arg1 != NULL)
+        strcpy ((char *) buffer + arg1_offset, arg1);
+      if (arg2 != NULL)
+        strcpy ((char *) buffer + arg2_offset, arg2);
+
+      if (write (privileged_op_socket, buffer, buffer_size) != buffer_size)
+        die ("Can't write to privileged_op_socket");
+
+      if (read (privileged_op_socket, buffer, 1) != 1)
+        die ("Can't read from privileged_op_socket");
+
+      return;
+    }
+
+  /*
+   * This runs a privileged request for the unprivileged setup
+   * code. Note that since the setup code is unprivileged it is not as
+   * trusted, so we need to verify that all requests only affect the
+   * child namespace as set up by the privileged parts of the setup,
+   * and that all the code is very careful about handling input.
+   *
+   * This means:
+   *  * Bind mounts are safe, since we always use filesystem namespace. They
+   *     must be recursive though, as otherwise you can use a non-recursive bind
+   *     mount to access an otherwise over-mounted mountpoint.
+   *  * Mounting proc, tmpfs, mqueue, devpts in the child namespace is assumed to
+   *    be safe.
+   *  * Remounting RO (even non-recursive) is safe because it decreases privileges.
+   *  * sethostname() is safe only if we set up a UTS namespace
+   */
+  switch (op)
+    {
+    case PRIV_SEP_OP_DONE:
+      break;
+
+    case PRIV_SEP_OP_REMOUNT_RO_NO_RECURSIVE:
+      if (bind_mount (proc_fd, NULL, arg2, BIND_READONLY) != 0)
+        die_with_error ("Can't remount readonly on %s", arg2);
+      break;
+
+    case PRIV_SEP_OP_BIND_MOUNT:
+      /* We always bind directories recursively, otherwise this would let us
+         access files that are otherwise covered on the host */
+      if (bind_mount (proc_fd, arg1, arg2, BIND_RECURSIVE | flags) != 0)
+        die_with_error ("Can't bind mount %s on %s", arg1, arg2);
+      break;
+
+    case PRIV_SEP_OP_PROC_MOUNT:
+      if (mount ("proc", arg1, "proc", MS_MGC_VAL | MS_NOSUID | MS_NOEXEC | MS_NODEV, NULL) != 0)
+        die_with_error ("Can't mount proc on %s", arg1);
+      break;
+
+    case PRIV_SEP_OP_TMPFS_MOUNT:
+      {
+        cleanup_free char *opt = label_mount ("mode=0755", opt_file_label);
+        if (mount ("tmpfs", arg1, "tmpfs", MS_MGC_VAL | MS_NOSUID | MS_NODEV, opt) != 0)
+          die_with_error ("Can't mount tmpfs on %s", arg1);
+        break;
+      }
+
+    case PRIV_SEP_OP_DEVPTS_MOUNT:
+      if (mount ("devpts", arg1, "devpts", MS_MGC_VAL | MS_NOSUID | MS_NOEXEC,
+                 "newinstance,ptmxmode=0666,mode=620") != 0)
+        die_with_error ("Can't mount devpts on %s", arg1);
+      break;
+
+    case PRIV_SEP_OP_MQUEUE_MOUNT:
+      if (mount ("mqueue", arg1, "mqueue", 0, NULL) != 0)
+        die_with_error ("Can't mount mqueue on %s", arg1);
+      break;
+
+    case PRIV_SEP_OP_SET_HOSTNAME:
+      /* This is checked at the start, but lets verify it here in case
+         something manages to send hacked priv-sep operation requests. */
+      if (!opt_unshare_uts)
+        die ("Refusing to set hostname in original namespace");
+      if (sethostname (arg1, strlen(arg1)) != 0)
+        die_with_error ("Can't set hostname to %s", arg1);
+      break;
+
+    default:
+      die ("Unexpected privileged op %d", op);
+    }
+}
+
+/* This is run unprivileged in the child namespace but can request
+ * some privileged operations (also in the child namespace) via the
+ * privileged_op_socket.
+ */
+static void
+setup_newroot (bool unshare_pid,
+               int  privileged_op_socket)
+{
+  SetupOp *op;
+
+  for (op = ops; op != NULL; op = op->next)
+    {
+      cleanup_free char *source = NULL;
+      cleanup_free char *dest = NULL;
+      int source_mode = 0;
+      int i;
+
+      if (op->source &&
+          op->type != SETUP_MAKE_SYMLINK)
+        {
+          source = get_oldroot_path (op->source);
+          source_mode = get_file_mode (source);
+          if (source_mode < 0)
+            die_with_error ("Can't get type of source %s", op->source);
+        }
+
+      if (op->dest &&
+          (op->flags & NO_CREATE_DEST) == 0)
+        {
+          dest = get_newroot_path (op->dest);
+          if (mkdir_with_parents (dest, 0755, FALSE) != 0)
+            die_with_error ("Can't mkdir parents for %s", op->dest);
+        }
+
+      switch (op->type)
+        {
+        case SETUP_RO_BIND_MOUNT:
+        case SETUP_DEV_BIND_MOUNT:
+        case SETUP_BIND_MOUNT:
+          if (source_mode == S_IFDIR)
+            {
+              if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+                die_with_error ("Can't mkdir %s", op->dest);
+            }
+          else if (ensure_file (dest, 0666) != 0)
+            die_with_error ("Can't create file at %s", op->dest);
+
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_BIND_MOUNT,
+                         (op->type == SETUP_RO_BIND_MOUNT ? BIND_READONLY : 0) |
+                         (op->type == SETUP_DEV_BIND_MOUNT ? BIND_DEVICES : 0),
+                         source, dest);
+          break;
+
+        case SETUP_REMOUNT_RO_NO_RECURSIVE:
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_REMOUNT_RO_NO_RECURSIVE, 0, NULL, dest);
+          break;
+
+        case SETUP_MOUNT_PROC:
+          if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+            die_with_error ("Can't mkdir %s", op->dest);
+
+          if (unshare_pid)
+            {
+              /* Our own procfs */
+              privileged_op (privileged_op_socket,
+                             PRIV_SEP_OP_PROC_MOUNT, 0,
+                             dest, NULL);
+            }
+          else
+            {
+              /* Use system procfs, as we share pid namespace anyway */
+              privileged_op (privileged_op_socket,
+                             PRIV_SEP_OP_BIND_MOUNT, 0,
+                             "oldroot/proc", dest);
+            }
+
+          /* There are a bunch of weird old subdirs of /proc that could potentially be
+             problematic (for instance /proc/sysrq-trigger lets you shut down the machine
+             if you have write access). We should not have access to these as a non-privileged
+             user, but lets cover them anyway just to make sure */
+          const char *cover_proc_dirs[] = { "sys", "sysrq-trigger", "irq", "bus" };
+          for (i = 0; i < N_ELEMENTS (cover_proc_dirs); i++)
+            {
+              cleanup_free char *subdir = strconcat3 (dest, "/", cover_proc_dirs[i]);
+              /* Some of these may not exist */
+              if (get_file_mode (subdir) == -1)
+                continue;
+              privileged_op (privileged_op_socket,
+                             PRIV_SEP_OP_BIND_MOUNT, BIND_READONLY,
+                             subdir, subdir);
+            }
+
+          break;
+
+        case SETUP_MOUNT_DEV:
+          if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+            die_with_error ("Can't mkdir %s", op->dest);
+
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_TMPFS_MOUNT, 0,
+                         dest, NULL);
+
+          static const char *const devnodes[] = { "null", "zero", "full", "random", "urandom", "tty" };
+          for (i = 0; i < N_ELEMENTS (devnodes); i++)
+            {
+              cleanup_free char *node_dest = strconcat3 (dest, "/", devnodes[i]);
+              cleanup_free char *node_src = strconcat ("/oldroot/dev/", devnodes[i]);
+              if (create_file (node_dest, 0666, NULL) != 0)
+                die_with_error ("Can't create file %s/%s", op->dest, devnodes[i]);
+              privileged_op (privileged_op_socket,
+                             PRIV_SEP_OP_BIND_MOUNT, BIND_DEVICES,
+                             node_src, node_dest);
+            }
+
+          static const char *const stdionodes[] = { "stdin", "stdout", "stderr" };
+          for (i = 0; i < N_ELEMENTS (stdionodes); i++)
+            {
+              cleanup_free char *target = xasprintf ("/proc/self/fd/%d", i);
+              cleanup_free char *node_dest = strconcat3 (dest, "/", stdionodes[i]);
+              if (symlink (target, node_dest) < 0)
+                die_with_error ("Can't create symlink %s/%s", op->dest, stdionodes[i]);
+            }
+
+          {
+            cleanup_free char *pts = strconcat (dest, "/pts");
+            cleanup_free char *ptmx = strconcat (dest, "/ptmx");
+            cleanup_free char *shm = strconcat (dest, "/shm");
+
+            if (mkdir (shm, 0755) == -1)
+              die_with_error ("Can't create %s/shm", op->dest);
+
+            if (mkdir (pts, 0755) == -1)
+              die_with_error ("Can't create %s/devpts", op->dest);
+            privileged_op (privileged_op_socket,
+                           PRIV_SEP_OP_DEVPTS_MOUNT, 0, pts, NULL);
+
+            if (symlink ("pts/ptmx", ptmx) != 0)
+              die_with_error ("Can't make symlink at %s/ptmx", op->dest);
+          }
+
+          /* If stdout is a tty, that means the sandbox can write to the
+             outside-sandbox tty. In that case we also create a /dev/console
+             that points to this tty device. This should not cause any more
+             access than we already have, and it makes ttyname() work in the
+             sandbox. */
+          if (host_tty_dev != NULL && *host_tty_dev != 0)
+            {
+              cleanup_free char *src_tty_dev = strconcat ("/oldroot", host_tty_dev);
+              cleanup_free char *dest_console = strconcat (dest, "/console");
+
+              if (create_file (dest_console, 0666, NULL) != 0)
+                die_with_error ("creating %s/console", op->dest);
+
+              privileged_op (privileged_op_socket,
+                             PRIV_SEP_OP_BIND_MOUNT, BIND_DEVICES,
+                             src_tty_dev, dest_console);
+            }
+
+          break;
+
+        case SETUP_MOUNT_TMPFS:
+          if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+            die_with_error ("Can't mkdir %s", op->dest);
+
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_TMPFS_MOUNT, 0,
+                         dest, NULL);
+          break;
+
+        case SETUP_MOUNT_MQUEUE:
+          if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+            die_with_error ("Can't mkdir %s", op->dest);
+
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_MQUEUE_MOUNT, 0,
+                         dest, NULL);
+          break;
+
+        case SETUP_MAKE_DIR:
+          if (mkdir (dest, 0755) != 0 && errno != EEXIST)
+            die_with_error ("Can't mkdir %s", op->dest);
+
+          break;
+
+        case SETUP_MAKE_FILE:
+          {
+            cleanup_fd int dest_fd = -1;
+
+            dest_fd = creat (dest, 0666);
+            if (dest_fd == -1)
+              die_with_error ("Can't create file %s", op->dest);
+
+            if (copy_file_data (op->fd, dest_fd) != 0)
+              die_with_error ("Can't write data to file %s", op->dest);
+
+            close (op->fd);
+          }
+          break;
+
+        case SETUP_MAKE_BIND_FILE:
+        case SETUP_MAKE_RO_BIND_FILE:
+          {
+            cleanup_fd int dest_fd = -1;
+            char tempfile[] = "/bindfileXXXXXX";
+
+            dest_fd = mkstemp (tempfile);
+            if (dest_fd == -1)
+              die_with_error ("Can't create tmpfile for %s", op->dest);
+
+            if (copy_file_data (op->fd, dest_fd) != 0)
+              die_with_error ("Can't write data to file %s", op->dest);
+
+            close (op->fd);
+
+            if (ensure_file (dest, 0666) != 0)
+              die_with_error ("Can't create file at %s", op->dest);
+
+            privileged_op (privileged_op_socket,
+                           PRIV_SEP_OP_BIND_MOUNT,
+                           (op->type == SETUP_MAKE_RO_BIND_FILE ? BIND_READONLY : 0),
+                           tempfile, dest);
+
+            /* Remove the file so we're sure the app can't get to it in any other way.
+               Its outside the container chroot, so it shouldn't be possible, but lets
+               make it really sure. */
+            unlink (tempfile);
+          }
+          break;
+
+        case SETUP_MAKE_SYMLINK:
+          if (symlink (op->source, dest) != 0)
+            die_with_error ("Can't make symlink at %s", op->dest);
+          break;
+
+        case SETUP_SET_HOSTNAME:
+          privileged_op (privileged_op_socket,
+                         PRIV_SEP_OP_SET_HOSTNAME, 0,
+                         op->dest, NULL);
+          break;
+
+        default:
+          die ("Unexpected type %d", op->type);
+        }
+    }
+  privileged_op (privileged_op_socket,
+                 PRIV_SEP_OP_DONE, 0, NULL, NULL);
+}
+
+/* We need to resolve relative symlinks in the sandbox before we
+   chroot so that absolute symlinks are handled correctly. We also
+   need to do this after we've switched to the real uid so that
+   e.g. paths on fuse mounts work */
+static void
+resolve_symlinks_in_ops (void)
+{
+  SetupOp *op;
+
+  for (op = ops; op != NULL; op = op->next)
+    {
+      const char *old_source;
+
+      switch (op->type)
+        {
+        case SETUP_RO_BIND_MOUNT:
+        case SETUP_DEV_BIND_MOUNT:
+        case SETUP_BIND_MOUNT:
+          old_source = op->source;
+          op->source = realpath (old_source, NULL);
+          if (op->source == NULL)
+            die_with_error ("Can't find source path %s", old_source);
+          break;
+        default:
+          break;
+        }
+    }
+}
+
+
+static const char *
+resolve_string_offset (void    *buffer,
+                       size_t   buffer_size,
+                       uint32_t offset)
+{
+  if (offset == 0)
+    return NULL;
+
+  if (offset > buffer_size)
+    die ("Invalid string offset %d (buffer size %zd)", offset, buffer_size);
+
+  return (const char *) buffer + offset;
+}
+
+static uint32_t
+read_priv_sec_op (int          read_socket,
+                  void        *buffer,
+                  size_t       buffer_size,
+                  uint32_t    *flags,
+                  const char **arg1,
+                  const char **arg2)
+{
+  const PrivSepOp *op = (const PrivSepOp *) buffer;
+  ssize_t rec_len;
+
+  do
+    rec_len = read (read_socket, buffer, buffer_size - 1);
+  while (rec_len == -1 && errno == EINTR);
+
+  if (rec_len < 0)
+    die_with_error ("Can't read from unprivileged helper");
+
+  if (rec_len == 0)
+    exit (1); /* Privileged helper died and printed error, so exit silently */
+
+  if (rec_len < sizeof (PrivSepOp))
+    die ("Invalid size %zd from unprivileged helper", rec_len);
+
+  /* Guarantee zero termination of any strings */
+  ((char *) buffer)[rec_len] = 0;
+
+  *flags = op->flags;
+  *arg1 = resolve_string_offset (buffer, rec_len, op->arg1_offset);
+  *arg2 = resolve_string_offset (buffer, rec_len, op->arg2_offset);
+
+  return op->op;
+}
+
+static void __attribute__ ((noreturn))
+print_version_and_exit (void)
+{
+  printf ("%s\n", PACKAGE_STRING);
+  exit (0);
+}
+
+static void
+parse_args_recurse (int    *argcp,
+                    char ***argvp,
+                    bool    in_file,
+                    int    *total_parsed_argc_p)
+{
+  SetupOp *op;
+  int argc = *argcp;
+  char **argv = *argvp;
+  /* I can't imagine a case where someone wants more than this.
+   * If you do...you should be able to pass multiple files
+   * via a single tmpfs and linking them there, etc.
+   *
+   * We're adding this hardening due to precedent from
+   * http://googleprojectzero.blogspot.com/2014/08/the-poisoned-nul-byte-2014-edition.html
+   *
+   * I picked 9000 because the Internet told me to and it was hard to
+   * resist.
+   */
+  static const uint32_t MAX_ARGS = 9000;
+
+  if (*total_parsed_argc_p > MAX_ARGS)
+    die ("Exceeded maximum number of arguments %u", MAX_ARGS);
+
+  while (argc > 0)
+    {
+      const char *arg = argv[0];
+
+      if (strcmp (arg, "--help") == 0)
+        {
+          usage (EXIT_SUCCESS, stdout);
+        }
+      else if (strcmp (arg, "--version") == 0)
+        {
+          print_version_and_exit ();
+        }
+      else if (strcmp (arg, "--args") == 0)
+        {
+          int the_fd;
+          char *endptr;
+          char *data, *p;
+          char *data_end;
+          size_t data_len;
+          cleanup_free char **data_argv = NULL;
+          char **data_argv_copy;
+          int data_argc;
+          int i;
+
+          if (in_file)
+            die ("--args not supported in arguments file");
+
+          if (argc < 2)
+            die ("--args takes an argument");
+
+          the_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          data = load_file_data (the_fd, &data_len);
+          if (data == NULL)
+            die_with_error ("Can't read --args data");
+
+          data_end = data + data_len;
+          data_argc = 0;
+
+          p = data;
+          while (p != NULL && p < data_end)
+            {
+              data_argc++;
+              (*total_parsed_argc_p)++;
+              if (*total_parsed_argc_p > MAX_ARGS)
+                die ("Exceeded maximum number of arguments %u", MAX_ARGS);
+              p = memchr (p, 0, data_end - p);
+              if (p != NULL)
+                p++;
+            }
+
+          data_argv = xcalloc (sizeof (char *) * (data_argc + 1));
+
+          i = 0;
+          p = data;
+          while (p != NULL && p < data_end)
+            {
+              /* Note: load_file_data always adds a nul terminator, so this is safe
+               * even for the last string. */
+              data_argv[i++] = p;
+              p = memchr (p, 0, data_end - p);
+              if (p != NULL)
+                p++;
+            }
+
+          data_argv_copy = data_argv; /* Don't change data_argv, we need to free it */
+          parse_args_recurse (&data_argc, &data_argv_copy, TRUE, total_parsed_argc_p);
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--unshare-all") == 0)
+        {
+          /* Keep this in order with the older (legacy) --unshare arguments,
+           * we use the --try variants of user and cgroup, since we want
+           * to support systems/kernels without support for those.
+           */
+          opt_unshare_user_try = opt_unshare_ipc = opt_unshare_pid =
+            opt_unshare_uts = opt_unshare_cgroup_try =
+            opt_unshare_net = TRUE;
+        }
+      /* Begin here the older individual --unshare variants */
+      else if (strcmp (arg, "--unshare-user") == 0)
+        {
+          opt_unshare_user = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-user-try") == 0)
+        {
+          opt_unshare_user_try = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-ipc") == 0)
+        {
+          opt_unshare_ipc = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-pid") == 0)
+        {
+          opt_unshare_pid = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-net") == 0)
+        {
+          opt_unshare_net = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-uts") == 0)
+        {
+          opt_unshare_uts = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-cgroup") == 0)
+        {
+          opt_unshare_cgroup = TRUE;
+        }
+      else if (strcmp (arg, "--unshare-cgroup-try") == 0)
+        {
+          opt_unshare_cgroup_try = TRUE;
+        }
+      /* Begin here the newer --share variants */
+      else if (strcmp (arg, "--share-net") == 0)
+        {
+          opt_unshare_net = FALSE;
+        }
+      /* End --share variants, other arguments begin */
+      else if (strcmp (arg, "--chdir") == 0)
+        {
+          if (argc < 2)
+            die ("--chdir takes one argument");
+
+          opt_chdir_path = argv[1];
+          argv++;
+          argc--;
+        }
+      else if (strcmp (arg, "--remount-ro") == 0)
+        {
+          if (argc < 2)
+            die ("--remount-ro takes one argument");
+
+          SetupOp *op = setup_op_new (SETUP_REMOUNT_RO_NO_RECURSIVE);
+          op->dest = argv[1];
+
+          argv++;
+          argc--;
+        }
+      else if (strcmp (arg, "--bind") == 0)
+        {
+          if (argc < 3)
+            die ("--bind takes two arguments");
+
+          op = setup_op_new (SETUP_BIND_MOUNT);
+          op->source = argv[1];
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--ro-bind") == 0)
+        {
+          if (argc < 3)
+            die ("--ro-bind takes two arguments");
+
+          op = setup_op_new (SETUP_RO_BIND_MOUNT);
+          op->source = argv[1];
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--dev-bind") == 0)
+        {
+          if (argc < 3)
+            die ("--dev-bind takes two arguments");
+
+          op = setup_op_new (SETUP_DEV_BIND_MOUNT);
+          op->source = argv[1];
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--proc") == 0)
+        {
+          if (argc < 2)
+            die ("--proc takes an argument");
+
+          op = setup_op_new (SETUP_MOUNT_PROC);
+          op->dest = argv[1];
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--exec-label") == 0)
+        {
+          if (argc < 2)
+            die ("--exec-label takes an argument");
+          opt_exec_label = argv[1];
+          die_unless_label_valid (opt_exec_label);
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--file-label") == 0)
+        {
+          if (argc < 2)
+            die ("--file-label takes an argument");
+          opt_file_label = argv[1];
+          die_unless_label_valid (opt_file_label);
+          if (label_create_file (opt_file_label))
+            die_with_error ("--file-label setup failed");
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--dev") == 0)
+        {
+          if (argc < 2)
+            die ("--dev takes an argument");
+
+          op = setup_op_new (SETUP_MOUNT_DEV);
+          op->dest = argv[1];
+          opt_needs_devpts = TRUE;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--tmpfs") == 0)
+        {
+          if (argc < 2)
+            die ("--tmpfs takes an argument");
+
+          op = setup_op_new (SETUP_MOUNT_TMPFS);
+          op->dest = argv[1];
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--mqueue") == 0)
+        {
+          if (argc < 2)
+            die ("--mqueue takes an argument");
+
+          op = setup_op_new (SETUP_MOUNT_MQUEUE);
+          op->dest = argv[1];
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--dir") == 0)
+        {
+          if (argc < 2)
+            die ("--dir takes an argument");
+
+          op = setup_op_new (SETUP_MAKE_DIR);
+          op->dest = argv[1];
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--file") == 0)
+        {
+          int file_fd;
+          char *endptr;
+
+          if (argc < 3)
+            die ("--file takes two arguments");
+
+          file_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || file_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          op = setup_op_new (SETUP_MAKE_FILE);
+          op->fd = file_fd;
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--bind-data") == 0)
+        {
+          int file_fd;
+          char *endptr;
+
+          if (argc < 3)
+            die ("--bind-data takes two arguments");
+
+          file_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || file_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          op = setup_op_new (SETUP_MAKE_BIND_FILE);
+          op->fd = file_fd;
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--ro-bind-data") == 0)
+        {
+          int file_fd;
+          char *endptr;
+
+          if (argc < 3)
+            die ("--ro-bind-data takes two arguments");
+
+          file_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || file_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          op = setup_op_new (SETUP_MAKE_RO_BIND_FILE);
+          op->fd = file_fd;
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--symlink") == 0)
+        {
+          if (argc < 3)
+            die ("--symlink takes two arguments");
+
+          op = setup_op_new (SETUP_MAKE_SYMLINK);
+          op->source = argv[1];
+          op->dest = argv[2];
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--lock-file") == 0)
+        {
+          if (argc < 2)
+            die ("--lock-file takes an argument");
+
+          (void) lock_file_new (argv[1]);
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--sync-fd") == 0)
+        {
+          int the_fd;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--sync-fd takes an argument");
+
+          the_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          opt_sync_fd = the_fd;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--block-fd") == 0)
+        {
+          int the_fd;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--block-fd takes an argument");
+
+          the_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          opt_block_fd = the_fd;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--info-fd") == 0)
+        {
+          int the_fd;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--info-fd takes an argument");
+
+          the_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          opt_info_fd = the_fd;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--seccomp") == 0)
+        {
+          int the_fd;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--seccomp takes an argument");
+
+          the_fd = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_fd < 0)
+            die ("Invalid fd: %s", argv[1]);
+
+          opt_seccomp_fd = the_fd;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--setenv") == 0)
+        {
+          if (argc < 3)
+            die ("--setenv takes two arguments");
+
+          xsetenv (argv[1], argv[2], 1);
+
+          argv += 2;
+          argc -= 2;
+        }
+      else if (strcmp (arg, "--unsetenv") == 0)
+        {
+          if (argc < 2)
+            die ("--unsetenv takes an argument");
+
+          xunsetenv (argv[1]);
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--uid") == 0)
+        {
+          int the_uid;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--uid takes an argument");
+
+          the_uid = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_uid < 0)
+            die ("Invalid uid: %s", argv[1]);
+
+          opt_sandbox_uid = the_uid;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--gid") == 0)
+        {
+          int the_gid;
+          char *endptr;
+
+          if (argc < 2)
+            die ("--gid takes an argument");
+
+          the_gid = strtol (argv[1], &endptr, 10);
+          if (argv[1][0] == 0 || endptr[0] != 0 || the_gid < 0)
+            die ("Invalid gid: %s", argv[1]);
+
+          opt_sandbox_gid = the_gid;
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--hostname") == 0)
+        {
+          if (argc < 2)
+            die ("--hostname takes an argument");
+
+          op = setup_op_new (SETUP_SET_HOSTNAME);
+          op->dest = argv[1];
+          op->flags = NO_CREATE_DEST;
+
+          opt_sandbox_hostname = argv[1];
+
+          argv += 1;
+          argc -= 1;
+        }
+      else if (strcmp (arg, "--new-session") == 0)
+        {
+          opt_new_session = TRUE;
+        }
+      else if (strcmp (arg, "--die-with-parent") == 0)
+        {
+          opt_die_with_parent = TRUE;
+        }
+      else if (*arg == '-')
+        {
+          die ("Unknown option %s", arg);
+        }
+      else
+        {
+          break;
+        }
+
+      argv++;
+      argc--;
+    }
+
+  *argcp = argc;
+  *argvp = argv;
+}
+
+static void
+parse_args (int    *argcp,
+            char ***argvp)
+{
+  int total_parsed_argc = *argcp;
+
+  parse_args_recurse (argcp, argvp, FALSE, &total_parsed_argc);
+}
+
+static void
+read_overflowids (void)
+{
+  cleanup_free char *uid_data = NULL;
+  cleanup_free char *gid_data = NULL;
+
+  uid_data = load_file_at (AT_FDCWD, "/proc/sys/kernel/overflowuid");
+  if (uid_data == NULL)
+    die_with_error ("Can't read /proc/sys/kernel/overflowuid");
+
+  overflow_uid = strtol (uid_data, NULL, 10);
+  if (overflow_uid == 0)
+    die ("Can't parse /proc/sys/kernel/overflowuid");
+
+  gid_data = load_file_at (AT_FDCWD, "/proc/sys/kernel/overflowgid");
+  if (gid_data == NULL)
+    die_with_error ("Can't read /proc/sys/kernel/overflowgid");
+
+  overflow_gid = strtol (gid_data, NULL, 10);
+  if (overflow_gid == 0)
+    die ("Can't parse /proc/sys/kernel/overflowgid");
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  mode_t old_umask;
+  cleanup_free char *base_path = NULL;
+  int clone_flags;
+  char *old_cwd = NULL;
+  pid_t pid;
+  int event_fd = -1;
+  int child_wait_fd = -1;
+  const char *new_cwd;
+  uid_t ns_uid;
+  gid_t ns_gid;
+  struct stat sbuf;
+  uint64_t val;
+  int res UNUSED;
+  cleanup_free char *seccomp_data = NULL;
+  size_t seccomp_len;
+  struct sock_fprog seccomp_prog;
+
+  /* Handle --version early on before we try to acquire/drop
+   * any capabilities so it works in a build environment;
+   * right now flatpak's build runs bubblewrap --version.
+   * https://github.com/projectatomic/bubblewrap/issues/185
+   */
+  if (argc == 2 && (strcmp (argv[1], "--version") == 0))
+    print_version_and_exit ();
+
+  real_uid = getuid ();
+  real_gid = getgid ();
+
+  /* Get the (optional) privileges we need */
+  acquire_privs ();
+
+  /* Never gain any more privs during exec */
+  if (prctl (PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0)
+    die_with_error ("prctl(PR_SET_NO_NEW_CAPS) failed");
+
+  /* The initial code is run with high permissions
+     (i.e. CAP_SYS_ADMIN), so take lots of care. */
+
+  read_overflowids ();
+
+  argv0 = argv[0];
+
+  if (isatty (1))
+    host_tty_dev = ttyname (1);
+
+  argv++;
+  argc--;
+
+  if (argc == 0)
+    usage (EXIT_FAILURE, stderr);
+
+  parse_args (&argc, &argv);
+
+  /* We have to do this if we weren't installed setuid (and we're not
+   * root), so let's just DWIM */
+  if (!is_privileged && getuid () != 0)
+    opt_unshare_user = TRUE;
+
+#ifdef ENABLE_REQUIRE_USERNS
+  /* In this build option, we require userns. */
+  if (is_privileged && getuid () != 0)
+    opt_unshare_user = TRUE;
+#endif
+
+  if (opt_unshare_user_try &&
+      stat ("/proc/self/ns/user", &sbuf) == 0)
+    {
+      bool disabled = FALSE;
+
+      /* RHEL7 has a kernel module parameter that lets you enable user namespaces */
+      if (stat ("/sys/module/user_namespace/parameters/enable", &sbuf) == 0)
+        {
+          cleanup_free char *enable = NULL;
+          enable = load_file_at (AT_FDCWD, "/sys/module/user_namespace/parameters/enable");
+          if (enable != NULL && enable[0] == 'N')
+            disabled = TRUE;
+        }
+
+      /* Debian lets you disable *unprivileged* user namespaces. However this is not
+         a problem if we're privileged, and if we're not opt_unshare_user is TRUE
+         already, and there is not much we can do, its just a non-working setup. */
+
+      if (!disabled)
+        opt_unshare_user = TRUE;
+    }
+
+  if (argc == 0)
+    usage (EXIT_FAILURE, stderr);
+
+  __debug__ (("Creating root mount point\n"));
+
+  if (opt_sandbox_uid == -1)
+    opt_sandbox_uid = real_uid;
+  if (opt_sandbox_gid == -1)
+    opt_sandbox_gid = real_gid;
+
+  if (!opt_unshare_user && opt_sandbox_uid != real_uid)
+    die ("Specifying --uid requires --unshare-user");
+
+  if (!opt_unshare_user && opt_sandbox_gid != real_gid)
+    die ("Specifying --gid requires --unshare-user");
+
+  if (!opt_unshare_uts && opt_sandbox_hostname != NULL)
+    die ("Specifying --hostname requires --unshare-uts");
+
+  /* We need to read stuff from proc during the pivot_root dance, etc.
+     Lets keep a fd to it open */
+  proc_fd = open ("/proc", O_RDONLY | O_PATH);
+  if (proc_fd == -1)
+    die_with_error ("Can't open /proc");
+
+  /* We need *some* mountpoint where we can mount the root tmpfs.
+     We first try in /run, and if that fails, try in /tmp. */
+  base_path = xasprintf ("/run/user/%d/.bubblewrap", real_uid);
+  if (mkdir (base_path, 0755) && errno != EEXIST)
+    {
+      free (base_path);
+      base_path = xasprintf ("/tmp/.bubblewrap-%d", real_uid);
+      if (mkdir (base_path, 0755) && errno != EEXIST)
+        die_with_error ("Creating root mountpoint failed");
+    }
+
+  __debug__ (("creating new namespace\n"));
+
+  if (opt_unshare_pid)
+    {
+      event_fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK);
+      if (event_fd == -1)
+        die_with_error ("eventfd()");
+    }
+
+  /* We block sigchild here so that we can use signalfd in the monitor. */
+  block_sigchild ();
+
+  clone_flags = SIGCHLD | CLONE_NEWNS;
+  if (opt_unshare_user)
+    clone_flags |= CLONE_NEWUSER;
+  if (opt_unshare_pid)
+    clone_flags |= CLONE_NEWPID;
+  if (opt_unshare_net)
+    clone_flags |= CLONE_NEWNET;
+  if (opt_unshare_ipc)
+    clone_flags |= CLONE_NEWIPC;
+  if (opt_unshare_uts)
+    clone_flags |= CLONE_NEWUTS;
+  if (opt_unshare_cgroup)
+    {
+      if (stat ("/proc/self/ns/cgroup", &sbuf))
+        {
+          if (errno == ENOENT)
+            die ("Cannot create new cgroup namespace because the kernel does not support it");
+          else
+            die_with_error ("stat on /proc/self/ns/cgroup failed");
+        }
+      clone_flags |= CLONE_NEWCGROUP;
+    }
+  if (opt_unshare_cgroup_try)
+    if (!stat ("/proc/self/ns/cgroup", &sbuf))
+      clone_flags |= CLONE_NEWCGROUP;
+
+  child_wait_fd = eventfd (0, EFD_CLOEXEC);
+  if (child_wait_fd == -1)
+    die_with_error ("eventfd()");
+
+  pid = raw_clone (clone_flags, NULL);
+  if (pid == -1)
+    {
+      if (opt_unshare_user)
+        {
+          if (errno == EINVAL)
+            die ("Creating new namespace failed, likely because the kernel does not support user namespaces.  bwrap must be installed setuid on such systems.");
+          else if (errno == EPERM && !is_privileged)
+            die ("No permissions to creating new namespace, likely because the kernel does not allow non-privileged user namespaces. On e.g. debian this can be enabled with 'sysctl kernel.unprivileged_userns_clone=1'.");
+        }
+
+      die_with_error ("Creating new namespace failed");
+    }
+
+  ns_uid = opt_sandbox_uid;
+  ns_gid = opt_sandbox_gid;
+
+  if (pid != 0)
+    {
+      /* Parent, outside sandbox, privileged (initially) */
+
+      if (is_privileged && opt_unshare_user)
+        {
+          /* We're running as euid 0, but the uid we want to map is
+           * not 0. This means we're not allowed to write this from
+           * the child user namespace, so we do it from the parent.
+           *
+           * Also, we map uid/gid 0 in the namespace (to overflowuid)
+           * if opt_needs_devpts is true, because otherwise the mount
+           * of devpts fails due to root not being mapped.
+           */
+          write_uid_gid_map (ns_uid, real_uid,
+                             ns_gid, real_gid,
+                             pid, TRUE, opt_needs_devpts);
+        }
+
+      /* Initial launched process, wait for exec:ed command to exit */
+
+      /* We don't need any privileges in the launcher, drop them immediately. */
+      drop_privs ();
+
+      /* Optionally bind our lifecycle to that of the parent */
+      handle_die_with_parent ();
+
+      /* Let child run now that the uid maps are set up */
+      val = 1;
+      res = write (child_wait_fd, &val, 8);
+      /* Ignore res, if e.g. the child died and closed child_wait_fd we don't want to error out here */
+      close (child_wait_fd);
+
+      if (opt_info_fd != -1)
+        {
+          cleanup_free char *output = xasprintf ("{\n    \"child-pid\": %i\n}\n", pid);
+          size_t len = strlen (output);
+          if (write (opt_info_fd, output, len) != len)
+            die_with_error ("Write to info_fd");
+          close (opt_info_fd);
+        }
+
+      monitor_child (event_fd, pid);
+      exit (0); /* Should not be reached, but better safe... */
+    }
+
+  /* Child, in sandbox, privileged in the parent or in the user namespace (if --unshare-user).
+   *
+   * Note that for user namespaces we run as euid 0 during clone(), so
+   * the child user namespace is owned by euid 0., This means that the
+   * regular user namespace parent (with uid != 0) doesn't have any
+   * capabilities in it, which is nice as we can't exploit those. In
+   * particular the parent user namespace doesn't have CAP_PTRACE
+   * which would otherwise allow the parent to hijack of the child
+   * after this point.
+   *
+   * Unfortunately this also means you can't ptrace the final
+   * sandboxed process from outside the sandbox either.
+   */
+
+  if (opt_info_fd != -1)
+    close (opt_info_fd);
+
+  /* Wait for the parent to init uid/gid maps and drop caps */
+  res = read (child_wait_fd, &val, 8);
+  close (child_wait_fd);
+
+  /* At this point we can completely drop root uid, but retain the
+   * required permitted caps. This allow us to do full setup as
+   * the user uid, which makes e.g. fuse access work.
+   */
+  switch_to_user_with_privs ();
+
+  if (opt_unshare_net)
+    loopback_setup (); /* Will exit if unsuccessful */
+
+  ns_uid = opt_sandbox_uid;
+  ns_gid = opt_sandbox_gid;
+  if (!is_privileged && opt_unshare_user)
+    {
+      /* In the unprivileged case we have to write the uid/gid maps in
+       * the child, because we have no caps in the parent */
+
+      if (opt_needs_devpts)
+        {
+          /* This is a bit hacky, but we need to first map the real uid/gid to
+             0, otherwise we can't mount the devpts filesystem because root is
+             not mapped. Later we will create another child user namespace and
+             map back to the real uid */
+          ns_uid = 0;
+          ns_gid = 0;
+        }
+
+      write_uid_gid_map (ns_uid, real_uid,
+                         ns_gid, real_gid,
+                         -1, TRUE, FALSE);
+    }
+
+  old_umask = umask (0);
+
+  /* Need to do this before the chroot, but after we're the real uid */
+  resolve_symlinks_in_ops ();
+
+  /* Mark everything as slave, so that we still
+   * receive mounts from the real root, but don't
+   * propagate mounts to the real root. */
+  if (mount (NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0)
+    die_with_error ("Failed to make / slave");
+
+  /* Create a tmpfs which we will use as / in the namespace */
+  if (mount ("", base_path, "tmpfs", MS_NODEV | MS_NOSUID, NULL) != 0)
+    die_with_error ("Failed to mount tmpfs");
+
+  old_cwd = get_current_dir_name ();
+
+  /* Chdir to the new root tmpfs mount. This will be the CWD during
+     the entire setup. Access old or new root via "oldroot" and "newroot". */
+  if (chdir (base_path) != 0)
+    die_with_error ("chdir base_path");
+
+  /* We create a subdir "$base_path/newroot" for the new root, that
+   * way we can pivot_root to base_path, and put the old root at
+   * "$base_path/oldroot". This avoids problems accessing the oldroot
+   * dir if the user requested to bind mount something over / */
+
+  if (mkdir ("newroot", 0755))
+    die_with_error ("Creating newroot failed");
+
+  if (mkdir ("oldroot", 0755))
+    die_with_error ("Creating oldroot failed");
+
+  if (pivot_root (base_path, "oldroot"))
+    die_with_error ("pivot_root");
+
+  if (chdir ("/") != 0)
+    die_with_error ("chdir / (base path)");
+
+  if (is_privileged)
+    {
+      pid_t child;
+      int privsep_sockets[2];
+
+      if (socketpair (AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, privsep_sockets) != 0)
+        die_with_error ("Can't create privsep socket");
+
+      child = fork ();
+      if (child == -1)
+        die_with_error ("Can't fork unprivileged helper");
+
+      if (child == 0)
+        {
+          /* Unprivileged setup process */
+          drop_privs ();
+          close (privsep_sockets[0]);
+          setup_newroot (opt_unshare_pid, privsep_sockets[1]);
+          exit (0);
+        }
+      else
+        {
+          int status;
+          uint32_t buffer[2048];  /* 8k, but is int32 to guarantee nice alignment */
+          uint32_t op, flags;
+          const char *arg1, *arg2;
+          cleanup_fd int unpriv_socket = -1;
+
+          unpriv_socket = privsep_sockets[0];
+          close (privsep_sockets[1]);
+
+          do
+            {
+              op = read_priv_sec_op (unpriv_socket, buffer, sizeof (buffer),
+                                     &flags, &arg1, &arg2);
+              privileged_op (-1, op, flags, arg1, arg2);
+              if (write (unpriv_socket, buffer, 1) != 1)
+                die ("Can't write to op_socket");
+            }
+          while (op != PRIV_SEP_OP_DONE);
+
+          waitpid (child, &status, 0);
+          /* Continue post setup */
+        }
+    }
+  else
+    {
+      setup_newroot (opt_unshare_pid, -1);
+    }
+
+  /* The old root better be rprivate or we will send unmount events to the parent namespace */
+  if (mount ("oldroot", "oldroot", NULL, MS_REC | MS_PRIVATE, NULL) != 0)
+    die_with_error ("Failed to make old root rprivate");
+
+  if (umount2 ("oldroot", MNT_DETACH))
+    die_with_error ("unmount old root");
+
+  if (opt_unshare_user &&
+      (ns_uid != opt_sandbox_uid || ns_gid != opt_sandbox_gid))
+    {
+      /* Now that devpts is mounted and we've no need for mount
+         permissions we can create a new userspace and map our uid
+         1:1 */
+
+      if (unshare (CLONE_NEWUSER))
+        die_with_error ("unshare user ns");
+
+      write_uid_gid_map (opt_sandbox_uid, ns_uid,
+                         opt_sandbox_gid, ns_gid,
+                         -1, FALSE, FALSE);
+    }
+
+  /* Now make /newroot the real root */
+  if (chdir ("/newroot") != 0)
+    die_with_error ("chdir newroot");
+  if (chroot ("/newroot") != 0)
+    die_with_error ("chroot /newroot");
+  if (chdir ("/") != 0)
+    die_with_error ("chdir /");
+
+  /* All privileged ops are done now, so drop it */
+  drop_privs ();
+
+  if (opt_block_fd != -1)
+    {
+      char b[1];
+      read (opt_block_fd, b, 1);
+      close (opt_block_fd);
+    }
+
+  if (opt_seccomp_fd != -1)
+    {
+      seccomp_data = load_file_data (opt_seccomp_fd, &seccomp_len);
+      if (seccomp_data == NULL)
+        die_with_error ("Can't read seccomp data");
+
+      if (seccomp_len % 8 != 0)
+        die ("Invalid seccomp data, must be multiple of 8");
+
+      seccomp_prog.len = seccomp_len / 8;
+      seccomp_prog.filter = (struct sock_filter *) seccomp_data;
+
+      close (opt_seccomp_fd);
+    }
+
+  umask (old_umask);
+
+  new_cwd = "/";
+  if (opt_chdir_path)
+    {
+      if (chdir (opt_chdir_path))
+        die_with_error ("Can't chdir to %s", opt_chdir_path);
+      new_cwd = opt_chdir_path;
+    }
+  else if (chdir (old_cwd) == 0)
+    {
+      /* If the old cwd is mapped in the sandbox, go there */
+      new_cwd = old_cwd;
+    }
+  else
+    {
+      /* If the old cwd is not mapped, go to home */
+      const char *home = getenv ("HOME");
+      if (home != NULL &&
+          chdir (home) == 0)
+        new_cwd = home;
+    }
+  xsetenv ("PWD", new_cwd, 1);
+  free (old_cwd);
+
+  if (opt_new_session &&
+      setsid () == (pid_t) -1)
+    die_with_error ("setsid");
+
+  if (label_exec (opt_exec_label) == -1)
+    die_with_error ("label_exec %s", argv[0]);
+
+  __debug__ (("forking for child\n"));
+
+  if (opt_unshare_pid || lock_files != NULL || opt_sync_fd != -1)
+    {
+      /* We have to have a pid 1 in the pid namespace, because
+       * otherwise we'll get a bunch of zombies as nothing reaps
+       * them. Alternatively if we're using sync_fd or lock_files we
+       * need some process to own these.
+       */
+
+      pid = fork ();
+      if (pid == -1)
+        die_with_error ("Can't fork for pid 1");
+
+      if (pid != 0)
+        {
+          /* Close fds in pid 1, except stdio and optionally event_fd
+             (for syncing pid 2 lifetime with monitor_child) and
+             opt_sync_fd (for syncing sandbox lifetime with outside
+             process).
+             Any other fds will been passed on to the child though. */
+          {
+            int dont_close[3];
+            int j = 0;
+            if (event_fd != -1)
+              dont_close[j++] = event_fd;
+            if (opt_sync_fd != -1)
+              dont_close[j++] = opt_sync_fd;
+            dont_close[j++] = -1;
+            fdwalk (proc_fd, close_extra_fds, dont_close);
+          }
+
+          return do_init (event_fd, pid, seccomp_data != NULL ? &seccomp_prog : NULL);
+        }
+    }
+
+  __debug__ (("launch executable %s\n", argv[0]));
+
+  if (proc_fd != -1)
+    close (proc_fd);
+
+  if (opt_sync_fd != -1)
+    close (opt_sync_fd);
+
+  /* We want sigchild in the child */
+  unblock_sigchild ();
+
+  /* Optionally bind our lifecycle */
+  handle_die_with_parent ();
+
+  /* Should be the last thing before execve() so that filters don't
+   * need to handle anything above */
+  if (seccomp_data != NULL &&
+      prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &seccomp_prog) != 0)
+    die_with_error ("prctl(PR_SET_SECCOMP)");
+
+  if (execvp (argv[0], argv) == -1)
+    die_with_error ("execvp %s", argv[0]);
+
+  return 0;
+}
diff --git a/bubblewrap/network.c b/bubblewrap/network.c
new file mode 100644 (file)
index 0000000..208f4eb
--- /dev/null
@@ -0,0 +1,198 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "config.h"
+
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <linux/loop.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+#include "utils.h"
+#include "network.h"
+
+static void *
+add_rta (struct nlmsghdr *header,
+         int              type,
+         size_t           size)
+{
+  struct rtattr *rta;
+  size_t rta_size = RTA_LENGTH (size);
+
+  rta = (struct rtattr *) ((char *) header + NLMSG_ALIGN (header->nlmsg_len));
+  rta->rta_type = type;
+  rta->rta_len = rta_size;
+
+  header->nlmsg_len = NLMSG_ALIGN (header->nlmsg_len) + rta_size;
+
+  return RTA_DATA (rta);
+}
+
+static int
+rtnl_send_request (int              rtnl_fd,
+                   struct nlmsghdr *header)
+{
+  struct sockaddr_nl dst_addr = { AF_NETLINK, 0 };
+  ssize_t sent;
+
+  sent = sendto (rtnl_fd, (void *) header, header->nlmsg_len, 0,
+                 (struct sockaddr *) &dst_addr, sizeof (dst_addr));
+  if (sent < 0)
+    return -1;
+
+  return 0;
+}
+
+static int
+rtnl_read_reply (int rtnl_fd,
+                 int seq_nr)
+{
+  char buffer[1024];
+  ssize_t received;
+  struct nlmsghdr *rheader;
+
+  while (1)
+    {
+      received = recv (rtnl_fd, buffer, sizeof (buffer), 0);
+      if (received < 0)
+        return -1;
+
+      rheader = (struct nlmsghdr *) buffer;
+      while (received >= NLMSG_HDRLEN)
+        {
+          if (rheader->nlmsg_seq != seq_nr)
+            return -1;
+          if (rheader->nlmsg_pid != getpid ())
+            return -1;
+          if (rheader->nlmsg_type == NLMSG_ERROR)
+            {
+              uint32_t *err = NLMSG_DATA (rheader);
+              if (*err == 0)
+                return 0;
+
+              return -1;
+            }
+          if (rheader->nlmsg_type == NLMSG_DONE)
+            return 0;
+
+          rheader = NLMSG_NEXT (rheader, received);
+        }
+    }
+}
+
+static int
+rtnl_do_request (int              rtnl_fd,
+                 struct nlmsghdr *header)
+{
+  if (rtnl_send_request (rtnl_fd, header) != 0)
+    return -1;
+
+  if (rtnl_read_reply (rtnl_fd, header->nlmsg_seq) != 0)
+    return -1;
+
+  return 0;
+}
+
+static struct nlmsghdr *
+rtnl_setup_request (char  *buffer,
+                    int    type,
+                    int    flags,
+                    size_t size)
+{
+  struct nlmsghdr *header;
+  size_t len = NLMSG_LENGTH (size);
+  static uint32_t counter = 0;
+
+  memset (buffer, 0, len);
+
+  header = (struct nlmsghdr *) buffer;
+  header->nlmsg_len = len;
+  header->nlmsg_type = type;
+  header->nlmsg_flags = flags | NLM_F_REQUEST;
+  header->nlmsg_seq = counter++;
+  header->nlmsg_pid = getpid ();
+
+  return (struct nlmsghdr *) header;
+}
+
+void
+loopback_setup (void)
+{
+  int r, if_loopback;
+  cleanup_fd int rtnl_fd = -1;
+  char buffer[1024];
+  struct sockaddr_nl src_addr = { AF_NETLINK, 0 };
+  struct nlmsghdr *header;
+  struct ifaddrmsg *addmsg;
+  struct ifinfomsg *infomsg;
+  struct in_addr *ip_addr;
+
+  src_addr.nl_pid = getpid ();
+
+  if_loopback = (int) if_nametoindex ("lo");
+  if (if_loopback <= 0)
+    die_with_error ("loopback: Failed to look up lo");
+
+  rtnl_fd = socket (PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
+  if (rtnl_fd < 0)
+    die_with_error ("loopback: Failed to create NETLINK_ROUTE socket");
+
+  r = bind (rtnl_fd, (struct sockaddr *) &src_addr, sizeof (src_addr));
+  if (r < 0)
+    die_with_error ("loopback: Failed to bind NETLINK_ROUTE socket");
+
+  header = rtnl_setup_request (buffer, RTM_NEWADDR,
+                               NLM_F_CREATE | NLM_F_EXCL | NLM_F_ACK,
+                               sizeof (struct ifaddrmsg));
+  addmsg = NLMSG_DATA (header);
+
+  addmsg->ifa_family = AF_INET;
+  addmsg->ifa_prefixlen = 8;
+  addmsg->ifa_flags = IFA_F_PERMANENT;
+  addmsg->ifa_scope = RT_SCOPE_HOST;
+  addmsg->ifa_index = if_loopback;
+
+  ip_addr = add_rta (header, IFA_LOCAL, sizeof (*ip_addr));
+  ip_addr->s_addr = htonl (INADDR_LOOPBACK);
+
+  ip_addr = add_rta (header, IFA_ADDRESS, sizeof (*ip_addr));
+  ip_addr->s_addr = htonl (INADDR_LOOPBACK);
+
+  assert (header->nlmsg_len < sizeof (buffer));
+
+  if (rtnl_do_request (rtnl_fd, header) != 0)
+    die_with_error ("loopback: Failed RTM_NEWADDR");
+
+  header = rtnl_setup_request (buffer, RTM_NEWLINK,
+                               NLM_F_ACK,
+                               sizeof (struct ifinfomsg));
+  infomsg = NLMSG_DATA (header);
+
+  infomsg->ifi_family = AF_UNSPEC;
+  infomsg->ifi_type = 0;
+  infomsg->ifi_index = if_loopback;
+  infomsg->ifi_flags = IFF_UP;
+  infomsg->ifi_change = IFF_UP;
+
+  assert (header->nlmsg_len < sizeof (buffer));
+
+  if (rtnl_do_request (rtnl_fd, header) != 0)
+    die_with_error ("loopback: Failed RTM_NEWLINK");
+}
diff --git a/bubblewrap/network.h b/bubblewrap/network.h
new file mode 100644 (file)
index 0000000..e5f4c76
--- /dev/null
@@ -0,0 +1,21 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+void loopback_setup (void);
diff --git a/bubblewrap/utils.c b/bubblewrap/utils.c
new file mode 100644 (file)
index 0000000..7a417db
--- /dev/null
@@ -0,0 +1,709 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "config.h"
+
+#include "utils.h"
+#include <sys/syscall.h>
+#ifdef HAVE_SELINUX
+#include <selinux/selinux.h>
+#endif
+
+void
+die_with_error (const char *format, ...)
+{
+  va_list args;
+  int errsv;
+
+  errsv = errno;
+
+  va_start (args, format);
+  vfprintf (stderr, format, args);
+  va_end (args);
+
+  fprintf (stderr, ": %s\n", strerror (errsv));
+
+  exit (1);
+}
+
+void
+die (const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  vfprintf (stderr, format, args);
+  va_end (args);
+
+  fprintf (stderr, "\n");
+
+  exit (1);
+}
+
+void
+die_unless_label_valid (const char *label)
+{
+#ifdef HAVE_SELINUX
+  if (is_selinux_enabled () == 1)
+    {
+      if (security_check_context ((security_context_t) label) < 0)
+        die_with_error ("invalid label %s", label);
+      return;
+    }
+#endif
+  die ("labeling not supported on this system");
+}
+
+void
+die_oom (void)
+{
+  puts ("Out of memory");
+  exit (1);
+}
+
+void *
+xmalloc (size_t size)
+{
+  void *res = malloc (size);
+
+  if (res == NULL)
+    die_oom ();
+  return res;
+}
+
+void *
+xcalloc (size_t size)
+{
+  void *res = calloc (1, size);
+
+  if (res == NULL)
+    die_oom ();
+  return res;
+}
+
+void *
+xrealloc (void *ptr, size_t size)
+{
+  void *res = realloc (ptr, size);
+
+  if (size != 0 && res == NULL)
+    die_oom ();
+  return res;
+}
+
+char *
+xstrdup (const char *str)
+{
+  char *res;
+
+  assert (str != NULL);
+
+  res = strdup (str);
+  if (res == NULL)
+    die_oom ();
+
+  return res;
+}
+
+void
+strfreev (char **str_array)
+{
+  if (str_array)
+    {
+      int i;
+
+      for (i = 0; str_array[i] != NULL; i++)
+        free (str_array[i]);
+
+      free (str_array);
+    }
+}
+
+/* Compares if str has a specific path prefix. This differs
+   from a regular prefix in two ways. First of all there may
+   be multiple slashes separating the path elements, and
+   secondly, if a prefix is matched that has to be en entire
+   path element. For instance /a/prefix matches /a/prefix/foo/bar,
+   but not /a/prefixfoo/bar. */
+bool
+has_path_prefix (const char *str,
+                 const char *prefix)
+{
+  while (TRUE)
+    {
+      /* Skip consecutive slashes to reach next path
+         element */
+      while (*str == '/')
+        str++;
+      while (*prefix == '/')
+        prefix++;
+
+      /* No more prefix path elements? Done! */
+      if (*prefix == 0)
+        return TRUE;
+
+      /* Compare path element */
+      while (*prefix != 0 && *prefix != '/')
+        {
+          if (*str != *prefix)
+            return FALSE;
+          str++;
+          prefix++;
+        }
+
+      /* Matched prefix path element,
+         must be entire str path element */
+      if (*str != '/' && *str != 0)
+        return FALSE;
+    }
+}
+
+bool
+path_equal (const char *path1,
+            const char *path2)
+{
+  while (TRUE)
+    {
+      /* Skip consecutive slashes to reach next path
+         element */
+      while (*path1 == '/')
+        path1++;
+      while (*path2 == '/')
+        path2++;
+
+      /* No more prefix path elements? Done! */
+      if (*path1 == 0 || *path2 == 0)
+        return *path1 == 0 && *path2 == 0;
+
+      /* Compare path element */
+      while (*path1 != 0 && *path1 != '/')
+        {
+          if (*path1 != *path2)
+            return FALSE;
+          path1++;
+          path2++;
+        }
+
+      /* Matched path1 path element, must be entire path element */
+      if (*path2 != '/' && *path2 != 0)
+        return FALSE;
+    }
+}
+
+
+bool
+has_prefix (const char *str,
+            const char *prefix)
+{
+  return strncmp (str, prefix, strlen (prefix)) == 0;
+}
+
+void
+xsetenv (const char *name, const char *value, int overwrite)
+{
+  if (setenv (name, value, overwrite))
+    die ("setenv failed");
+}
+
+void
+xunsetenv (const char *name)
+{
+  if (unsetenv (name))
+    die ("unsetenv failed");
+}
+
+char *
+strconcat (const char *s1,
+           const char *s2)
+{
+  size_t len = 0;
+  char *res;
+
+  if (s1)
+    len += strlen (s1);
+  if (s2)
+    len += strlen (s2);
+
+  res = xmalloc (len + 1);
+  *res = 0;
+  if (s1)
+    strcat (res, s1);
+  if (s2)
+    strcat (res, s2);
+
+  return res;
+}
+
+char *
+strconcat3 (const char *s1,
+            const char *s2,
+            const char *s3)
+{
+  size_t len = 0;
+  char *res;
+
+  if (s1)
+    len += strlen (s1);
+  if (s2)
+    len += strlen (s2);
+  if (s3)
+    len += strlen (s3);
+
+  res = xmalloc (len + 1);
+  *res = 0;
+  if (s1)
+    strcat (res, s1);
+  if (s2)
+    strcat (res, s2);
+  if (s3)
+    strcat (res, s3);
+
+  return res;
+}
+
+char *
+xasprintf (const char *format,
+           ...)
+{
+  char *buffer = NULL;
+  va_list args;
+
+  va_start (args, format);
+  if (vasprintf (&buffer, format, args) == -1)
+    die_oom ();
+  va_end (args);
+
+  return buffer;
+}
+
+int
+fdwalk (int proc_fd, int (*cb)(void *data,
+                               int   fd), void *data)
+{
+  int open_max;
+  int fd;
+  int dfd;
+  int res = 0;
+  DIR *d;
+
+  dfd = openat (proc_fd, "self/fd", O_DIRECTORY | O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOCTTY);
+  if (dfd == -1)
+    return res;
+
+  if ((d = fdopendir (dfd)))
+    {
+      struct dirent *de;
+
+      while ((de = readdir (d)))
+        {
+          long l;
+          char *e = NULL;
+
+          if (de->d_name[0] == '.')
+            continue;
+
+          errno = 0;
+          l = strtol (de->d_name, &e, 10);
+          if (errno != 0 || !e || *e)
+            continue;
+
+          fd = (int) l;
+
+          if ((long) fd != l)
+            continue;
+
+          if (fd == dirfd (d))
+            continue;
+
+          if ((res = cb (data, fd)) != 0)
+            break;
+        }
+
+      closedir (d);
+      return res;
+    }
+
+  open_max = sysconf (_SC_OPEN_MAX);
+
+  for (fd = 0; fd < open_max; fd++)
+    if ((res = cb (data, fd)) != 0)
+      break;
+
+  return res;
+}
+
+/* Sets errno on error (!= 0), ENOSPC on short write */
+int
+write_to_fd (int         fd,
+             const char *content,
+             ssize_t     len)
+{
+  ssize_t res;
+
+  while (len > 0)
+    {
+      res = write (fd, content, len);
+      if (res < 0 && errno == EINTR)
+        continue;
+      if (res <= 0)
+        {
+          if (res == 0) /* Unexpected short write, should not happen when writing to a file */
+            errno = ENOSPC;
+          return -1;
+        }
+      len -= res;
+      content += res;
+    }
+
+  return 0;
+}
+
+/* Sets errno on error (!= 0), ENOSPC on short write */
+int
+write_file_at (int         dirfd,
+               const char *path,
+               const char *content)
+{
+  int fd;
+  bool res;
+  int errsv;
+
+  fd = openat (dirfd, path, O_RDWR | O_CLOEXEC, 0);
+  if (fd == -1)
+    return -1;
+
+  res = 0;
+  if (content)
+    res = write_to_fd (fd, content, strlen (content));
+
+  errsv = errno;
+  close (fd);
+  errno = errsv;
+
+  return res;
+}
+
+/* Sets errno on error (!= 0), ENOSPC on short write */
+int
+create_file (const char *path,
+             mode_t      mode,
+             const char *content)
+{
+  int fd;
+  int res;
+  int errsv;
+
+  fd = creat (path, mode);
+  if (fd == -1)
+    return -1;
+
+  res = 0;
+  if (content)
+    res = write_to_fd (fd, content, strlen (content));
+
+  errsv = errno;
+  close (fd);
+  errno = errsv;
+
+  return res;
+}
+
+int
+ensure_file (const char *path,
+             mode_t      mode)
+{
+  struct stat buf;
+
+  /* We check this ahead of time, otherwise
+     the create file will fail in the read-only
+     case with EROFD instead of EEXIST */
+  if (stat (path, &buf) ==  0 &&
+      S_ISREG (buf.st_mode))
+    return 0;
+
+  if (create_file (path, mode, NULL) != 0 &&  errno != EEXIST)
+    return -1;
+
+  return 0;
+}
+
+
+#define BUFSIZE 8192
+/* Sets errno on error (!= 0), ENOSPC on short write */
+int
+copy_file_data (int sfd,
+                int dfd)
+{
+  char buffer[BUFSIZE];
+  ssize_t bytes_read;
+
+  while (TRUE)
+    {
+      bytes_read = read (sfd, buffer, BUFSIZE);
+      if (bytes_read == -1)
+        {
+          if (errno == EINTR)
+            continue;
+
+          return -1;
+        }
+
+      if (bytes_read == 0)
+        break;
+
+      if (write_to_fd (dfd, buffer, bytes_read) != 0)
+        return -1;
+    }
+
+  return 0;
+}
+
+/* Sets errno on error (!= 0), ENOSPC on short write */
+int
+copy_file (const char *src_path,
+           const char *dst_path,
+           mode_t      mode)
+{
+  int sfd;
+  int dfd;
+  int res;
+  int errsv;
+
+  sfd = open (src_path, O_CLOEXEC | O_RDONLY);
+  if (sfd == -1)
+    return -1;
+
+  dfd = creat (dst_path, mode);
+  if (dfd == -1)
+    {
+      errsv = errno;
+      close (sfd);
+      errno = errsv;
+      return -1;
+    }
+
+  res = copy_file_data (sfd, dfd);
+
+  errsv = errno;
+  close (sfd);
+  close (dfd);
+  errno = errsv;
+
+  return res;
+}
+
+/* Sets errno on error (== NULL),
+ * Always ensures terminating zero */
+char *
+load_file_data (int     fd,
+                size_t *size)
+{
+  cleanup_free char *data = NULL;
+  ssize_t data_read;
+  ssize_t data_len;
+  ssize_t res;
+  int errsv;
+
+  data_read = 0;
+  data_len = 4080;
+  data = xmalloc (data_len);
+
+  do
+    {
+      if (data_len == data_read + 1)
+        {
+          data_len *= 2;
+          data = xrealloc (data, data_len);
+        }
+
+      do
+        res = read (fd, data + data_read, data_len - data_read - 1);
+      while (res < 0 && errno == EINTR);
+
+      if (res < 0)
+        {
+          errsv = errno;
+          close (fd);
+          errno = errsv;
+          return NULL;
+        }
+
+      data_read += res;
+    }
+  while (res > 0);
+
+  data[data_read] = 0;
+
+  if (size)
+    *size = (size_t) data_read;
+
+  return steal_pointer (&data);
+}
+
+/* Sets errno on error (== NULL),
+ * Always ensures terminating zero */
+char *
+load_file_at (int         dirfd,
+              const char *path)
+{
+  int fd;
+  char *data;
+  int errsv;
+
+  fd = openat (dirfd, path, O_CLOEXEC | O_RDONLY);
+  if (fd == -1)
+    return NULL;
+
+  data = load_file_data (fd, NULL);
+
+  errsv = errno;
+  close (fd);
+  errno = errsv;
+
+  return data;
+}
+
+/* Sets errno on error (< 0) */
+int
+get_file_mode (const char *pathname)
+{
+  struct stat buf;
+
+  if (stat (pathname, &buf) !=  0)
+    return -1;
+
+  return buf.st_mode & S_IFMT;
+}
+
+/* Sets errno on error (!= 0) */
+int
+mkdir_with_parents (const char *pathname,
+                    int         mode,
+                    bool        create_last)
+{
+  cleanup_free char *fn = NULL;
+  char *p;
+  struct stat buf;
+
+  if (pathname == NULL || *pathname == '\0')
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  fn = xstrdup (pathname);
+
+  p = fn;
+  while (*p == '/')
+    p++;
+
+  do
+    {
+      while (*p && *p != '/')
+        p++;
+
+      if (!*p)
+        p = NULL;
+      else
+        *p = '\0';
+
+      if (!create_last && p == NULL)
+        break;
+
+      if (stat (fn, &buf) !=  0)
+        {
+          if (mkdir (fn, mode) == -1 && errno != EEXIST)
+            return -1;
+        }
+      else if (!S_ISDIR (buf.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+
+      if (p)
+        {
+          *p++ = '/';
+          while (*p && *p == '/')
+            p++;
+        }
+    }
+  while (p);
+
+  return 0;
+}
+
+int
+raw_clone (unsigned long flags,
+           void         *child_stack)
+{
+#if defined(__s390__) || defined(__CRIS__)
+  /* On s390 and cris the order of the first and second arguments
+   * of the raw clone() system call is reversed. */
+  return (int) syscall (__NR_clone, child_stack, flags);
+#else
+  return (int) syscall (__NR_clone, flags, child_stack);
+#endif
+}
+
+int
+pivot_root (const char * new_root, const char * put_old)
+{
+#ifdef __NR_pivot_root
+  return syscall (__NR_pivot_root, new_root, put_old);
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
+}
+
+char *
+label_mount (const char *opt, const char *mount_label)
+{
+#ifdef HAVE_SELINUX
+  if (mount_label)
+    {
+      if (opt)
+        return xasprintf ("%s,context=\"%s\"", opt, mount_label);
+      else
+        return xasprintf ("context=\"%s\"", mount_label);
+    }
+#endif
+  if (opt)
+    return xstrdup (opt);
+  return NULL;
+}
+
+int
+label_create_file (const char *file_label)
+{
+#ifdef HAVE_SELINUX
+  if (is_selinux_enabled () > 0 && file_label)
+    return setfscreatecon ((security_context_t) file_label);
+#endif
+  return 0;
+}
+
+int
+label_exec (const char *exec_label)
+{
+#ifdef HAVE_SELINUX
+  if (is_selinux_enabled () > 0 && exec_label)
+    return setexeccon ((security_context_t) exec_label);
+#endif
+  return 0;
+}
diff --git a/bubblewrap/utils.h b/bubblewrap/utils.h
new file mode 100644 (file)
index 0000000..c0b98bb
--- /dev/null
@@ -0,0 +1,166 @@
+/* bubblewrap
+ * Copyright (C) 2016 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if 0
+#define __debug__(x) printf x
+#else
+#define __debug__(x)
+#endif
+
+#define UNUSED __attribute__((__unused__))
+
+#define N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
+#define TRUE 1
+#define FALSE 0
+typedef int bool;
+
+#define PIPE_READ_END 0
+#define PIPE_WRITE_END 1
+
+void  die_with_error (const char *format,
+                      ...) __attribute__((__noreturn__)) __attribute__((format (printf, 1, 2)));
+void  die (const char *format,
+           ...) __attribute__((__noreturn__)) __attribute__((format (printf, 1, 2)));
+void  die_oom (void) __attribute__((__noreturn__));
+void  die_unless_label_valid (const char *label);
+
+void *xmalloc (size_t size);
+void *xcalloc (size_t size);
+void *xrealloc (void  *ptr,
+                size_t size);
+char *xstrdup (const char *str);
+void  strfreev (char **str_array);
+void  xsetenv (const char *name,
+               const char *value,
+               int         overwrite);
+void  xunsetenv (const char *name);
+char *strconcat (const char *s1,
+                 const char *s2);
+char *strconcat3 (const char *s1,
+                  const char *s2,
+                  const char *s3);
+char * xasprintf (const char *format,
+                  ...) __attribute__((format (printf, 1, 2)));
+bool  has_prefix (const char *str,
+                  const char *prefix);
+bool  has_path_prefix (const char *str,
+                       const char *prefix);
+bool  path_equal (const char *path1,
+                  const char *path2);
+int   fdwalk (int                     proc_fd,
+              int                     (*cb)(void *data,
+                                  int fd),
+              void                   *data);
+char *load_file_data (int     fd,
+                      size_t *size);
+char *load_file_at (int         dirfd,
+                    const char *path);
+int   write_file_at (int         dirfd,
+                     const char *path,
+                     const char *content);
+int   write_to_fd (int         fd,
+                   const char *content,
+                   ssize_t     len);
+int   copy_file_data (int sfd,
+                      int dfd);
+int   copy_file (const char *src_path,
+                 const char *dst_path,
+                 mode_t      mode);
+int   create_file (const char *path,
+                   mode_t      mode,
+                   const char *content);
+int   ensure_file (const char *path,
+                   mode_t      mode);
+int   get_file_mode (const char *pathname);
+int   mkdir_with_parents (const char *pathname,
+                          int         mode,
+                          bool        create_last);
+
+/* syscall wrappers */
+int   raw_clone (unsigned long flags,
+                 void         *child_stack);
+int   pivot_root (const char *new_root,
+                  const char *put_old);
+char *label_mount (const char *opt,
+                   const char *mount_label);
+int   label_exec (const char *exec_label);
+int   label_create_file (const char *file_label);
+
+static inline void
+cleanup_freep (void *p)
+{
+  void **pp = (void **) p;
+
+  if (*pp)
+    free (*pp);
+}
+
+static inline void
+cleanup_strvp (void *p)
+{
+  void **pp = (void **) p;
+
+  strfreev (*pp);
+}
+
+static inline void
+cleanup_fdp (int *fdp)
+{
+  int fd;
+
+  assert (fdp);
+
+  fd = *fdp;
+  if (fd != -1)
+    (void) close (fd);
+}
+
+#define cleanup_free __attribute__((cleanup (cleanup_freep)))
+#define cleanup_fd __attribute__((cleanup (cleanup_fdp)))
+#define cleanup_strv __attribute__((cleanup (cleanup_strvp)))
+
+static inline void *
+steal_pointer (void *pp)
+{
+  void **ptr = (void **) pp;
+  void *ref;
+
+  ref = *ptr;
+  *ptr = NULL;
+
+  return ref;
+}
+
+/* type safety */
+#define steal_pointer(pp) \
+  (0 ? (*(pp)) : (steal_pointer) (pp))
diff --git a/buildutil/glib-tap.mk b/buildutil/glib-tap.mk
new file mode 100644 (file)
index 0000000..99f7b2f
--- /dev/null
@@ -0,0 +1,128 @@
+# GLIB - Library of useful C routines
+
+TESTS_ENVIRONMENT= \
+       G_TEST_SRCDIR="$(abs_srcdir)/tests"     \
+       G_TEST_BUILDDIR="$(abs_builddir)/tests" \
+       UNINSTALLEDTESTS=1                      \
+       G_DEBUG=gc-friendly                     \
+       MALLOC_CHECK_=2                         \
+       MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/buildutil/tap-driver.sh
+LOG_COMPILER = $(top_srcdir)/buildutil/tap-test
+
+TESTS =
+
+installed_test_LTLIBRARIES =
+installed_test_PROGRAMS =
+installed_test_SCRIPTS =
+installed_test_DATA =
+nobase_installed_test_DATA =
+
+noinst_SCRIPTS =
+noinst_DATA =
+
+check_LTLIBRARIES =
+check_PROGRAMS =
+check_SCRIPTS =
+check_DATA =
+
+EXTRA_DIST += buildutil/tap-driver.sh buildutil/tap-test
+
+# We support a fairly large range of possible variables.  It is expected that all types of files in a test suite
+# will belong in exactly one of the following variables.
+#
+# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
+#
+#   test_programs, test_scripts, test_data, test_ltlibraries
+#
+# The above are used to list files that are involved in both uninstalled and installed testing.  The
+# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
+# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
+# installed in the same way as it appears in the package layout.
+#
+# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
+# like so:
+#
+#   installed_test_programs, uninstalled_test_programs
+#   installed_test_scripts, uninstalled_test_scripts
+#   installed_test_data, uninstalled_test_data
+#   installed_test_ltlibraries, uninstalled_test_ltlibraries
+#
+# Additionally, we support 'extra' infixes for programs and scripts.  This is used for support programs/scripts
+# that should not themselves be run as testcases (but exist to be used from other testcases):
+#
+#   test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
+#   test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
+#
+# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
+# file automatically end up in the tarball.
+#
+#   dist_test_scripts, dist_test_data, dist_test_extra_scripts
+#   dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
+#   dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
+#
+# Note that no file is automatically dist-ed unless it appears in one of the dist_ variables.  This follows the
+# standard automake convention of not dist-ing programs scripts or data by default.
+#
+# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their dist-ed
+# variants) will be run as part of the in-tree 'make check'.  These are all assumed to be runnable under
+# gtester.  That's a bit strange for scripts, but it's possible.
+
+TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
+         $(dist_test_scripts) $(dist_uninstalled_test_scripts)
+
+# Note: build even the installed-only targets during 'make check' to ensure that they still work.
+# We need to do a bit of trickery here and manage dist-ing via EXTRA_DIST instead of using dist_ prefixes to
+# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
+# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
+all_test_programs     = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
+                        $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
+all_test_scripts      = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
+                        $(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
+all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
+                        $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
+all_test_scripts     += $(all_dist_test_scripts)
+EXTRA_DIST           += $(all_dist_test_scripts)
+all_test_data         = $(test_data) $(uninstalled_test_data) $(installed_test_data)
+all_dist_test_data    = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
+all_test_data        += $(all_dist_test_data)
+EXTRA_DIST           += $(all_dist_test_data)
+all_test_ltlibs       = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
+
+if ENABLE_ALWAYS_BUILD_TESTS
+noinst_LTLIBRARIES += $(all_test_ltlibs)
+noinst_PROGRAMS += $(all_test_programs)
+noinst_SCRIPTS += $(all_test_scripts)
+noinst_DATA += $(all_test_data)
+else
+check_LTLIBRARIES += $(all_test_ltlibs)
+check_PROGRAMS += $(all_test_programs)
+check_SCRIPTS += $(all_test_scripts)
+check_DATA += $(all_test_data)
+endif
+
+if ENABLE_INSTALLED_TESTS
+installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \
+                          $(test_extra_programs) $(installed_test_extra_programs)
+installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \
+                          $(test_extra_scripts) $(test_installed_extra_scripts)
+installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \
+                          $(dist_installed_test_scripts) $(dist_installed_test_extra_scripts)
+installed_test_DATA += $(test_data) $(installed_test_data)
+installed_test_DATA += $(dist_test_data) $(dist_installed_test_data)
+installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries)
+installed_testcases = $(test_programs) $(installed_test_programs) \
+                      $(test_scripts) $(installed_test_scripts) \
+                      $(dist_test_scripts) $(dist_installed_test_scripts)
+
+installed_test_meta_DATA = $(installed_testcases:=.test)
+
+%.test: %$(EXEEXT) Makefile
+       $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
+       echo 'Type=session' >> $@.tmp; \
+       echo 'Exec=env G_TEST_SRCDIR=$(installed_testdir) G_TEST_BUILDDIR=$(installed_testdir)  $(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
+       echo 'Output=TAP' >> $@.tmp; \
+       mv $@.tmp $@)
+
+CLEANFILES += $(installed_test_meta_DATA)
+endif
diff --git a/buildutil/tap-driver.sh b/buildutil/tap-driver.sh
new file mode 100755 (executable)
index 0000000..ea060f8
--- /dev/null
@@ -0,0 +1,652 @@
+#! /bin/sh
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+scriptversion=2011-12-27.17; # UTC
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+me=tap-driver.sh
+
+fatal ()
+{
+  echo "$me: fatal: $*" >&2
+  exit 1
+}
+
+usage_error ()
+{
+  echo "$me: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
+                [--expect-failure={yes|no}] [--color-tests={yes|no}]
+                [--enable-hard-errors={yes|no}] [--ignore-exit]
+                [--diagnostic-string=STRING] [--merge|--no-merge]
+                [--comments|--no-comments] [--] TEST-COMMAND
+The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file=  # Where to save the result and output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=0
+color_tests=0
+merge=0
+ignore_exit=0
+comments=0
+diag_string='#'
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "$me $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) shift;; # No-op.
+  --merge) merge=1;;
+  --no-merge) merge=0;;
+  --ignore-exit) ignore_exit=1;;
+  --comments) comments=1;;
+  --no-comments) comments=0;;
+  --diagnostic-string) diag_string=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+  esac
+  shift
+done
+
+test $# -gt 0 || usage_error "missing test command"
+
+case $expect_failure in
+  yes) expect_failure=1;;
+    *) expect_failure=0;;
+esac
+
+if test $color_tests = yes; then
+  init_colors='
+    color_map["red"]="\e[0;31m" # Red.
+    color_map["grn"]="\e[0;32m" # Green.
+    color_map["lgn"]="\e[1;32m" # Light green.
+    color_map["blu"]="\e[1;34m" # Blue.
+    color_map["mgn"]="\e[0;35m" # Magenta.
+    color_map["std"]="\e[m"     # No color.
+    color_for_result["ERROR"] = "mgn"
+    color_for_result["PASS"]  = "grn"
+    color_for_result["XPASS"] = "red"
+    color_for_result["FAIL"]  = "red"
+    color_for_result["XFAIL"] = "lgn"
+    color_for_result["SKIP"]  = "blu"'
+else
+  init_colors=''
+fi
+
+# :; is there to work around a bug in bash 3.2 (and earlier) which
+# does not always set '$?' properly on redirection failure.
+# See the Autoconf manual for more details.
+:;{
+  (
+    # Ignore common signals (in this subshell only!), to avoid potential
+    # problems with Korn shells.  Some Korn shells are known to propagate
+    # to themselves signals that have killed a child process they were
+    # waiting for; this is done at least for SIGINT (and usually only for
+    # it, in truth).  Without the `trap' below, such a behaviour could
+    # cause a premature exit in the current subshell, e.g., in case the
+    # test command it runs gets terminated by a SIGINT.  Thus, the awk
+    # script we are piping into would never seen the exit status it
+    # expects on its last input line (which is displayed below by the
+    # last `echo $?' statement), and would thus die reporting an internal
+    # error.
+    # For more information, see the Autoconf manual and the threads:
+    # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
+    # <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
+    trap : 1 3 2 13 15
+    if test $merge -gt 0; then
+      exec 2>&1
+    else
+      exec 2>&3
+    fi
+    "$@"
+    echo $?
+  ) | LC_ALL=C ${AM_TAP_AWK-awk} \
+        -v me="$me" \
+        -v test_script_name="$test_name" \
+        -v log_file="$log_file" \
+        -v trs_file="$trs_file" \
+        -v expect_failure="$expect_failure" \
+        -v merge="$merge" \
+        -v ignore_exit="$ignore_exit" \
+        -v comments="$comments" \
+        -v diag_string="$diag_string" \
+'
+# FIXME: the usages of "cat >&3" below could be optimized when using
+# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
+
+# Implementation note: in what follows, `result_obj` will be an
+# associative array that (partly) simulates a TAP result object
+# from the `TAP::Parser` perl module.
+
+## ----------- ##
+##  FUNCTIONS  ##
+## ----------- ##
+
+function fatal(msg)
+{
+  print me ": " msg | "cat >&2"
+  exit 1
+}
+
+function abort(where)
+{
+  fatal("internal error " where)
+}
+
+# Convert a boolean to a "yes"/"no" string.
+function yn(bool)
+{
+  return bool ? "yes" : "no";
+}
+
+function add_test_result(result)
+{
+  if (!test_results_index)
+    test_results_index = 0
+  test_results_list[test_results_index] = result
+  test_results_index += 1
+  test_results_seen[result] = 1;
+}
+
+# Whether the test script should be re-run by "make recheck".
+function must_recheck()
+{
+  for (k in test_results_seen)
+    if (k != "XFAIL" && k != "PASS" && k != "SKIP")
+      return 1
+  return 0
+}
+
+# Whether the content of the log file associated to this test should
+# be copied into the "global" test-suite.log.
+function copy_in_global_log()
+{
+  for (k in test_results_seen)
+    if (k != "PASS")
+      return 1
+  return 0
+}
+
+# FIXME: this can certainly be improved ...
+function get_global_test_result()
+{
+    if ("ERROR" in test_results_seen)
+      return "ERROR"
+    if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
+      return "FAIL"
+    all_skipped = 1
+    for (k in test_results_seen)
+      if (k != "SKIP")
+        all_skipped = 0
+    if (all_skipped)
+      return "SKIP"
+    return "PASS";
+}
+
+function stringify_result_obj(result_obj)
+{
+  if (result_obj["is_unplanned"] || result_obj["number"] != testno)
+    return "ERROR"
+
+  if (plan_seen == LATE_PLAN)
+    return "ERROR"
+
+  if (result_obj["directive"] == "TODO")
+    return result_obj["is_ok"] ? "XPASS" : "XFAIL"
+
+  if (result_obj["directive"] == "SKIP")
+    return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
+
+  if (length(result_obj["directive"]))
+      abort("in function stringify_result_obj()")
+
+  return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
+}
+
+function decorate_result(result)
+{
+  color_name = color_for_result[result]
+  if (color_name)
+    return color_map[color_name] "" result "" color_map["std"]
+  # If we are not using colorized output, or if we do not know how
+  # to colorize the given result, we should return it unchanged.
+  return result
+}
+
+function report(result, details)
+{
+  if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
+    {
+      msg = ": " test_script_name
+      add_test_result(result)
+    }
+  else if (result == "#")
+    {
+      msg = " " test_script_name ":"
+    }
+  else
+    {
+      abort("in function report()")
+    }
+  if (length(details))
+    msg = msg " " details
+  # Output on console might be colorized.
+  print decorate_result(result) msg
+  # Log the result in the log file too, to help debugging (this is
+  # especially true when said result is a TAP error or "Bail out!").
+  print result msg | "cat >&3";
+}
+
+function testsuite_error(error_message)
+{
+  report("ERROR", "- " error_message)
+}
+
+function handle_tap_result()
+{
+  details = result_obj["number"];
+  if (length(result_obj["description"]))
+    details = details " " result_obj["description"]
+
+  if (plan_seen == LATE_PLAN)
+    {
+      details = details " # AFTER LATE PLAN";
+    }
+  else if (result_obj["is_unplanned"])
+    {
+       details = details " # UNPLANNED";
+    }
+  else if (result_obj["number"] != testno)
+    {
+       details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
+                         details, testno);
+    }
+  else if (result_obj["directive"])
+    {
+      details = details " # " result_obj["directive"];
+      if (length(result_obj["explanation"]))
+        details = details " " result_obj["explanation"]
+    }
+
+  report(stringify_result_obj(result_obj), details)
+}
+
+# `skip_reason` should be empty whenever planned > 0.
+function handle_tap_plan(planned, skip_reason)
+{
+  planned += 0 # Avoid getting confused if, say, `planned` is "00"
+  if (length(skip_reason) && planned > 0)
+    abort("in function handle_tap_plan()")
+  if (plan_seen)
+    {
+      # Error, only one plan per stream is acceptable.
+      testsuite_error("multiple test plans")
+      return;
+    }
+  planned_tests = planned
+  # The TAP plan can come before or after *all* the TAP results; we speak
+  # respectively of an "early" or a "late" plan.  If we see the plan line
+  # after at least one TAP result has been seen, assume we have a late
+  # plan; in this case, any further test result seen after the plan will
+  # be flagged as an error.
+  plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
+  # If testno > 0, we have an error ("too many tests run") that will be
+  # automatically dealt with later, so do not worry about it here.  If
+  # $plan_seen is true, we have an error due to a repeated plan, and that
+  # has already been dealt with above.  Otherwise, we have a valid "plan
+  # with SKIP" specification, and should report it as a particular kind
+  # of SKIP result.
+  if (planned == 0 && testno == 0)
+    {
+      if (length(skip_reason))
+        skip_reason = "- "  skip_reason;
+      report("SKIP", skip_reason);
+    }
+}
+
+function extract_tap_comment(line)
+{
+  if (index(line, diag_string) == 1)
+    {
+      # Strip leading `diag_string` from `line`.
+      line = substr(line, length(diag_string) + 1)
+      # And strip any leading and trailing whitespace left.
+      sub("^[ \t]*", "", line)
+      sub("[ \t]*$", "", line)
+      # Return what is left (if any).
+      return line;
+    }
+  return "";
+}
+
+# When this function is called, we know that line is a TAP result line,
+# so that it matches the (perl) RE "^(not )?ok\b".
+function setup_result_obj(line)
+{
+  # Get the result, and remove it from the line.
+  result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
+  sub("^(not )?ok[ \t]*", "", line)
+
+  # If the result has an explicit number, get it and strip it; otherwise,
+  # automatically assing the next progressive number to it.
+  if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
+    {
+      match(line, "^[0-9]+")
+      # The final `+ 0` is to normalize numbers with leading zeros.
+      result_obj["number"] = substr(line, 1, RLENGTH) + 0
+      line = substr(line, RLENGTH + 1)
+    }
+  else
+    {
+      result_obj["number"] = testno
+    }
+
+  if (plan_seen == LATE_PLAN)
+    # No further test results are acceptable after a "late" TAP plan
+    # has been seen.
+    result_obj["is_unplanned"] = 1
+  else if (plan_seen && testno > planned_tests)
+    result_obj["is_unplanned"] = 1
+  else
+    result_obj["is_unplanned"] = 0
+
+  # Strip trailing and leading whitespace.
+  sub("^[ \t]*", "", line)
+  sub("[ \t]*$", "", line)
+
+  # This will have to be corrected if we have a "TODO"/"SKIP" directive.
+  result_obj["description"] = line
+  result_obj["directive"] = ""
+  result_obj["explanation"] = ""
+
+  if (index(line, "#") == 0)
+    return # No possible directive, nothing more to do.
+
+  # Directives are case-insensitive.
+  rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
+
+  # See whether we have the directive, and if yes, where.
+  pos = match(line, rx "$")
+  if (!pos)
+    pos = match(line, rx "[^a-zA-Z0-9_]")
+
+  # If there was no TAP directive, we have nothing more to do.
+  if (!pos)
+    return
+
+  # Let`s now see if the TAP directive has been escaped.  For example:
+  #  escaped:     ok \# SKIP
+  #  not escaped: ok \\# SKIP
+  #  escaped:     ok \\\\\# SKIP
+  #  not escaped: ok \ # SKIP
+  if (substr(line, pos, 1) == "#")
+    {
+      bslash_count = 0
+      for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
+        bslash_count += 1
+      if (bslash_count % 2)
+        return # Directive was escaped.
+    }
+
+  # Strip the directive and its explanation (if any) from the test
+  # description.
+  result_obj["description"] = substr(line, 1, pos - 1)
+  # Now remove the test description from the line, that has been dealt
+  # with already.
+  line = substr(line, pos)
+  # Strip the directive, and save its value (normalized to upper case).
+  sub("^[ \t]*#[ \t]*", "", line)
+  result_obj["directive"] = toupper(substr(line, 1, 4))
+  line = substr(line, 5)
+  # Now get the explanation for the directive (if any), with leading
+  # and trailing whitespace removed.
+  sub("^[ \t]*", "", line)
+  sub("[ \t]*$", "", line)
+  result_obj["explanation"] = line
+}
+
+function get_test_exit_message(status)
+{
+  if (status == 0)
+    return ""
+  if (status !~ /^[1-9][0-9]*$/)
+    abort("getting exit status")
+  if (status < 127)
+    exit_details = ""
+  else if (status == 127)
+    exit_details = " (command not found?)"
+  else if (status >= 128 && status <= 255)
+    exit_details = sprintf(" (terminated by signal %d?)", status - 128)
+  else if (status > 256 && status <= 384)
+    # We used to report an "abnormal termination" here, but some Korn
+    # shells, when a child process die due to signal number n, can leave
+    # in $? an exit status of 256+n instead of the more standard 128+n.
+    # Apparently, both behaviours are allowed by POSIX (2008), so be
+    # prepared to handle them both.  See also Austing Group report ID
+    # 0000051 <http://www.austingroupbugs.net/view.php?id=51>
+    exit_details = sprintf(" (terminated by signal %d?)", status - 256)
+  else
+    # Never seen in practice.
+    exit_details = " (abnormal termination)"
+  return sprintf("exited with status %d%s", status, exit_details)
+}
+
+function write_test_results()
+{
+  print ":global-test-result: " get_global_test_result() > trs_file
+  print ":recheck: "  yn(must_recheck()) > trs_file
+  print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
+  for (i = 0; i < test_results_index; i += 1)
+    print ":test-result: " test_results_list[i] > trs_file
+  close(trs_file);
+}
+
+BEGIN {
+
+## ------- ##
+##  SETUP  ##
+## ------- ##
+
+'"$init_colors"'
+
+# Properly initialized once the TAP plan is seen.
+planned_tests = 0
+
+COOKED_PASS = expect_failure ? "XPASS": "PASS";
+COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
+
+# Enumeration-like constants to remember which kind of plan (if any)
+# has been seen.  It is important that NO_PLAN evaluates "false" as
+# a boolean.
+NO_PLAN = 0
+EARLY_PLAN = 1
+LATE_PLAN = 2
+
+testno = 0     # Number of test results seen so far.
+bailed_out = 0 # Whether a "Bail out!" directive has been seen.
+
+# Whether the TAP plan has been seen or not, and if yes, which kind
+# it is ("early" is seen before any test result, "late" otherwise).
+plan_seen = NO_PLAN
+
+## --------- ##
+##  PARSING  ##
+## --------- ##
+
+is_first_read = 1
+
+while (1)
+  {
+    # Involutions required so that we are able to read the exit status
+    # from the last input line.
+    st = getline
+    if (st < 0) # I/O error.
+      fatal("I/O error while reading from input stream")
+    else if (st == 0) # End-of-input
+      {
+        if (is_first_read)
+          abort("in input loop: only one input line")
+        break
+      }
+    if (is_first_read)
+      {
+        is_first_read = 0
+        nextline = $0
+        continue
+      }
+    else
+      {
+        curline = nextline
+        nextline = $0
+        $0 = curline
+      }
+    # Copy any input line verbatim into the log file.
+    print | "cat >&3"
+    # Parsing of TAP input should stop after a "Bail out!" directive.
+    if (bailed_out)
+      continue
+
+    # TAP test result.
+    if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
+      {
+        testno += 1
+        setup_result_obj($0)
+        handle_tap_result()
+      }
+    # TAP plan (normal or "SKIP" without explanation).
+    else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
+      {
+        # The next two lines will put the number of planned tests in $0.
+        sub("^1\\.\\.", "")
+        sub("[^0-9]*$", "")
+        handle_tap_plan($0, "")
+        continue
+      }
+    # TAP "SKIP" plan, with an explanation.
+    else if ($0 ~ /^1\.\.0+[ \t]*#/)
+      {
+        # The next lines will put the skip explanation in $0, stripping
+        # any leading and trailing whitespace.  This is a little more
+        # tricky in truth, since we want to also strip a potential leading
+        # "SKIP" string from the message.
+        sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
+        sub("[ \t]*$", "");
+        handle_tap_plan(0, $0)
+      }
+    # "Bail out!" magic.
+    # Older versions of prove and TAP::Harness (e.g., 3.17) did not
+    # recognize a "Bail out!" directive when preceded by leading
+    # whitespace, but more modern versions (e.g., 3.23) do.  So we
+    # emulate the latter, "more modern" behaviour.
+    else if ($0 ~ /^[ \t]*Bail out!/)
+      {
+        bailed_out = 1
+        # Get the bailout message (if any), with leading and trailing
+        # whitespace stripped.  The message remains stored in `$0`.
+        sub("^[ \t]*Bail out![ \t]*", "");
+        sub("[ \t]*$", "");
+        # Format the error message for the
+        bailout_message = "Bail out!"
+        if (length($0))
+          bailout_message = bailout_message " " $0
+        testsuite_error(bailout_message)
+      }
+    # Maybe we have too look for diagnostic comments too.
+    else if (comments != 0)
+      {
+        comment = extract_tap_comment($0);
+        if (length(comment))
+          report("#", comment);
+      }
+  }
+
+## -------- ##
+##  FINISH  ##
+## -------- ##
+
+# A "Bail out!" directive should cause us to ignore any following TAP
+# error, as well as a non-zero exit status from the TAP producer.
+if (!bailed_out)
+  {
+    if (!plan_seen)
+      {
+        testsuite_error("missing test plan")
+      }
+    else if (planned_tests != testno)
+      {
+        bad_amount = testno > planned_tests ? "many" : "few"
+        testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
+                                bad_amount, planned_tests, testno))
+      }
+    if (!ignore_exit)
+      {
+        # Fetch exit status from the last line.
+        exit_message = get_test_exit_message(nextline)
+        if (exit_message)
+          testsuite_error(exit_message)
+      }
+  }
+
+write_test_results()
+
+exit 0
+
+} # End of "BEGIN" block.
+'
+
+# TODO: document that we consume the file descriptor 3 :-(
+} 3>"$log_file"
+
+test $? -eq 0 || fatal "I/O or internal error"
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/buildutil/tap-test b/buildutil/tap-test
new file mode 100755 (executable)
index 0000000..fd77f53
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/bash
+#
+# Run a test in tap mode, ensuring we have a temporary directory.  We
+# always use /var/tmp because we might want to use user xattrs, which
+# aren't available on tmpfs.
+#
+# The test binary is passed as $1
+
+srcd=$(cd $(dirname $1) && pwd)
+bn=$(basename $1)
+tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX)
+touch ${tempdir}/.testtmp
+function cleanup () {
+    if test -n "${TEST_SKIP_CLEANUP:-}"; then
+        echo "Skipping cleanup of ${tempdir}"
+    else if test -f ${tempdir}/.testtmp; then
+        rm "${tempdir}" -rf
+    fi
+    fi
+}
+trap cleanup EXIT
+cd ${tempdir}
+${srcd}/${bn} -k --tap
diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc
new file mode 100644 (file)
index 0000000..8e9b916
--- /dev/null
@@ -0,0 +1,77 @@
+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
+
+common/flatpak-dbus.c: data/org.freedesktop.Flatpak.xml Makefile
+       mkdir -p $(builddir)/common
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.Flatpak.     \
+               --c-namespace Flatpak                           \
+               --generate-c-code $(builddir)/common/flatpak-dbus       \
+               $(srcdir)/data/org.freedesktop.Flatpak.xml      \
+               $(NULL)
+
+common/flatpak-systemd-dbus.c: data/org.freedesktop.systemd1.xml Makefile
+       mkdir -p $(builddir)/common
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.systemd1.    \
+               --c-namespace Systemd                           \
+               --generate-c-code $(builddir)/common/flatpak-systemd-dbus       \
+               $(srcdir)/data/org.freedesktop.systemd1.xml     \
+               $(NULL)
+
+common/%-dbus.h: common/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+nodist_libflatpak_common_la_SOURCES = \
+       $(dbus_built_sources)           \
+       $(systemd_dbus_built_sources)   \
+       $(xdp_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 \
+       common/flatpak-dir.h \
+       common/flatpak-run.c \
+       common/flatpak-run.h \
+       common/flatpak-portal-error.c \
+       common/flatpak-portal-error.h \
+       common/flatpak-utils.c \
+       common/flatpak-utils.h \
+       common/flatpak-table-printer.c \
+       common/flatpak-table-printer.h \
+       common/flatpak-chain-input-stream.c \
+       common/flatpak-chain-input-stream.h \
+       common/gvdb/gvdb-reader.h       \
+       common/gvdb/gvdb-format.h       \
+       common/gvdb/gvdb-reader.c       \
+       common/gvdb/gvdb-builder.h      \
+       common/gvdb/gvdb-builder.c      \
+       common/flatpak-db.c \
+       common/flatpak-db.h \
+       common/flatpak-json.c \
+       common/flatpak-json.h \
+       common/flatpak-json-oci.c \
+       common/flatpak-json-oci.h \
+       common/flatpak-oci-registry.c \
+       common/flatpak-oci-registry.h \
+       $(NULL)
+
+libflatpak_common_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(BASE_CFLAGS) \
+       $(HIDDEN_VISIBILITY_CFLAGS) \
+       $(OSTREE_CFLAGS) \
+       $(SOUP_CFLAGS) \
+       $(JSON_CFLAGS) \
+       $(XAUTH_CFLAGS) \
+       $(LIBSECCOMP_CFLAGS) \
+       $(INTERNAL_GPGME_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)
diff --git a/common/flatpak-chain-input-stream.c b/common/flatpak-chain-input-stream.c
new file mode 100644 (file)
index 0000000..b714e04
--- /dev/null
@@ -0,0 +1,214 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2011 Colin Walters <walters@verbum.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "flatpak-chain-input-stream.h"
+
+enum {
+  PROP_0,
+  PROP_STREAMS
+};
+
+G_DEFINE_TYPE (FlatpakChainInputStream, flatpak_chain_input_stream, G_TYPE_INPUT_STREAM)
+
+struct _FlatpakChainInputStreamPrivate
+{
+  GPtrArray *streams;
+  guint      index;
+};
+
+static void     flatpak_chain_input_stream_set_property (GObject      *object,
+                                                         guint         prop_id,
+                                                         const GValue *value,
+                                                         GParamSpec   *pspec);
+static void     flatpak_chain_input_stream_get_property (GObject    *object,
+                                                         guint       prop_id,
+                                                         GValue     *value,
+                                                         GParamSpec *pspec);
+static void     flatpak_chain_input_stream_finalize (GObject *object);
+static gssize   flatpak_chain_input_stream_read (GInputStream *stream,
+                                                 void         *buffer,
+                                                 gsize         count,
+                                                 GCancellable *cancellable,
+                                                 GError      **error);
+static gboolean flatpak_chain_input_stream_close (GInputStream *stream,
+                                                  GCancellable *cancellable,
+                                                  GError      **error);
+
+static void
+flatpak_chain_input_stream_class_init (FlatpakChainInputStreamClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (FlatpakChainInputStreamPrivate));
+
+  gobject_class->get_property = flatpak_chain_input_stream_get_property;
+  gobject_class->set_property = flatpak_chain_input_stream_set_property;
+  gobject_class->finalize     = flatpak_chain_input_stream_finalize;
+
+  stream_class->read_fn = flatpak_chain_input_stream_read;
+  stream_class->close_fn = flatpak_chain_input_stream_close;
+
+  /*
+   * FlatpakChainInputStream:streams: (element-type GInputStream)
+   *
+   * Chain of input streams read in order.
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_STREAMS,
+                                   g_param_spec_pointer ("streams",
+                                                         "", "",
+                                                         G_PARAM_READWRITE |
+                                                         G_PARAM_CONSTRUCT_ONLY |
+                                                         G_PARAM_STATIC_STRINGS));
+
+}
+
+static void
+flatpak_chain_input_stream_set_property (GObject      *object,
+                                         guint         prop_id,
+                                         const GValue *value,
+                                         GParamSpec   *pspec)
+{
+  FlatpakChainInputStream *self;
+
+  self = FLATPAK_CHAIN_INPUT_STREAM (object);
+
+  switch (prop_id)
+    {
+    case PROP_STREAMS:
+      self->priv->streams = g_ptr_array_ref (g_value_get_pointer (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_chain_input_stream_get_property (GObject    *object,
+                                         guint       prop_id,
+                                         GValue     *value,
+                                         GParamSpec *pspec)
+{
+  FlatpakChainInputStream *self;
+
+  self = FLATPAK_CHAIN_INPUT_STREAM (object);
+
+  switch (prop_id)
+    {
+    case PROP_STREAMS:
+      g_value_set_pointer (value, self->priv->streams);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+flatpak_chain_input_stream_finalize (GObject *object)
+{
+  FlatpakChainInputStream *stream;
+
+  stream = (FlatpakChainInputStream *) (object);
+
+  g_ptr_array_unref (stream->priv->streams);
+
+  G_OBJECT_CLASS (flatpak_chain_input_stream_parent_class)->finalize (object);
+}
+
+static void
+flatpak_chain_input_stream_init (FlatpakChainInputStream *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                            FLATPAK_TYPE_CHAIN_INPUT_STREAM,
+                                            FlatpakChainInputStreamPrivate);
+
+}
+
+FlatpakChainInputStream *
+flatpak_chain_input_stream_new (GPtrArray *streams)
+{
+  FlatpakChainInputStream *stream;
+
+  stream = g_object_new (FLATPAK_TYPE_CHAIN_INPUT_STREAM,
+                         "streams", streams,
+                         NULL);
+
+  return (FlatpakChainInputStream *) (stream);
+}
+
+static gssize
+flatpak_chain_input_stream_read (GInputStream *stream,
+                                 void         *buffer,
+                                 gsize         count,
+                                 GCancellable *cancellable,
+                                 GError      **error)
+{
+  FlatpakChainInputStream *self = (FlatpakChainInputStream *) stream;
+  GInputStream *child;
+  gssize res = -1;
+
+  if (g_cancellable_set_error_if_cancelled (cancellable, error))
+    return -1;
+
+  if (self->priv->index >= self->priv->streams->len)
+    return 0;
+
+  res = 0;
+  while (res == 0 && self->priv->index < self->priv->streams->len)
+    {
+      child = self->priv->streams->pdata[self->priv->index];
+      res = g_input_stream_read (child,
+                                 buffer,
+                                 count,
+                                 cancellable,
+                                 error);
+      if (res == 0)
+        self->priv->index++;
+    }
+
+  return res;
+}
+
+static gboolean
+flatpak_chain_input_stream_close (GInputStream *stream,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  gboolean ret = FALSE;
+  FlatpakChainInputStream *self = (gpointer) stream;
+  guint i;
+
+  for (i = 0; i < self->priv->streams->len; i++)
+    {
+      GInputStream *child = self->priv->streams->pdata[i];
+      if (!g_input_stream_close (child, cancellable, error))
+        goto out;
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
diff --git a/common/flatpak-chain-input-stream.h b/common/flatpak-chain-input-stream.h
new file mode 100644 (file)
index 0000000..376d7e8
--- /dev/null
@@ -0,0 +1,68 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2011 Colin Walters <walters@verbum.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#pragma once
+
+#ifndef __GI_SCANNER__
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define FLATPAK_TYPE_CHAIN_INPUT_STREAM (flatpak_chain_input_stream_get_type ())
+#define FLATPAK_CHAIN_INPUT_STREAM(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStream))
+#define FLATPAK_CHAIN_INPUT_STREAM_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass))
+#define FLATPAK_IS_CHAIN_INPUT_STREAM(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM))
+#define FLATPAK_IS_CHAIN_INPUT_STREAM_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM))
+#define FLATPAK_CHAIN_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass))
+
+typedef struct _FlatpakChainInputStream        FlatpakChainInputStream;
+typedef struct _FlatpakChainInputStreamClass   FlatpakChainInputStreamClass;
+typedef struct _FlatpakChainInputStreamPrivate FlatpakChainInputStreamPrivate;
+
+struct _FlatpakChainInputStream
+{
+  GInputStream parent_instance;
+
+  /*< private >*/
+  FlatpakChainInputStreamPrivate *priv;
+};
+
+struct _FlatpakChainInputStreamClass
+{
+  GInputStreamClass parent_class;
+
+  /*< private >*/
+  /* Padding for future expansion */
+  void (*_g_reserved1) (void);
+  void (*_g_reserved2) (void);
+  void (*_g_reserved3) (void);
+  void (*_g_reserved4) (void);
+  void (*_g_reserved5) (void);
+};
+
+GType          flatpak_chain_input_stream_get_type (void) G_GNUC_CONST;
+
+FlatpakChainInputStream * flatpak_chain_input_stream_new (GPtrArray *streams);
+
+G_END_DECLS
+
+#endif
diff --git a/common/flatpak-common-types.h b/common/flatpak-common-types.h
new file mode 100644 (file)
index 0000000..2265785
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_COMMON_TYPES_H__
+#define __FLATPAK_COMMON_TYPES_H__
+
+typedef enum {
+  FLATPAK_KINDS_APP = 1 << 0,
+  FLATPAK_KINDS_RUNTIME = 1 << 1,
+} FlatpakKinds;
+
+typedef struct FlatpakDir     FlatpakDir;
+typedef struct FlatpakDeploy  FlatpakDeploy;
+typedef struct FlatpakContext FlatpakContext;
+typedef struct FlatpakOciRegistry FlatpakOciRegistry;
+typedef struct _FlatpakOciManifest FlatpakOciManifest;
+
+#endif /* __FLATPAK_COMMON_TYPES_H__ */
diff --git a/common/flatpak-db.c b/common/flatpak-db.c
new file mode 100644 (file)
index 0000000..f20443e
--- /dev/null
@@ -0,0 +1,1224 @@
+/* flatpak-db.c
+ *
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/statfs.h>
+
+#include "flatpak-db.h"
+#include "gvdb/gvdb-reader.h"
+#include "gvdb/gvdb-builder.h"
+
+struct FlatpakDb
+{
+  GObject    parent;
+
+  char      *path;
+  gboolean   fail_if_not_found;
+  GvdbTable *gvdb;
+  GBytes    *gvdb_contents;
+
+  gboolean   dirty;
+
+  /* Map id => GVariant (data, sorted-dict[appid->perms]) */
+  GvdbTable  *main_table;
+  GHashTable *main_updates;
+
+  /* (reverse) Map app id => [ id ]*/
+  GvdbTable  *app_table;
+  GHashTable *app_additions;
+  GHashTable *app_removals;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakDbClass;
+
+static void initable_iface_init (GInitableIface *initable_iface);
+
+G_DEFINE_TYPE_WITH_CODE (FlatpakDb, flatpak_db, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init));
+
+enum {
+  PROP_0,
+  PROP_PATH,
+  PROP_FAIL_IF_NOT_FOUND,
+  LAST_PROP
+};
+
+static int
+cmpstringp (const void *p1, const void *p2)
+{
+  return strcmp (*(char * const *) p1, *(char * const *) p2);
+}
+
+static void
+sort_strv (const char **strv)
+{
+  qsort (strv, g_strv_length ((char **) strv), sizeof (const char *), cmpstringp);
+}
+
+static int
+str_ptr_array_find (GPtrArray  *array,
+                    const char *str)
+{
+  int i;
+
+  for (i = 0; i < array->len; i++)
+    if (strcmp (g_ptr_array_index (array, i), str) == 0)
+      return i;
+
+  return -1;
+}
+
+static gboolean
+str_ptr_array_contains (GPtrArray  *array,
+                        const char *str)
+{
+  return str_ptr_array_find (array, str) >= 0;
+}
+
+const char *
+flatpak_db_get_path (FlatpakDb *self)
+{
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  return self->path;
+}
+
+void
+flatpak_db_set_path (FlatpakDb  *self,
+                     const char *path)
+{
+  g_return_if_fail (FLATPAK_IS_DB (self));
+
+  g_clear_pointer (&self->path, g_free);
+  self->path = g_strdup (path);
+}
+
+FlatpakDb *
+flatpak_db_new (const char *path,
+                gboolean    fail_if_not_found,
+                GError    **error)
+{
+  return g_initable_new (FLATPAK_TYPE_DB,
+                         NULL,
+                         error,
+                         "path", path,
+                         "fail-if-not-found", fail_if_not_found,
+                         NULL);
+}
+
+static void
+flatpak_db_finalize (GObject *object)
+{
+  FlatpakDb *self = (FlatpakDb *) object;
+
+  g_clear_pointer (&self->path, g_free);
+  g_clear_pointer (&self->gvdb_contents, g_bytes_unref);
+  g_clear_pointer (&self->gvdb, gvdb_table_free);
+  g_clear_pointer (&self->main_table, gvdb_table_free);
+  g_clear_pointer (&self->app_table, gvdb_table_free);
+  g_clear_pointer (&self->main_updates, g_hash_table_unref);
+  g_clear_pointer (&self->app_additions, g_hash_table_unref);
+  g_clear_pointer (&self->app_removals, g_hash_table_unref);
+
+  G_OBJECT_CLASS (flatpak_db_parent_class)->finalize (object);
+}
+
+static void
+flatpak_db_get_property (GObject    *object,
+                         guint       prop_id,
+                         GValue     *value,
+                         GParamSpec *pspec)
+{
+  FlatpakDb *self = FLATPAK_DB (object);
+
+  switch (prop_id)
+    {
+    case PROP_PATH:
+      g_value_set_string (value, self->path);
+      break;
+
+    case PROP_FAIL_IF_NOT_FOUND:
+      g_value_set_boolean (value, self->fail_if_not_found);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+flatpak_db_set_property (GObject      *object,
+                         guint         prop_id,
+                         const GValue *value,
+                         GParamSpec   *pspec)
+{
+  FlatpakDb *self = FLATPAK_DB (object);
+
+  switch (prop_id)
+    {
+    case PROP_PATH:
+      g_clear_pointer (&self->path, g_free);
+      self->path = g_value_dup_string (value);
+      break;
+
+    case PROP_FAIL_IF_NOT_FOUND:
+      self->fail_if_not_found = g_value_get_boolean (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+flatpak_db_class_init (FlatpakDbClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_db_finalize;
+  object_class->get_property = flatpak_db_get_property;
+  object_class->set_property = flatpak_db_set_property;
+
+  g_object_class_install_property (object_class,
+                                   PROP_PATH,
+                                   g_param_spec_string ("path",
+                                                        "",
+                                                        "",
+                                                        NULL,
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_FAIL_IF_NOT_FOUND,
+                                   g_param_spec_boolean ("fail-if-not-found",
+                                                         "",
+                                                         "",
+                                                         TRUE,
+                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+flatpak_db_init (FlatpakDb *self)
+{
+  self->fail_if_not_found = TRUE;
+
+  self->main_updates =
+    g_hash_table_new_full (g_str_hash, g_str_equal,
+                           g_free, (GDestroyNotify) g_variant_unref);
+  self->app_additions =
+    g_hash_table_new_full (g_str_hash, g_str_equal,
+                           g_free, (GDestroyNotify) g_ptr_array_unref);
+  self->app_removals =
+    g_hash_table_new_full (g_str_hash, g_str_equal,
+                           g_free, (GDestroyNotify) g_ptr_array_unref);
+}
+
+static gboolean
+is_on_nfs (const char *path)
+{
+  struct statfs statfs_buffer;
+  int statfs_result;
+  g_autofree char *dirname = NULL;
+
+  dirname = g_path_get_dirname (path);
+
+  statfs_result = statfs (dirname, &statfs_buffer);
+  if (statfs_result != 0)
+    return FALSE;
+
+  return statfs_buffer.f_type == 0x6969;
+}
+
+static gboolean
+initable_init (GInitable    *initable,
+               GCancellable *cancellable,
+               GError      **error)
+{
+  FlatpakDb *self = (FlatpakDb *) initable;
+  GError *my_error = NULL;
+
+  if (self->path == NULL)
+    return TRUE;
+
+  if (is_on_nfs (self->path))
+    {
+      g_autoptr(GFile) file = g_file_new_for_path (self->path);
+      char *contents;
+      gsize length;
+
+      /* We avoid using mmap on NFS, because its prone to give us SIGBUS at semi-random
+         times (nfs down, file removed, etc). Instead we just load the file */
+      if (g_file_load_contents (file, cancellable, &contents, &length, NULL, &my_error))
+        self->gvdb_contents = g_bytes_new_take (contents, length);
+    }
+  else
+    {
+      GMappedFile *mapped = g_mapped_file_new (self->path, FALSE, &my_error);
+      if (mapped)
+        {
+          self->gvdb_contents = g_mapped_file_get_bytes (mapped);
+          g_mapped_file_unref (mapped);
+        }
+    }
+
+  if (self->gvdb_contents == NULL)
+    {
+      if (!self->fail_if_not_found &&
+          g_error_matches (my_error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+        {
+          g_error_free (my_error);
+        }
+      else
+        {
+          g_propagate_error (error, my_error);
+          return FALSE;
+        }
+    }
+  else
+    {
+      self->gvdb = gvdb_table_new_from_bytes (self->gvdb_contents, TRUE, error);
+      if (self->gvdb == NULL)
+        return FALSE;
+
+      self->main_table = gvdb_table_get_table (self->gvdb, "main");
+      if (self->main_table == NULL)
+        {
+          g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                       "No main table in db");
+          return FALSE;
+        }
+
+      self->app_table = gvdb_table_get_table (self->gvdb, "apps");
+      if (self->app_table == NULL)
+        {
+          g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                       "No app table in db");
+          return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+static void
+initable_iface_init (GInitableIface *initable_iface)
+{
+  initable_iface->init = initable_init;
+}
+
+/* Transfer: full */
+char **
+flatpak_db_list_ids (FlatpakDb *self)
+{
+  GPtrArray *res;
+  GHashTableIter iter;
+  gpointer key, value;
+  int i;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  res = g_ptr_array_new ();
+
+  g_hash_table_iter_init (&iter, self->main_updates);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      if (value != NULL)
+        g_ptr_array_add (res, g_strdup (key));
+    }
+
+  if (self->main_table)
+    {
+      // TODO: can we use gvdb_table_list here???
+      g_autofree char **main_ids = gvdb_table_get_names (self->main_table, NULL);
+
+      for (i = 0; main_ids[i] != NULL; i++)
+        {
+          char *id = main_ids[i];
+
+          if (g_hash_table_lookup_extended (self->main_updates, id, NULL, NULL))
+            g_free (id);
+          else
+            g_ptr_array_add (res, id);
+        }
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **) g_ptr_array_free (res, FALSE);
+}
+
+static gboolean
+app_update_empty (GHashTable *ht, const char *app)
+{
+  GPtrArray *array;
+
+  array = g_hash_table_lookup (ht, app);
+  if (array == NULL)
+    return TRUE;
+
+  return array->len == 0;
+}
+
+/* Transfer: full */
+char **
+flatpak_db_list_apps (FlatpakDb *self)
+{
+  gpointer key, _value;
+  GHashTableIter iter;
+  GPtrArray *res;
+  int i;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  res = g_ptr_array_new ();
+
+  g_hash_table_iter_init (&iter, self->app_additions);
+  while (g_hash_table_iter_next (&iter, &key, &_value))
+    {
+      GPtrArray *value = _value;
+      if (value->len > 0)
+        g_ptr_array_add (res, g_strdup (key));
+    }
+
+  if (self->app_table)
+    {
+      // TODO: can we use gvdb_table_list here???
+      g_autofree char **apps = gvdb_table_get_names (self->app_table, NULL);
+
+      for (i = 0; apps[i] != NULL; i++)
+        {
+          char *app = apps[i];
+          gboolean empty = TRUE;
+          GPtrArray *removals;
+          int j;
+
+          /* Don't use if we already added above */
+          if (app_update_empty (self->app_additions, app))
+            {
+              g_autoptr(GVariant) ids_v = NULL;
+
+              removals = g_hash_table_lookup (self->app_removals, app);
+
+              /* Add unless all items are removed */
+              ids_v = gvdb_table_get_value (self->app_table, app);
+
+              if (ids_v)
+                {
+                  g_autofree const char **ids = g_variant_get_strv (ids_v, NULL);
+
+                  for (j = 0; ids[j] != NULL; j++)
+                    {
+                      if (removals == NULL ||
+                          !str_ptr_array_contains (removals, ids[j]))
+                        {
+                          empty = FALSE;
+                          break;
+                        }
+                    }
+                }
+            }
+
+          if (empty)
+            g_free (app);
+          else
+            g_ptr_array_add (res, app);
+        }
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **) g_ptr_array_free (res, FALSE);
+}
+
+/* Transfer: full */
+char **
+flatpak_db_list_ids_by_app (FlatpakDb  *self,
+                            const char *app)
+{
+  GPtrArray *res;
+  GPtrArray *additions;
+  GPtrArray *removals;
+  int i;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  res = g_ptr_array_new ();
+
+  additions = g_hash_table_lookup (self->app_additions, app);
+  removals = g_hash_table_lookup (self->app_removals, app);
+
+  if (additions)
+    {
+      for (i = 0; i < additions->len; i++)
+        g_ptr_array_add (res,
+                         g_strdup (g_ptr_array_index (additions, i)));
+    }
+
+  if (self->app_table)
+    {
+      g_autoptr(GVariant) ids_v = gvdb_table_get_value (self->app_table, app);
+      if (ids_v)
+        {
+          g_autofree const char **ids = g_variant_get_strv (ids_v, NULL);
+
+          for (i = 0; ids[i] != NULL; i++)
+            {
+              if (removals == NULL ||
+                  !str_ptr_array_contains (removals, ids[i]))
+                g_ptr_array_add (res, g_strdup (ids[i]));
+            }
+        }
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **) g_ptr_array_free (res, FALSE);
+}
+
+/* Transfer: full */
+FlatpakDbEntry *
+flatpak_db_lookup (FlatpakDb  *self,
+                   const char *id)
+{
+  GVariant *res = NULL;
+  gpointer value;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+  g_return_val_if_fail (id != NULL, NULL);
+
+  if (g_hash_table_lookup_extended (self->main_updates, id, NULL, &value))
+    {
+      if (value != NULL)
+        res = g_variant_ref ((GVariant *) value);
+    }
+  else if (self->main_table)
+    {
+      res = gvdb_table_get_value (self->main_table, id);
+    }
+
+  return (FlatpakDbEntry *) res;
+}
+
+/* Transfer: full */
+char **
+flatpak_db_list_ids_by_value (FlatpakDb *self,
+                              GVariant  *data)
+{
+  g_autofree char **ids = flatpak_db_list_ids (self);
+  int i;
+  GPtrArray *res;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+  g_return_val_if_fail (data != NULL, NULL);
+
+  res = g_ptr_array_new ();
+
+  for (i = 0; ids[i] != NULL; i++)
+    {
+      char *id = ids[i];
+
+      g_autoptr(FlatpakDbEntry) entry = NULL;
+      g_autoptr(GVariant) entry_data = NULL;
+
+      entry = flatpak_db_lookup (self, id);
+      if (entry)
+        {
+          entry_data = flatpak_db_entry_get_data (entry);
+          if (g_variant_equal (data, entry_data))
+            {
+              g_ptr_array_add (res, id);
+              id = NULL; /* Don't free, as we return this */
+            }
+        }
+      g_free (id);
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **) g_ptr_array_free (res, FALSE);
+}
+
+static void
+add_app_id (FlatpakDb  *self,
+            const char *app,
+            const char *id)
+{
+  GPtrArray *additions;
+  GPtrArray *removals;
+  int i;
+
+  additions = g_hash_table_lookup (self->app_additions, app);
+  removals = g_hash_table_lookup (self->app_removals, app);
+
+  if (removals)
+    {
+      i = str_ptr_array_find (removals, id);
+      if (i >= 0)
+        g_ptr_array_remove_index_fast (removals, i);
+    }
+
+  if (additions)
+    {
+      if (!str_ptr_array_contains (additions, id))
+        g_ptr_array_add (additions, g_strdup (id));
+    }
+  else
+    {
+      additions = g_ptr_array_new_with_free_func (g_free);
+      g_ptr_array_add (additions, g_strdup (id));
+      g_hash_table_insert (self->app_additions,
+                           g_strdup (app), additions);
+    }
+}
+
+static void
+remove_app_id (FlatpakDb  *self,
+               const char *app,
+               const char *id)
+{
+  GPtrArray *additions;
+  GPtrArray *removals;
+  int i;
+
+  additions = g_hash_table_lookup (self->app_additions, app);
+  removals = g_hash_table_lookup (self->app_removals, app);
+
+  if (additions)
+    {
+      i = str_ptr_array_find (additions, id);
+      if (i >= 0)
+        g_ptr_array_remove_index_fast (additions, i);
+    }
+
+  if (removals)
+    {
+      if (!str_ptr_array_contains (removals, id))
+        g_ptr_array_add (removals, g_strdup (id));
+    }
+  else
+    {
+      removals = g_ptr_array_new_with_free_func (g_free);
+      g_ptr_array_add (removals, g_strdup (id));
+      g_hash_table_insert (self->app_removals,
+                           g_strdup (app), removals);
+    }
+}
+
+gboolean
+flatpak_db_is_dirty (FlatpakDb *self)
+{
+  g_return_val_if_fail (FLATPAK_IS_DB (self), FALSE);
+
+  return self->dirty;
+}
+
+/* add, replace, or NULL entry to remove */
+void
+flatpak_db_set_entry (FlatpakDb      *self,
+                      const char     *id,
+                      FlatpakDbEntry *entry)
+{
+  g_autoptr(FlatpakDbEntry) old_entry = NULL;
+  g_autofree const char **old = NULL;
+  g_autofree const char **new = NULL;
+  static const char *empty[] = { NULL };
+  const char **a, **b;
+  int ia, ib;
+
+  g_return_if_fail (FLATPAK_IS_DB (self));
+  g_return_if_fail (id != NULL);
+
+  self->dirty = TRUE;
+
+  old_entry = flatpak_db_lookup (self, id);
+
+  g_hash_table_insert (self->main_updates,
+                       g_strdup (id),
+                       flatpak_db_entry_ref (entry));
+
+  a = empty;
+  b = empty;
+
+  if (old_entry)
+    {
+      old = flatpak_db_entry_list_apps (old_entry);
+      sort_strv (old);
+      a = old;
+    }
+
+  if (entry)
+    {
+      new = flatpak_db_entry_list_apps (entry);
+      sort_strv (new);
+      b = new;
+    }
+
+  ia = 0;
+  ib = 0;
+  while (a[ia] != NULL || b[ib] != NULL)
+    {
+      if (a[ia] == NULL)
+        {
+          /* Not in old, but in new => added */
+          add_app_id (self, b[ib], id);
+          ib++;
+        }
+      else if (b[ib] == NULL)
+        {
+          /* Not in new, but in old => removed */
+          remove_app_id (self, a[ia], id);
+          ia++;
+        }
+      else
+        {
+          int cmp = strcmp (a[ia], b[ib]);
+
+          if (cmp == 0)
+            {
+              /* In both, no change */
+              ia++;
+              ib++;
+            }
+          else if (cmp < 0)
+            {
+              /* Not in new, but in old => removed */
+              remove_app_id (self, a[ia], id);
+              ia++;
+            }
+          else /* cmp > 0 */
+            {
+              /* Not in old, but in new => added */
+              add_app_id (self, b[ib], id);
+              ib++;
+            }
+        }
+    }
+}
+
+void
+flatpak_db_update (FlatpakDb *self)
+{
+  GHashTable *root, *main_h, *apps_h;
+  GBytes *new_contents;
+  GvdbTable *new_gvdb;
+  int i;
+
+  g_auto(GStrv) ids = NULL;
+  g_auto(GStrv) apps = NULL;
+
+  g_return_if_fail (FLATPAK_IS_DB (self));
+
+  root = gvdb_hash_table_new (NULL, NULL);
+  main_h = gvdb_hash_table_new (root, "main");
+  apps_h = gvdb_hash_table_new (root, "apps");
+  g_hash_table_unref (main_h);
+  g_hash_table_unref (apps_h);
+
+  ids = flatpak_db_list_ids (self);
+  for (i = 0; ids[i] != 0; i++)
+    {
+      g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (self, ids[i]);
+      if (entry != NULL)
+        {
+          GvdbItem *item;
+
+          item = gvdb_hash_table_insert (main_h, ids[i]);
+          gvdb_item_set_value (item, (GVariant *) entry);
+        }
+    }
+
+  apps = flatpak_db_list_apps (self);
+  for (i = 0; apps[i] != 0; i++)
+    {
+      g_auto(GStrv) app_ids = flatpak_db_list_ids_by_app (self, apps[i]);
+      GVariantBuilder builder;
+      GvdbItem *item;
+      int j;
+
+      /* May as well ensure that on-disk arrays are sorted, even if we don't use it yet */
+      sort_strv ((const char **) app_ids);
+
+      /* We should never list an app that has empty id lists */
+      g_assert (app_ids[0] != NULL);
+
+      g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+      for (j = 0; app_ids[j] != NULL; j++)
+        g_variant_builder_add (&builder, "s", app_ids[j]);
+
+      item = gvdb_hash_table_insert (apps_h, apps[i]);
+      gvdb_item_set_value (item, g_variant_builder_end (&builder));
+    }
+
+  new_contents = gvdb_table_get_content (root, FALSE);
+  new_gvdb = gvdb_table_new_from_bytes (new_contents, TRUE, NULL);
+
+  /* This was just created, any failure to parse it is purely an internal error */
+  g_assert (new_gvdb != NULL);
+
+  g_clear_pointer (&self->gvdb_contents, g_bytes_unref);
+  g_clear_pointer (&self->gvdb, gvdb_table_free);
+  self->gvdb_contents = new_contents;
+  self->gvdb = new_gvdb;
+  self->dirty = FALSE;
+}
+
+GBytes *
+flatpak_db_get_content (FlatpakDb *self)
+{
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  return self->gvdb_contents;
+}
+
+/* Note: You must first call update to serialize, this only saves serialied data */
+gboolean
+flatpak_db_save_content (FlatpakDb *self,
+                         GError   **error)
+{
+  GBytes *content = NULL;
+
+  if (self->gvdb_contents == NULL)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                   "No content to save");
+      return FALSE;
+    }
+
+  if (self->path == NULL)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                   "No path set");
+      return FALSE;
+    }
+
+  content = self->gvdb_contents;
+  return g_file_set_contents (self->path, g_bytes_get_data (content, NULL), g_bytes_get_size (content), error);
+}
+
+static void
+save_content_callback (GObject      *source_object,
+                       GAsyncResult *res,
+                       gpointer      user_data)
+{
+  g_autoptr(GTask) task = user_data;
+  GFile *file = G_FILE (source_object);
+  gboolean ok;
+  g_autoptr(GError) error = NULL;
+
+  ok = g_file_replace_contents_finish (file,
+                                       res,
+                                       NULL, &error);
+  if (ok)
+    g_task_return_boolean (task, TRUE);
+  else
+    g_task_return_error (task, error);
+}
+
+void
+flatpak_db_save_content_async (FlatpakDb          *self,
+                               GCancellable       *cancellable,
+                               GAsyncReadyCallback callback,
+                               gpointer            user_data)
+{
+  GBytes *content = NULL;
+
+  g_autoptr(GTask) task = NULL;
+  g_autoptr(GFile) file = NULL;
+
+  task = g_task_new (self, cancellable, callback, user_data);
+
+  if (self->gvdb_contents == NULL)
+    {
+      g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                               "No content to save");
+      return;
+    }
+
+  if (self->path == NULL)
+    {
+      g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                               "No path set");
+      return;
+    }
+
+  content = g_bytes_ref (self->gvdb_contents);
+  g_task_set_task_data (task, content, (GDestroyNotify) g_bytes_unref);
+
+  file = g_file_new_for_path (self->path);
+  g_file_replace_contents_bytes_async (file, content,
+                                       NULL, FALSE, 0,
+                                       cancellable,
+                                       save_content_callback,
+                                       g_object_ref (task));
+}
+
+gboolean
+flatpak_db_save_content_finish (FlatpakDb    *self,
+                                GAsyncResult *res,
+                                GError      **error)
+{
+  return g_task_propagate_boolean (G_TASK (res), error);
+}
+
+
+GString *
+flatpak_db_print_string (FlatpakDb *self,
+                         GString   *string)
+{
+  g_auto(GStrv) ids = NULL;
+  g_auto(GStrv) apps = NULL;
+  int i;
+
+  g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
+
+  if G_UNLIKELY (string == NULL)
+    string = g_string_new (NULL);
+
+  g_string_append_printf (string, "main {\n");
+
+  ids = flatpak_db_list_ids (self);
+  sort_strv ((const char **) ids);
+  for (i = 0; ids[i] != 0; i++)
+    {
+      g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (self, ids[i]);
+      g_string_append_printf (string, " %s: ", ids[i]);
+      if (entry != NULL)
+        flatpak_db_entry_print_string (entry, string);
+      g_string_append_printf (string, "\n");
+    }
+
+  g_string_append_printf (string, "}\napps {\n");
+
+  apps = flatpak_db_list_apps (self);
+  sort_strv ((const char **) apps);
+  for (i = 0; apps[i] != 0; i++)
+    {
+      int j;
+      g_auto(GStrv) app_ids = NULL;
+
+      app_ids = flatpak_db_list_ids_by_app (self, apps[i]);
+      sort_strv ((const char **) app_ids);
+
+      g_string_append_printf (string, " %s: ", apps[i]);
+      for (j = 0; app_ids[j] != NULL; j++)
+        g_string_append_printf (string, "%s%s", j == 0 ? "" : ", ", app_ids[j]);
+      g_string_append_printf (string, "\n");
+    }
+
+  g_string_append_printf (string, "}\n");
+
+  return string;
+}
+
+char *
+flatpak_db_print (FlatpakDb *self)
+{
+  return g_string_free (flatpak_db_print_string (self, NULL), FALSE);
+}
+
+FlatpakDbEntry  *
+flatpak_db_entry_ref (FlatpakDbEntry *entry)
+{
+  if (entry != NULL)
+    g_variant_ref ((GVariant *) entry);
+  return entry;
+}
+
+void
+flatpak_db_entry_unref (FlatpakDbEntry *entry)
+{
+  g_variant_unref ((GVariant *) entry);
+}
+
+/* Transfer: full */
+GVariant *
+flatpak_db_entry_get_data (FlatpakDbEntry *entry)
+{
+  g_autoptr(GVariant) variant = g_variant_get_child_value ((GVariant *) entry, 0);
+
+  return g_variant_get_child_value (variant, 0);
+}
+
+/* Transfer: container */
+const char **
+flatpak_db_entry_list_apps (FlatpakDbEntry *entry)
+{
+  GVariant *v = (GVariant *) entry;
+
+  g_autoptr(GVariant) app_array = NULL;
+  GVariantIter iter;
+  GVariant *child;
+  GPtrArray *res;
+
+  res = g_ptr_array_new ();
+
+  app_array = g_variant_get_child_value (v, 1);
+
+  g_variant_iter_init (&iter, app_array);
+  while ((child = g_variant_iter_next_value (&iter)))
+    {
+      const char *child_app_id;
+      g_autoptr(GVariant) permissions = g_variant_get_child_value (child, 1);
+
+      if (g_variant_n_children (permissions) > 0)
+        {
+          g_variant_get_child (child, 0, "&s", &child_app_id);
+          g_ptr_array_add (res, (char *) child_app_id);
+        }
+
+      g_variant_unref (child);
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (const char **) g_ptr_array_free (res, FALSE);
+}
+
+static GVariant *
+flatpak_db_entry_get_permissions_variant (FlatpakDbEntry *entry,
+                                          const char     *app_id)
+{
+  GVariant *v = (GVariant *) entry;
+
+  g_autoptr(GVariant) app_array = NULL;
+  GVariant *child;
+  GVariant *res = NULL;
+  gsize n_children, start, end, m;
+  const char *child_app_id;
+  int cmp;
+
+  app_array = g_variant_get_child_value (v, 1);
+
+  n_children = g_variant_n_children (app_array);
+
+  start = 0;
+  end = n_children;
+  while (start < end)
+    {
+      m = (start + end) / 2;
+
+      child = g_variant_get_child_value (app_array, m);
+      g_variant_get_child (child, 0, "&s", &child_app_id);
+
+      cmp = strcmp (app_id, child_app_id);
+      if (cmp == 0)
+        {
+          res = g_variant_get_child_value (child, 1);
+          break;
+        }
+      else if (cmp < 0)
+        {
+          end = m;
+        }
+      else /* cmp > 0 */
+        {
+          start = m + 1;
+        }
+    }
+
+  return res;
+}
+
+
+/* Transfer: container */
+const char **
+flatpak_db_entry_list_permissions (FlatpakDbEntry *entry,
+                                   const char     *app)
+{
+  g_autoptr(GVariant) permissions = NULL;
+
+  permissions = flatpak_db_entry_get_permissions_variant (entry, app);
+  if (permissions)
+    return g_variant_get_strv (permissions, NULL);
+  else
+    return g_new0 (const char *, 1);
+}
+
+gboolean
+flatpak_db_entry_has_permission (FlatpakDbEntry *entry,
+                                 const char     *app,
+                                 const char     *permission)
+{
+  g_autofree const char **app_permissions = NULL;
+
+  app_permissions = flatpak_db_entry_list_permissions (entry, app);
+
+  return g_strv_contains (app_permissions, permission);
+}
+
+gboolean
+flatpak_db_entry_has_permissions (FlatpakDbEntry *entry,
+                                  const char     *app,
+                                  const char    **permissions)
+{
+  g_autofree const char **app_permissions = NULL;
+  int i;
+
+  app_permissions = flatpak_db_entry_list_permissions (entry, app);
+
+  for (i = 0; permissions[i] != NULL; i++)
+    {
+      if (!g_strv_contains (app_permissions, permissions[i]))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static GVariant *
+make_entry (GVariant *data,
+            GVariant *app_permissions)
+{
+  return g_variant_new ("(v@a{sas})", data, app_permissions);
+}
+
+static GVariant *
+make_empty_app_permissions (void)
+{
+  return g_variant_new_array (G_VARIANT_TYPE ("{sas}"), NULL, 0);
+}
+
+static GVariant *
+make_permissions (const char *app, const char **permissions)
+{
+  static const char **empty = { NULL };
+
+  if (permissions == NULL)
+    permissions = empty;
+
+  return g_variant_new ("{s@as}",
+                        app,
+                        g_variant_new_strv (permissions, -1));
+}
+
+static GVariant *
+add_permissions (GVariant *app_permissions,
+                 GVariant *permissions)
+{
+  GVariantBuilder builder;
+  GVariantIter iter;
+  GVariant *child;
+  gboolean added = FALSE;
+  int cmp;
+  const char *new_app_id;
+  const char *child_app_id;
+
+  g_autoptr(GVariant) new_perms_array = NULL;
+
+  g_variant_get (permissions, "{&s@as}", &new_app_id, &new_perms_array);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+
+  /* Insert or replace permissions in sorted order */
+
+  g_variant_iter_init (&iter, app_permissions);
+  while ((child = g_variant_iter_next_value (&iter)))
+    {
+      g_autoptr(GVariant) old_perms_array = NULL;
+
+      g_variant_get (child, "{&s@as}", &child_app_id, &old_perms_array);
+
+      cmp = strcmp (new_app_id, child_app_id);
+      if (cmp == 0)
+        {
+          added = TRUE;
+          /* Replace old permissions */
+          g_variant_builder_add_value (&builder, permissions);
+        }
+      else if (cmp < 0)
+        {
+          if (!added)
+            {
+              added = TRUE;
+              g_variant_builder_add_value (&builder, permissions);
+            }
+          g_variant_builder_add_value (&builder, child);
+        }
+      else /* cmp > 0 */
+        {
+          g_variant_builder_add_value (&builder, child);
+        }
+
+      g_variant_unref (child);
+    }
+
+  if (!added)
+    g_variant_builder_add_value (&builder, permissions);
+
+  return g_variant_builder_end (&builder);
+}
+
+FlatpakDbEntry  *
+flatpak_db_entry_new (GVariant *data)
+{
+  GVariant *res;
+
+  if (data == NULL)
+    data = g_variant_new_byte (0);
+
+  res = make_entry (data,
+                    make_empty_app_permissions ());
+
+  return (FlatpakDbEntry  *) g_variant_ref_sink (res);
+}
+
+FlatpakDbEntry  *
+flatpak_db_entry_modify_data (FlatpakDbEntry *entry,
+                              GVariant       *data)
+{
+  GVariant *v = (GVariant *) entry;
+  GVariant *res;
+
+  if (data == NULL)
+    data = g_variant_new_byte (0);
+
+  res = make_entry (data,
+                    g_variant_get_child_value (v, 1));
+  return (FlatpakDbEntry  *) g_variant_ref_sink (res);
+}
+
+/* NULL (or empty) permissions to remove permissions */
+FlatpakDbEntry  *
+flatpak_db_entry_set_app_permissions (FlatpakDbEntry *entry,
+                                      const char     *app,
+                                      const char    **permissions)
+{
+  GVariant *v = (GVariant *) entry;
+  GVariant *res;
+
+  g_autoptr(GVariant) old_data_v = g_variant_get_child_value (v, 0);
+  g_autoptr(GVariant) old_data = g_variant_get_child_value (old_data_v, 0);
+  g_autoptr(GVariant) old_permissions = g_variant_get_child_value (v, 1);
+
+  res = make_entry (old_data,
+                    add_permissions (old_permissions,
+                                     make_permissions (app,
+                                                       permissions)));
+  return (FlatpakDbEntry  *) g_variant_ref_sink (res);
+}
+
+GString *
+flatpak_db_entry_print_string (FlatpakDbEntry *entry,
+                               GString        *string)
+{
+  return g_variant_print_string ((GVariant *) entry, string, FALSE);
+}
diff --git a/common/flatpak-db.h b/common/flatpak-db.h
new file mode 100644 (file)
index 0000000..f775785
--- /dev/null
@@ -0,0 +1,103 @@
+/* flatpak-db.h
+ *
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef FLATPAK_DB_H
+#define FLATPAK_DB_H
+
+#include <string.h>
+
+#include "libglnx/libglnx.h"
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct FlatpakDb       FlatpakDb;
+typedef struct _FlatpakDbEntry FlatpakDbEntry;
+
+#define FLATPAK_TYPE_DB (flatpak_db_get_type ())
+#define FLATPAK_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DB, FlatpakDb))
+#define FLATPAK_IS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DB))
+
+GType flatpak_db_get_type (void);
+
+FlatpakDb *     flatpak_db_new (const char *path,
+                                gboolean    fail_if_not_found,
+                                GError    **error);
+char **        flatpak_db_list_ids (FlatpakDb *self);
+char **        flatpak_db_list_apps (FlatpakDb *self);
+char **        flatpak_db_list_ids_by_app (FlatpakDb  *self,
+                                           const char *app);
+char **        flatpak_db_list_ids_by_value (FlatpakDb *self,
+                                             GVariant  *data);
+FlatpakDbEntry *flatpak_db_lookup (FlatpakDb  *self,
+                                   const char *id);
+GString *      flatpak_db_print_string (FlatpakDb *self,
+                                        GString   *string);
+char *         flatpak_db_print (FlatpakDb *self);
+
+gboolean       flatpak_db_is_dirty (FlatpakDb *self);
+void           flatpak_db_set_entry (FlatpakDb      *self,
+                                     const char     *id,
+                                     FlatpakDbEntry *entry);
+void           flatpak_db_update (FlatpakDb *self);
+GBytes *       flatpak_db_get_content (FlatpakDb *self);
+const char *   flatpak_db_get_path (FlatpakDb *self);
+gboolean       flatpak_db_save_content (FlatpakDb *self,
+                                        GError   **error);
+void           flatpak_db_save_content_async (FlatpakDb          *self,
+                                              GCancellable       *cancellable,
+                                              GAsyncReadyCallback callback,
+                                              gpointer            user_data);
+gboolean       flatpak_db_save_content_finish (FlatpakDb    *self,
+                                               GAsyncResult *res,
+                                               GError      **error);
+void           flatpak_db_set_path (FlatpakDb  *self,
+                                    const char *path);
+
+
+FlatpakDbEntry  *flatpak_db_entry_ref (FlatpakDbEntry *entry);
+void            flatpak_db_entry_unref (FlatpakDbEntry *entry);
+GVariant *      flatpak_db_entry_get_data (FlatpakDbEntry *entry);
+const char **   flatpak_db_entry_list_apps (FlatpakDbEntry *entry);
+const char **   flatpak_db_entry_list_permissions (FlatpakDbEntry *entry,
+                                                   const char     *app);
+gboolean        flatpak_db_entry_has_permission (FlatpakDbEntry *entry,
+                                                 const char     *app,
+                                                 const char     *permission);
+gboolean        flatpak_db_entry_has_permissions (FlatpakDbEntry *entry,
+                                                  const char     *app,
+                                                  const char    **permissions);
+GString *       flatpak_db_entry_print_string (FlatpakDbEntry *entry,
+                                               GString        *string);
+
+FlatpakDbEntry  *flatpak_db_entry_new (GVariant *data);
+FlatpakDbEntry  *flatpak_db_entry_modify_data (FlatpakDbEntry *entry,
+                                               GVariant       *data);
+FlatpakDbEntry  *flatpak_db_entry_set_app_permissions (FlatpakDbEntry *entry,
+                                                       const char     *app,
+                                                       const char    **permissions);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDb, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDbEntry, flatpak_db_entry_unref)
+
+G_END_DECLS
+
+#endif /* FLATPAK_DB_H */
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
new file mode 100644 (file)
index 0000000..95715fe
--- /dev/null
@@ -0,0 +1,10766 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ * Copyright © 2017 Endless Mobile, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ *       Philip Withnall <withnall@endlessm.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/file.h>
+#include <sys/types.h>
+#include <utime.h>
+#include <glnx-console.h>
+
+#include <glib/gi18n.h>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include <gio/gio.h>
+#include <gio/gunixsocketaddress.h>
+#include "libglnx/libglnx.h"
+#include "lib/flatpak-error.h"
+#include <ostree.h>
+
+#include "flatpak-dir.h"
+#include "flatpak-utils.h"
+#include "flatpak-oci-registry.h"
+#include "flatpak-run.h"
+
+#include "errno.h"
+
+#define NO_SYSTEM_HELPER ((FlatpakSystemHelper *) (gpointer) 1)
+
+#define SUMMARY_CACHE_TIMEOUT_SEC 5*60
+
+#define SYSCONF_INSTALLATIONS_DIR "installations.d"
+#define SYSCONF_INSTALLATIONS_FILE_EXT ".conf"
+
+#define SYSTEM_DIR_DEFAULT_ID "default"
+#define SYSTEM_DIR_DEFAULT_DISPLAY_NAME "Default system directory"
+#define SYSTEM_DIR_DEFAULT_STORAGE_TYPE FLATPAK_DIR_STORAGE_TYPE_DEFAULT
+#define SYSTEM_DIR_DEFAULT_PRIORITY 0
+
+static FlatpakOciRegistry *flatpak_dir_create_system_child_oci_registry (FlatpakDir   *self,
+                                                                         GLnxLockFile *file_lock,
+                                                                         GError      **error);
+
+static OstreeRepo * flatpak_dir_create_system_child_repo (FlatpakDir   *self,
+                                                          GLnxLockFile *file_lock,
+                                                          const char   *optional_checksum,
+                                                          GError      **error);
+
+static gboolean flatpak_dir_mirror_oci (FlatpakDir          *self,
+                                        FlatpakOciRegistry  *dst_registry,
+                                        const char          *remote,
+                                        const char          *ref,
+                                        const char          *skip_if_current_is,
+                                        OstreeAsyncProgress *progress,
+                                        GCancellable        *cancellable,
+                                        GError             **error);
+
+static gboolean flatpak_dir_remote_fetch_summary (FlatpakDir   *self,
+                                                  const char   *name,
+                                                  GBytes      **out_summary,
+                                                  GBytes      **out_summary_sig,
+                                                  GCancellable *cancellable,
+                                                  GError      **error);
+
+static GVariant *fetch_remote_summary_file (FlatpakDir    *self,
+                                            const char    *remote,
+                                            GBytes       **summary_sig_bytes_out,
+                                            GCancellable  *cancellable,
+                                            GError       **error);
+
+static GVariant * flatpak_create_deploy_data_from_old (GFile        *deploy_dir,
+                                                       GCancellable *cancellable,
+                                                       GError      **error);
+static char * flatpak_dir_lookup_ref_from_summary (FlatpakDir          *self,
+                                                   const char          *remote,
+                                                   const          char *ref,
+                                                   GVariant           **out_variant,
+                                                   GVariant           **out_summary,
+                                                   GCancellable        *cancellable,
+                                                   GError             **error);
+
+typedef struct
+{
+  GBytes *bytes;
+  GBytes *bytes_sig;
+  char *remote;
+  char *url;
+  guint64 time;
+} CachedSummary;
+
+typedef struct
+{
+  char                 *id;
+  char                 *display_name;
+  gint                  priority;
+  FlatpakDirStorageType storage_type;
+} DirExtraData;
+
+struct FlatpakDir
+{
+  GObject              parent;
+
+  gboolean             user;
+  GFile               *basedir;
+  DirExtraData        *extra_data;
+  OstreeRepo          *repo;
+  gboolean             no_system_helper;
+
+  FlatpakSystemHelper *system_helper;
+
+  GHashTable          *summary_cache;
+
+  SoupSession         *soup_session;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakDirClass;
+
+struct FlatpakDeploy
+{
+  GObject         parent;
+
+  GFile          *dir;
+  GKeyFile       *metadata;
+  FlatpakContext *system_overrides;
+  FlatpakContext *user_overrides;
+  FlatpakContext *system_app_overrides;
+  FlatpakContext *user_app_overrides;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakDeployClass;
+
+G_DEFINE_TYPE (FlatpakDir, flatpak_dir, G_TYPE_OBJECT)
+G_DEFINE_TYPE (FlatpakDeploy, flatpak_deploy, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+
+  PROP_USER,
+  PROP_PATH
+};
+
+#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::size,standard::is-symlink,standard::symlink-target," \
+                                   "unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
+
+static const char *
+get_config_dir_location (void)
+{
+  static gsize path = 0;
+
+  if (g_once_init_enter (&path))
+    {
+      gsize setup_value = 0;
+      const char *config_dir = g_getenv ("FLATPAK_CONFIG_DIR");
+      if (config_dir != NULL)
+        setup_value = (gsize)config_dir;
+      else
+        setup_value = (gsize)FLATPAK_CONFIGDIR;
+      g_once_init_leave (&path, setup_value);
+     }
+
+  return (const char *)path;
+}
+
+static DirExtraData *
+dir_extra_data_new (const char           *id,
+                    const char           *display_name,
+                    gint                  priority,
+                    FlatpakDirStorageType type)
+{
+  DirExtraData *dir_extra_data = g_new0 (DirExtraData, 1);
+  dir_extra_data->id = g_strdup (id);
+  dir_extra_data->display_name = g_strdup (display_name);
+  dir_extra_data->priority = priority;
+  dir_extra_data->storage_type = type;
+
+  return dir_extra_data;
+}
+
+static DirExtraData *
+dir_extra_data_clone (DirExtraData *extra_data)
+{
+  if (extra_data != NULL)
+    return dir_extra_data_new (extra_data->id,
+                               extra_data->display_name,
+                               extra_data->priority,
+                               extra_data->storage_type);
+  return NULL;
+}
+
+static void
+dir_extra_data_free (DirExtraData *dir_extra_data)
+{
+  g_free (dir_extra_data->id);
+  g_free (dir_extra_data->display_name);
+  g_free (dir_extra_data);
+}
+
+static GVariant *
+variant_new_ay_bytes (GBytes *bytes)
+{
+  gsize size;
+  gconstpointer data;
+  data = g_bytes_get_data (bytes, &size);
+  g_bytes_ref (bytes);
+  return g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data, size,
+                                                      TRUE, (GDestroyNotify)g_bytes_unref, bytes));
+}
+
+static void
+flatpak_deploy_finalize (GObject *object)
+{
+  FlatpakDeploy *self = FLATPAK_DEPLOY (object);
+
+  g_clear_object (&self->dir);
+  g_clear_pointer (&self->metadata, g_key_file_unref);
+  g_clear_pointer (&self->system_overrides, flatpak_context_free);
+  g_clear_pointer (&self->user_overrides, flatpak_context_free);
+  g_clear_pointer (&self->system_app_overrides, flatpak_context_free);
+  g_clear_pointer (&self->user_app_overrides, flatpak_context_free);
+
+  G_OBJECT_CLASS (flatpak_deploy_parent_class)->finalize (object);
+}
+
+static void
+flatpak_deploy_class_init (FlatpakDeployClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_deploy_finalize;
+
+}
+
+static void
+flatpak_deploy_init (FlatpakDeploy *self)
+{
+}
+
+GFile *
+flatpak_deploy_get_dir (FlatpakDeploy *deploy)
+{
+  return g_object_ref (deploy->dir);
+}
+
+GVariant *
+flatpak_load_deploy_data (GFile *deploy_dir,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_autoptr(GFile) data_file = NULL;
+  g_autoptr(GError) my_error = NULL;
+  char *data = NULL;
+  gsize data_size;
+
+  data_file = g_file_get_child (deploy_dir, "deploy");
+  if (!g_file_load_contents (data_file, cancellable, &data, &data_size, NULL, &my_error))
+    {
+      if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+
+      return flatpak_create_deploy_data_from_old (deploy_dir,
+                                                  cancellable, error);
+    }
+
+  return g_variant_ref_sink (g_variant_new_from_data (FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT,
+                                                      data, data_size,
+                                                      FALSE, g_free, data));
+}
+
+
+GVariant *
+flatpak_deploy_get_deploy_data (FlatpakDeploy *deploy,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  return flatpak_load_deploy_data (deploy->dir,
+                                   cancellable,
+                                   error);
+}
+
+GFile *
+flatpak_deploy_get_files (FlatpakDeploy *deploy)
+{
+  return g_file_get_child (deploy->dir, "files");
+}
+
+FlatpakContext *
+flatpak_deploy_get_overrides (FlatpakDeploy *deploy)
+{
+  FlatpakContext *overrides = flatpak_context_new ();
+
+  if (deploy->system_overrides)
+    flatpak_context_merge (overrides, deploy->system_overrides);
+
+  if (deploy->system_app_overrides)
+    flatpak_context_merge (overrides, deploy->system_app_overrides);
+
+  if (deploy->user_overrides)
+    flatpak_context_merge (overrides, deploy->user_overrides);
+
+  if (deploy->user_app_overrides)
+    flatpak_context_merge (overrides, deploy->user_app_overrides);
+
+  return overrides;
+}
+
+GKeyFile *
+flatpak_deploy_get_metadata (FlatpakDeploy *deploy)
+{
+  return g_key_file_ref (deploy->metadata);
+}
+
+static FlatpakDeploy *
+flatpak_deploy_new (GFile *dir, GKeyFile *metadata)
+{
+  FlatpakDeploy *deploy;
+
+  deploy = g_object_new (FLATPAK_TYPE_DEPLOY, NULL);
+  deploy->dir = g_object_ref (dir);
+  deploy->metadata = g_key_file_ref (metadata);
+
+  return deploy;
+}
+
+GFile *
+flatpak_get_system_default_base_dir_location (void)
+{
+  static gsize path = 0;
+
+  if (g_once_init_enter (&path))
+    {
+      gsize setup_value = 0;
+      const char *system_dir = g_getenv ("FLATPAK_SYSTEM_DIR");
+      if (system_dir != NULL)
+        setup_value = (gsize)system_dir;
+      else
+        setup_value = (gsize)FLATPAK_SYSTEMDIR;
+      g_once_init_leave (&path, setup_value);
+     }
+
+  return g_file_new_for_path ((char *)path);
+}
+
+static FlatpakDirStorageType
+parse_storage_type (const char *type_string)
+{
+  if (type_string != NULL)
+    {
+      g_autofree char *type_low = NULL;
+
+      type_low = g_ascii_strdown (type_string, -1);
+      if (g_strcmp0 (type_low, "mmc") == 0)
+        return FLATPAK_DIR_STORAGE_TYPE_MMC;
+
+      if (g_strcmp0 (type_low, "sdcard") == 0)
+        return FLATPAK_DIR_STORAGE_TYPE_SDCARD;
+
+      if (g_strcmp0 (type_low, "hardisk") == 0)
+        return FLATPAK_DIR_STORAGE_TYPE_HARD_DISK;
+    }
+
+  return FLATPAK_DIR_STORAGE_TYPE_DEFAULT;
+}
+
+static gboolean
+has_system_location (GPtrArray  *locations,
+                     const char *id)
+{
+  int i;
+
+  for (i = 0; i < locations->len; i++)
+    {
+      GFile *path = g_ptr_array_index (locations, i);
+      DirExtraData *extra_data = g_object_get_data (G_OBJECT (path), "extra-data");
+      if (extra_data != NULL && g_strcmp0 (extra_data->id, id) == 0)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+append_new_system_location (GPtrArray            *locations,
+                            GFile                *location,
+                            const char           *id,
+                            const char           *display_name,
+                            FlatpakDirStorageType storage_type,
+                            gint                  priority)
+{
+  DirExtraData *extra_data = NULL;
+
+  extra_data = dir_extra_data_new (id, display_name, priority, storage_type);
+  g_object_set_data_full (G_OBJECT (location), "extra-data", extra_data,
+                          (GDestroyNotify)dir_extra_data_free);
+
+  g_ptr_array_add (locations, location);
+}
+
+static gboolean
+append_locations_from_config_file (GPtrArray    *locations,
+                                   const char   *file_path,
+                                   GCancellable *cancellable,
+                                   GError      **error)
+{
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_auto(GStrv) groups = NULL;
+  g_autoptr(GError) my_error = NULL;
+  gboolean ret = FALSE;
+  gsize n_groups;
+  int i;
+
+  keyfile = g_key_file_new ();
+
+  if (!g_key_file_load_from_file (keyfile, file_path, G_KEY_FILE_NONE, &my_error))
+    {
+      g_debug ("Could not get list of system installations: %s", my_error->message);
+      g_propagate_error (error, g_steal_pointer (&my_error));
+      goto out;
+    }
+
+  /* One configuration file might define more than one installation */
+  groups = g_key_file_get_groups (keyfile, &n_groups);
+  for (i = 0; i < n_groups; i++)
+    {
+      g_autofree char *id = NULL;
+      g_autofree char *path = NULL;
+      size_t len;
+
+      if (!g_str_has_prefix (groups[i], "Installation \""))
+        continue;
+
+      id = g_strdup (&groups[i][14]);
+      if (!g_str_has_suffix (id, "\""))
+        continue;
+
+      len = strlen (id);
+      if (len > 0)
+        id[len - 1] = '\0';
+
+      if (has_system_location (locations, id))
+        {
+          g_warning ("Found duplicate flatpak installation (Id: %s). Ignoring", id);
+          continue;
+        }
+
+      path = g_key_file_get_string (keyfile, groups[i], "Path", &my_error);
+      if (path == NULL)
+        {
+          g_debug ("Unable to get path for installation '%s': %s", id, my_error->message);
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          goto out;
+        }
+      else
+        {
+          GFile *location = NULL;
+          g_autofree char *display_name = NULL;
+          g_autofree char *priority = NULL;
+          g_autofree char *storage_type = NULL;
+          gint priority_val = 0;
+
+          display_name = g_key_file_get_string (keyfile, groups[i], "DisplayName", NULL);
+          priority = g_key_file_get_string (keyfile, groups[i], "Priority", NULL);
+          storage_type = g_key_file_get_string (keyfile, groups[i], "StorageType", NULL);
+
+          if (priority != NULL)
+            priority_val = g_ascii_strtoll (priority, NULL, 10);
+
+          location = g_file_new_for_path (path);
+          append_new_system_location (locations, location, id, display_name,
+                                      parse_storage_type (storage_type),
+                                      priority_val);
+        }
+    }
+
+  ret = TRUE;
+
+ out:
+  return ret;
+}
+
+static gint
+system_locations_compare_func (gconstpointer location_a, gconstpointer location_b)
+{
+  const GFile *location_object_a = *(const GFile **)location_a;
+  const GFile *location_object_b = *(const GFile **)location_b;
+  DirExtraData *extra_data_a = NULL;
+  DirExtraData *extra_data_b = NULL;
+  gint prio_a = 0;
+  gint prio_b = 0;
+
+  extra_data_a = g_object_get_data (G_OBJECT (location_object_a), "extra-data");
+  prio_a = (extra_data_a != NULL) ? extra_data_a->priority : 0;
+
+  extra_data_b = g_object_get_data (G_OBJECT (location_object_b), "extra-data");
+  prio_b = (extra_data_b != NULL) ? extra_data_b->priority : 0;
+
+  return prio_b - prio_a;
+}
+
+static GPtrArray *
+system_locations_from_configuration (GCancellable *cancellable,
+                                     GError      **error)
+{
+  g_autoptr(GPtrArray) locations = NULL;
+  g_autoptr(GFile) conf_dir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GError) my_error = NULL;
+  g_autofree char *config_dir = NULL;
+
+  locations = g_ptr_array_new_with_free_func (g_object_unref);
+  config_dir = g_strdup_printf ("%s/%s",
+                                get_config_dir_location (),
+                                SYSCONF_INSTALLATIONS_DIR);
+
+  if (!g_file_test (config_dir, G_FILE_TEST_IS_DIR))
+    {
+      g_debug ("No installations directory in %s. Skipping", config_dir);
+      goto out;
+    }
+
+  conf_dir = g_file_new_for_path (config_dir);
+  dir_enum = g_file_enumerate_children (conf_dir,
+                                        G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
+                                        G_FILE_QUERY_INFO_NONE,
+                                        cancellable, &my_error);
+  if (my_error != NULL)
+    {
+      g_debug ("Unexpected error retrieving extra installations in %s: %s",
+               config_dir, my_error->message);
+      g_propagate_error (error, g_steal_pointer (&my_error));
+      goto out;
+    }
+
+  while (TRUE)
+    {
+      GFileInfo *file_info;
+      GFile *path;
+      const char *name;
+      guint32 type;
+
+      if (!g_file_enumerator_iterate (dir_enum, &file_info, &path,
+                                      cancellable, &my_error))
+        {
+          g_debug ("Unexpected error reading file in %s: %s",
+                   config_dir, my_error->message);
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          goto out;
+        }
+
+      if (file_info == NULL)
+        break;
+
+      name = g_file_info_get_attribute_byte_string (file_info, "standard::name");
+      type = g_file_info_get_attribute_uint32 (file_info, "standard::type");
+
+      if (type == G_FILE_TYPE_REGULAR && g_str_has_suffix (name, SYSCONF_INSTALLATIONS_FILE_EXT))
+        {
+          g_autofree char *path_str = g_file_get_path (path);
+          if (!append_locations_from_config_file (locations, path_str, cancellable, error))
+            goto out;
+        }
+    }
+
+ out:
+  return g_steal_pointer (&locations);
+}
+
+static GPtrArray *
+get_system_locations (GCancellable *cancellable,
+                      GError      **error)
+{
+  g_autoptr(GPtrArray) locations = NULL;
+
+  /* This will always return a GPtrArray, being an empty one
+   * if no additional system installations have been configured.
+   */
+  locations = system_locations_from_configuration (cancellable, error);
+
+  /* Only fill the details of the default directory if not overriden. */
+  if (!has_system_location (locations, SYSTEM_DIR_DEFAULT_ID))
+    {
+      append_new_system_location (locations,
+                                  flatpak_get_system_default_base_dir_location (),
+                                  SYSTEM_DIR_DEFAULT_ID,
+                                  SYSTEM_DIR_DEFAULT_DISPLAY_NAME,
+                                  SYSTEM_DIR_DEFAULT_STORAGE_TYPE,
+                                  SYSTEM_DIR_DEFAULT_PRIORITY);
+    }
+
+  /* Store the list of system locations sorted according to priorities */
+  g_ptr_array_sort (locations, system_locations_compare_func);
+
+  return g_steal_pointer (&locations);
+}
+
+GPtrArray *
+flatpak_get_system_base_dir_locations (GCancellable *cancellable,
+                                       GError      **error)
+{
+  static gsize array = 0;
+
+  if (g_once_init_enter (&array))
+    {
+      gsize setup_value = 0;
+      setup_value = (gsize) get_system_locations (cancellable, error);
+      g_once_init_leave (&array, setup_value);
+     }
+
+  return (GPtrArray *) array;
+}
+
+GFile *
+flatpak_get_user_base_dir_location (void)
+{
+  static gsize file = 0;
+
+  if (g_once_init_enter (&file))
+    {
+      gsize setup_value = 0;
+      const char *path;
+      g_autofree char *free_me = NULL;
+      const char *user_dir = g_getenv ("FLATPAK_USER_DIR");
+      if (user_dir != NULL && *user_dir != 0)
+        path = user_dir;
+      else
+        path = free_me = g_build_filename (g_get_user_data_dir (), "flatpak", NULL);
+
+      setup_value = (gsize) g_file_new_for_path (path);
+
+      g_once_init_leave (&file, setup_value);
+    }
+
+  return g_object_ref ((GFile *)file);
+}
+
+/* This is a cache directory similar to ~/.cache/flatpak/system-cache,
+ * but in /var/tmp. This is useful for things like the system child
+ * repos, because it is more likely to be on the same filesystem as
+ * the system repo (thus increasing chances for e.g. reflink copying),
+ * and avoids filling the users homedirectory with temporary data.
+ *
+ * In order to re-use this between instances we create a symlink
+ * in /run to it and verify it before use.
+ */
+static GFile *
+flatpak_ensure_system_user_cache_dir_location (GError **error)
+{
+  g_autofree char *path = NULL;
+  g_autofree char *symlink_path = NULL;
+  struct stat st_buf;
+  const char *custom_path = g_getenv ("FLATPAK_SYSTEM_CACHE_DIR");
+
+  if (custom_path != NULL && *custom_path != 0)
+    {
+      if (g_mkdir_with_parents (custom_path, 0755) != 0)
+        {
+          glnx_set_error_from_errno (error);
+          return NULL;
+        }
+
+      return g_file_new_for_path (custom_path);
+    }
+
+  symlink_path = g_build_filename (g_get_user_runtime_dir (), ".flatpak-cache", NULL);
+  path = flatpak_readlink (symlink_path, NULL);
+
+  if (stat (path, &st_buf) == 0 &&
+      /* Must be owned by us */
+      st_buf.st_uid == getuid () &&
+      /* and not writeable by others */
+      (st_buf.st_mode & 0022) == 0)
+    return g_file_new_for_path (path);
+
+  path = g_strdup ("/var/tmp/flatpak-cache-XXXXXX");
+
+  if (g_mkdtemp_full (path, 0755) == NULL)
+    {
+      flatpak_fail (error, "Can't create temporary directory");
+      return NULL;
+    }
+
+  unlink (symlink_path);
+  if (symlink (path, symlink_path) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  return g_file_new_for_path (path);
+}
+
+static GFile *
+flatpak_get_user_cache_dir_location (void)
+{
+  g_autoptr(GFile) base_dir = g_file_new_for_path (g_get_user_cache_dir ());
+
+  return g_file_resolve_relative_path (base_dir, "flatpak/system-cache");
+}
+
+static GFile *
+flatpak_ensure_user_cache_dir_location (GError **error)
+{
+  g_autoptr(GFile) cache_dir = NULL;
+  g_autofree char *cache_path = NULL;
+
+  cache_dir = flatpak_get_user_cache_dir_location ();
+  cache_path = g_file_get_path (cache_dir);
+
+  if (g_mkdir_with_parents (cache_path, 0755) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  return g_steal_pointer (&cache_dir);
+}
+
+static GFile *
+flatpak_ensure_oci_summary_cache_dir_location (GError **error)
+{
+  g_autoptr(GFile) cache_dir = NULL;
+  g_autoptr(GFile) dir = NULL;
+
+  cache_dir = flatpak_get_user_cache_dir_location ();
+  dir = g_file_get_child (cache_dir, "oci-summaries");
+
+  if (g_mkdir_with_parents (flatpak_file_get_path_cached (dir), 0755) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  return g_steal_pointer (&dir);
+}
+
+static FlatpakSystemHelper *
+flatpak_dir_get_system_helper (FlatpakDir *self)
+{
+  g_autoptr(GError) error = NULL;
+
+  if (g_once_init_enter (&self->system_helper))
+    {
+      FlatpakSystemHelper *system_helper;
+      const char *on_session = g_getenv ("FLATPAK_SYSTEM_HELPER_ON_SESSION");
+
+      /* To ensure reverse mapping */
+      flatpak_error_quark ();
+
+      system_helper =
+        flatpak_system_helper_proxy_new_for_bus_sync (on_session != NULL ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
+                                                      G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+                                                      G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+                                                      "org.freedesktop.Flatpak.SystemHelper",
+                                                      "/org/freedesktop/Flatpak/SystemHelper",
+                                                      NULL, &error);
+      if (error != NULL)
+        {
+          g_warning ("Can't find org.freedesktop.Flatpak.SystemHelper: %s", error->message);
+          system_helper = NO_SYSTEM_HELPER;
+        }
+      else
+        {
+          g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (system_helper), G_MAXINT);
+        }
+      g_once_init_leave (&self->system_helper, system_helper);
+    }
+
+  if (self->system_helper != NO_SYSTEM_HELPER)
+    return self->system_helper;
+  return NULL;
+}
+
+static gboolean
+flatpak_dir_use_system_helper (FlatpakDir *self,
+                               const char *installing_from_remote)
+{
+  FlatpakSystemHelper *system_helper;
+
+#ifndef USE_SYSTEM_HELPER
+  if (TRUE)
+    return FALSE;
+#endif
+
+  if (self->no_system_helper || self->user || getuid () == 0)
+    return FALSE;
+
+  /* OCI doesn't do signatures atm, so we can't use the system helper for this */
+  if (installing_from_remote != NULL && flatpak_dir_get_remote_oci (self, installing_from_remote))
+    return FALSE;
+
+  system_helper = flatpak_dir_get_system_helper (self);
+
+  return system_helper != NULL;
+}
+
+static OstreeRepo *
+system_ostree_repo_new (GFile *repodir)
+{
+  g_autofree char *config_dir = NULL;
+
+  config_dir = g_strdup_printf ("%s/%s",
+                                get_config_dir_location (),
+                                "/remotes.d");
+
+  return g_object_new (OSTREE_TYPE_REPO, "path", repodir,
+                       "remotes-config-dir",
+                       config_dir,
+                       NULL);
+}
+
+static void
+flatpak_dir_finalize (GObject *object)
+{
+  FlatpakDir *self = FLATPAK_DIR (object);
+
+  g_clear_object (&self->repo);
+  g_clear_object (&self->basedir);
+  g_clear_pointer (&self->extra_data, dir_extra_data_free);
+
+  if (self->system_helper != NO_SYSTEM_HELPER)
+    g_clear_object (&self->system_helper);
+
+  g_clear_object (&self->soup_session);
+  g_clear_pointer (&self->summary_cache, g_hash_table_unref);
+
+  G_OBJECT_CLASS (flatpak_dir_parent_class)->finalize (object);
+}
+
+static void
+flatpak_dir_set_property (GObject      *object,
+                          guint         prop_id,
+                          const GValue *value,
+                          GParamSpec   *pspec)
+{
+  FlatpakDir *self = FLATPAK_DIR (object);
+
+  switch (prop_id)
+    {
+    case PROP_PATH:
+      /* Canonicalize */
+      self->basedir = g_file_new_for_path (flatpak_file_get_path_cached (g_value_get_object (value)));
+      break;
+
+    case PROP_USER:
+      self->user = g_value_get_boolean (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_dir_get_property (GObject    *object,
+                          guint       prop_id,
+                          GValue     *value,
+                          GParamSpec *pspec)
+{
+  FlatpakDir *self = FLATPAK_DIR (object);
+
+  switch (prop_id)
+    {
+    case PROP_PATH:
+      g_value_set_object (value, self->basedir);
+      break;
+
+    case PROP_USER:
+      g_value_set_boolean (value, self->user);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_dir_class_init (FlatpakDirClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_dir_get_property;
+  object_class->set_property = flatpak_dir_set_property;
+  object_class->finalize = flatpak_dir_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_USER,
+                                   g_param_spec_boolean ("user",
+                                                         "",
+                                                         "",
+                                                         FALSE,
+                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_PATH,
+                                   g_param_spec_object ("path",
+                                                        "",
+                                                        "",
+                                                        G_TYPE_FILE,
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+flatpak_dir_init (FlatpakDir *self)
+{
+  /* Work around possible deadlock due to: https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
+  g_type_ensure (G_TYPE_UNIX_SOCKET_ADDRESS);
+
+  /* Optional data that needs initialization */
+  self->extra_data = NULL;
+}
+
+gboolean
+flatpak_dir_is_user (FlatpakDir *self)
+{
+  return self->user;
+}
+
+void
+flatpak_dir_set_no_system_helper (FlatpakDir *self,
+                                  gboolean    no_system_helper)
+{
+  self->no_system_helper = no_system_helper;
+}
+
+GFile *
+flatpak_dir_get_path (FlatpakDir *self)
+{
+  return self->basedir;
+}
+
+GFile *
+flatpak_dir_get_changed_path (FlatpakDir *self)
+{
+  return g_file_get_child (self->basedir, ".changed");
+}
+
+const char *
+flatpak_dir_get_id (FlatpakDir *self)
+{
+  if (self->extra_data != NULL)
+    return self->extra_data->id;
+
+  return NULL;
+}
+
+char *
+flatpak_dir_get_name (FlatpakDir *self)
+{
+  const char *id = NULL;
+
+  if (self->user)
+    return g_strdup ("user");
+
+  id = flatpak_dir_get_id (self);
+  if (id != NULL && g_strcmp0 (id, "default") != 0)
+    return g_strdup_printf ("system (%s)", id);
+
+  return g_strdup ("system");
+}
+
+const char *
+flatpak_dir_get_display_name (FlatpakDir *self)
+{
+  if (self->extra_data != NULL)
+    return self->extra_data->display_name;
+
+  return NULL;
+}
+
+gint
+flatpak_dir_get_priority (FlatpakDir *self)
+{
+  if (self->extra_data != NULL)
+    return self->extra_data->priority;
+
+  return 0;
+}
+
+FlatpakDirStorageType
+flatpak_dir_get_storage_type (FlatpakDir *self)
+{
+  if (self->extra_data != NULL)
+    return self->extra_data->storage_type;
+
+  return FLATPAK_DIR_STORAGE_TYPE_DEFAULT;
+}
+
+char *
+flatpak_dir_load_override (FlatpakDir *self,
+                           const char *app_id,
+                           gsize      *length,
+                           GError    **error)
+{
+  g_autoptr(GFile) override_dir = NULL;
+  g_autoptr(GFile) file = NULL;
+  char *metadata_contents;
+
+  override_dir = g_file_get_child (self->basedir, "overrides");
+
+  if (app_id)
+    file = g_file_get_child (override_dir, app_id);
+  else
+    file = g_file_get_child (override_dir, "global");
+
+  if (!g_file_load_contents (file, NULL,
+                             &metadata_contents, length, NULL, NULL))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   _("No overrides found for %s"), app_id);
+      return NULL;
+    }
+
+  return metadata_contents;
+}
+
+GKeyFile *
+flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error)
+{
+  g_autofree char *metadata_contents = NULL;
+  gsize metadata_size;
+
+  g_autoptr(GKeyFile) metakey = g_key_file_new ();
+  g_autoptr(FlatpakDir) dir = NULL;
+
+  dir = user ? flatpak_dir_get_user () : flatpak_dir_get_system_default ();
+
+  metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, error);
+  if (metadata_contents == NULL)
+    return NULL;
+
+  if (!g_key_file_load_from_data (metakey,
+                                  metadata_contents,
+                                  metadata_size,
+                                  0, error))
+    return NULL;
+
+  return g_steal_pointer (&metakey);
+}
+
+FlatpakContext *
+flatpak_load_override_file (const char *app_id, gboolean user, GError **error)
+{
+  g_autoptr(FlatpakContext) overrides = flatpak_context_new ();
+
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  metakey = flatpak_load_override_keyfile (app_id, user, &my_error);
+  if (metakey == NULL)
+    {
+      if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+  else
+    {
+      if (!flatpak_context_load_metadata (overrides, metakey, error))
+        return NULL;
+    }
+
+  return g_steal_pointer (&overrides);
+}
+
+gboolean
+flatpak_save_override_keyfile (GKeyFile   *metakey,
+                               const char *app_id,
+                               gboolean    user,
+                               GError    **error)
+{
+  g_autoptr(GFile) base_dir = NULL;
+  g_autoptr(GFile) override_dir = NULL;
+  g_autoptr(GFile) file = NULL;
+  g_autofree char *filename = NULL;
+  g_autofree char *parent = NULL;
+
+  if (user)
+    base_dir = flatpak_get_user_base_dir_location ();
+  else
+    base_dir = flatpak_get_system_default_base_dir_location ();
+
+  override_dir = g_file_get_child (base_dir, "overrides");
+
+  if (app_id)
+    file = g_file_get_child (override_dir, app_id);
+  else
+    file = g_file_get_child (override_dir, "global");
+
+  filename = g_file_get_path (file);
+  parent = g_path_get_dirname (filename);
+  if (g_mkdir_with_parents (parent, 0755))
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  return g_key_file_save_to_file (metakey, filename, error);
+}
+
+/* Note: passing a checksum only works here for non-sub-set deploys, not
+   e.g. a partial locale install, because it will not find the real
+   deploy directory. This is ok for now, because checksum is only
+   currently passed from flatpak_installation_launch() when launching
+   a particular version of an app, which is not used for locales. */
+FlatpakDeploy *
+flatpak_dir_load_deployed (FlatpakDir   *self,
+                           const char   *ref,
+                           const char   *checksum,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_auto(GStrv) ref_parts = NULL;
+  g_autofree char *metadata_contents = NULL;
+  FlatpakDeploy *deploy;
+  gsize metadata_size;
+
+  deploy_dir = flatpak_dir_get_if_deployed (self, ref, checksum, cancellable);
+  if (deploy_dir == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s not installed"), ref);
+      return NULL;
+    }
+
+  metadata = g_file_get_child (deploy_dir, "metadata");
+  if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, error))
+    return NULL;
+
+  metakey = g_key_file_new ();
+  if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
+    return NULL;
+
+  deploy = flatpak_deploy_new (deploy_dir, metakey);
+
+  ref_parts = g_strsplit (ref, "/", -1);
+  g_assert (g_strv_length (ref_parts) == 4);
+
+  /* Only load system global overrides for system installed apps */
+  if (!self->user)
+    {
+      deploy->system_overrides = flatpak_load_override_file (NULL, FALSE, error);
+      if (deploy->system_overrides == NULL)
+        return NULL;
+    }
+
+  /* Always load user global overrides */
+  deploy->user_overrides = flatpak_load_override_file (NULL, TRUE, error);
+  if (deploy->user_overrides == NULL)
+    return NULL;
+
+  /* Only apps have app overrides */
+  if (strcmp (ref_parts[0], "app") == 0)
+    {
+      /* Only load system overrides for system installed apps */
+      if (!self->user)
+        {
+          deploy->system_app_overrides = flatpak_load_override_file (ref_parts[1], FALSE, error);
+          if (deploy->system_app_overrides == NULL)
+            return NULL;
+        }
+
+      /* Always load user overrides */
+      deploy->user_app_overrides = flatpak_load_override_file (ref_parts[1], TRUE, error);
+      if (deploy->user_app_overrides == NULL)
+        return NULL;
+    }
+
+  return deploy;
+}
+
+GFile *
+flatpak_dir_get_deploy_dir (FlatpakDir *self,
+                            const char *ref)
+{
+  return g_file_resolve_relative_path (self->basedir, ref);
+}
+
+char *
+flatpak_dir_get_deploy_subdir (FlatpakDir *self,
+                               const char *checksum,
+                               const char * const * subpaths)
+{
+  if (subpaths == NULL || *subpaths == NULL)
+    return g_strdup (checksum);
+  else
+    {
+      GString *str = g_string_new (checksum);
+      int i;
+      for (i = 0; subpaths[i] != NULL; i++)
+        {
+          const char *s = subpaths[i];
+          g_string_append_c (str, '-');
+          while (*s)
+            {
+              if (*s != '/')
+                g_string_append_c (str, *s);
+              s++;
+            }
+        }
+      return g_string_free (str, FALSE);
+    }
+}
+
+GFile *
+flatpak_dir_get_unmaintained_extension_dir (FlatpakDir *self,
+                                            const char *name,
+                                            const char *arch,
+                                            const char *branch)
+{
+  const char *unmaintained_ref;
+
+  unmaintained_ref = g_build_filename ("extension", name, arch, branch, NULL);
+  return g_file_resolve_relative_path (self->basedir, unmaintained_ref);
+}
+
+GFile *
+flatpak_dir_get_exports_dir (FlatpakDir *self)
+{
+  return g_file_get_child (self->basedir, "exports");
+}
+
+GFile *
+flatpak_dir_get_removed_dir (FlatpakDir *self)
+{
+  return g_file_get_child (self->basedir, ".removed");
+}
+
+OstreeRepo *
+flatpak_dir_get_repo (FlatpakDir *self)
+{
+  return self->repo;
+}
+
+
+/* This is an exclusive per flatpak installation file lock that is taken
+ * whenever any config in the directory outside the repo is to be changed. For
+ * instance deployments, overrides or active commit changes.
+ *
+ * For concurrency protection of the actual repository we rely on ostree
+ * to do the right thing.
+ */
+gboolean
+flatpak_dir_lock (FlatpakDir   *self,
+                  GLnxLockFile *lockfile,
+                  GCancellable *cancellable,
+                  GError      **error)
+{
+  g_autoptr(GFile) lock_file = g_file_get_child (flatpak_dir_get_path (self), "lock");
+  g_autofree char *lock_path = g_file_get_path (lock_file);
+
+  return glnx_make_lock_file (AT_FDCWD, lock_path, LOCK_EX, lockfile, error);
+}
+
+
+/* This is an lock that protects the repo itself. Any operation that
+ * relies on objects not disappearing from the repo need to hold this
+ * in a non-exclusive mode, while anything that can remove objects
+ * (i.e. prune) need to take it in exclusive mode.
+ *
+ * The following operations depends on objects not disappearing:
+ *  * pull into a staging directory (pre-existing objects are not downloaded)
+ *  * moving a staging directory into the repo (no ref keeps the object alive during copy)
+ *  * Deploying a ref (a parallel update + prune could cause objects to be removed)
+ *
+ * In practice this means we hold a shared lock during deploy and
+ * pull, and an excusive lock during prune.
+ */
+gboolean
+flatpak_dir_repo_lock (FlatpakDir   *self,
+                       GLnxLockFile *lockfile,
+                       int           operation,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  g_autoptr(GFile) lock_file = g_file_get_child (flatpak_dir_get_path (self), "repo-lock");
+  g_autofree char *lock_path = g_file_get_path (lock_file);
+
+  return glnx_make_lock_file (AT_FDCWD, lock_path, operation, lockfile, error);
+}
+
+
+const char *
+flatpak_deploy_data_get_origin (GVariant *deploy_data)
+{
+  const char *origin;
+
+  g_variant_get_child (deploy_data, 0, "&s", &origin);
+  return origin;
+}
+
+const char *
+flatpak_deploy_data_get_commit (GVariant *deploy_data)
+{
+  const char *commit;
+
+  g_variant_get_child (deploy_data, 1, "&s", &commit);
+  return commit;
+}
+
+const char *
+flatpak_deploy_data_get_alt_id (GVariant *deploy_data)
+{
+  g_autoptr(GVariant) metadata = g_variant_get_child_value (deploy_data, 4);
+  const char *alt_id = NULL;
+
+  g_variant_lookup (metadata, "alt-id", "&s", &alt_id);
+
+  return alt_id;
+}
+
+/**
+ * flatpak_deploy_data_get_subpaths:
+ *
+ * Returns: (array length=length zero-terminated=1) (transfer container): an array of constant strings
+ **/
+const char **
+flatpak_deploy_data_get_subpaths (GVariant *deploy_data)
+{
+  const char **subpaths;
+
+  g_variant_get_child (deploy_data, 2, "^a&s", &subpaths);
+  return subpaths;
+}
+
+guint64
+flatpak_deploy_data_get_installed_size (GVariant *deploy_data)
+{
+  guint64 size;
+
+  g_variant_get_child (deploy_data, 3, "t", &size);
+  return GUINT64_FROM_BE (size);
+}
+
+static GVariant *
+flatpak_dir_new_deploy_data (const char *origin,
+                             const char *commit,
+                             char      **subpaths,
+                             guint64     installed_size,
+                             GVariant   *metadata)
+{
+  char *empty_subpaths[] = {NULL};
+  GVariantBuilder builder;
+
+  if (metadata == NULL)
+    {
+      g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+      metadata = g_variant_builder_end (&builder);
+    }
+
+  return g_variant_ref_sink (g_variant_new ("(ss^ast@a{sv})",
+                                            origin,
+                                            commit,
+                                            subpaths ? subpaths : empty_subpaths,
+                                            GUINT64_TO_BE (installed_size),
+                                            metadata));
+}
+
+static char **
+get_old_subpaths (GFile        *deploy_base,
+                  GCancellable *cancellable,
+                  GError      **error)
+{
+  g_autoptr(GFile) file = NULL;
+  g_autofree char *data = NULL;
+  g_autoptr(GError) my_error = NULL;
+  g_autoptr(GPtrArray) subpaths = NULL;
+  g_auto(GStrv) lines = NULL;
+  int i;
+
+  file = g_file_get_child (deploy_base, "subpaths");
+  if (!g_file_load_contents (file, cancellable, &data, NULL, NULL, &my_error))
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          data = g_strdup ("");
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+
+  lines = g_strsplit (data, "\n", 0);
+
+  subpaths = g_ptr_array_new ();
+  for (i = 0; lines[i] != NULL; i++)
+    {
+      lines[i] = g_strstrip (lines[i]);
+      if (lines[i][0] == '/')
+        g_ptr_array_add (subpaths, g_strdup (lines[i]));
+    }
+
+  g_ptr_array_add (subpaths, NULL);
+  return (char **) g_ptr_array_free (subpaths, FALSE);
+}
+
+static GVariant *
+flatpak_create_deploy_data_from_old (GFile        *deploy_dir,
+                                     GCancellable *cancellable,
+                                     GError      **error)
+{
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autofree char *old_origin = NULL;
+  g_autofree char *commit = NULL;
+  g_auto(GStrv) old_subpaths = NULL;
+  g_autoptr(GFile) origin = NULL;
+  guint64 installed_size;
+
+  deploy_base = g_file_get_parent (deploy_dir);
+  commit = g_file_get_basename (deploy_dir);
+
+  origin = g_file_get_child (deploy_base, "origin");
+  if (!g_file_load_contents (origin, cancellable, &old_origin, NULL, NULL, error))
+    return NULL;
+
+  old_subpaths = get_old_subpaths (deploy_base, cancellable, error);
+  if (old_subpaths == NULL)
+    return NULL;
+
+  /* For backwards compat we return a 0 installed size, its to slow to regenerate */
+  installed_size = 0;
+
+  return flatpak_dir_new_deploy_data (old_origin, commit, old_subpaths,
+                                      installed_size, NULL);
+}
+
+GVariant *
+flatpak_dir_get_deploy_data (FlatpakDir   *self,
+                             const char   *ref,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(GFile) deploy_dir = NULL;
+
+  deploy_dir = flatpak_dir_get_if_deployed (self, ref, NULL, cancellable);
+  if (deploy_dir == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s not installed"), ref);
+      return NULL;
+    }
+
+  return flatpak_load_deploy_data (deploy_dir,
+                                   cancellable,
+                                   error);
+}
+
+
+char *
+flatpak_dir_get_origin (FlatpakDir   *self,
+                        const char   *ref,
+                        GCancellable *cancellable,
+                        GError      **error)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                             cancellable, error);
+  if (deploy_data == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s not installed"), ref);
+      return NULL;
+    }
+
+  return g_strdup (flatpak_deploy_data_get_origin (deploy_data));
+}
+
+char **
+flatpak_dir_get_subpaths (FlatpakDir   *self,
+                          const char   *ref,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+  char **subpaths;
+  int i;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                             cancellable, error);
+  if (deploy_data == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s not installed"), ref);
+      return NULL;
+    }
+
+  subpaths = (char **) flatpak_deploy_data_get_subpaths (deploy_data);
+  for (i = 0; subpaths[i] != NULL; i++)
+    subpaths[i] = g_strdup (subpaths[i]);
+
+  return subpaths;
+}
+
+gboolean
+flatpak_dir_ensure_path (FlatpakDir   *self,
+                         GCancellable *cancellable,
+                         GError      **error)
+{
+  /* In the system case, we use default perms */
+  if (!self->user)
+    return flatpak_mkdir_p (self->basedir, cancellable, error);
+  else
+    {
+      /* First make the parent */
+      g_autoptr(GFile) parent = g_file_get_parent (self->basedir);
+      if (!flatpak_mkdir_p (parent, cancellable, error))
+        return FALSE;
+      glnx_autofd int parent_dfd = -1;
+      if (!glnx_opendirat (AT_FDCWD, flatpak_file_get_path_cached (parent), TRUE,
+                           &parent_dfd, error))
+        return FALSE;
+      g_autofree char *name = g_file_get_basename (self->basedir);
+      /* Use 0700 in the user case to neuter any suid or world-writable
+       * bits that happen to be in content; see
+       * https://github.com/flatpak/flatpak/pull/837
+       */
+      if (mkdirat (parent_dfd, name, 0700) < 0)
+        {
+          if (errno == EEXIST)
+            {
+              /* And fix up any existing installs that had too-wide perms */
+              struct stat stbuf;
+              if (fstatat (parent_dfd, name, &stbuf, 0) < 0)
+                return glnx_throw_errno_prefix (error, "fstatat");
+              if (stbuf.st_mode & S_IXOTH)
+                {
+                  if (fchmodat (parent_dfd, name, 0700, 0) < 0)
+                    return glnx_throw_errno_prefix (error, "fchmodat");
+                }
+            }
+          else
+            return glnx_throw_errno_prefix (error, "mkdirat");
+        }
+
+      return TRUE;
+    }
+}
+
+/* Warning: This is not threadsafe, don't use in libflatpak */
+gboolean
+flatpak_dir_recreate_repo (FlatpakDir   *self,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  gboolean res;
+  OstreeRepo *old_repo = g_steal_pointer (&self->repo);
+  res = flatpak_dir_ensure_repo (self, cancellable, error);
+  g_clear_object (&old_repo);
+  return res;
+}
+
+static gboolean
+_flatpak_dir_ensure_repo (FlatpakDir   *self,
+                          gboolean      allow_empty,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_autoptr(GFile) repodir = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  g_autoptr(GError) my_error = NULL;
+  gboolean use_helper = FALSE;
+
+  if (self->repo == NULL)
+    {
+      if (!flatpak_dir_ensure_path (self, cancellable, &my_error))
+        {
+          if (allow_empty)
+            return TRUE;
+
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return FALSE;
+        }
+
+      repodir = g_file_get_child (self->basedir, "repo");
+      if (self->no_system_helper || self->user || getuid () == 0)
+        {
+          repo = system_ostree_repo_new (repodir);
+        }
+      else
+        {
+          g_autoptr(GFile) cache_dir = NULL;
+          g_autofree char *cache_path = NULL;
+
+          repo = system_ostree_repo_new (repodir);
+          use_helper = TRUE;
+
+          cache_dir = flatpak_ensure_user_cache_dir_location (error);
+          if (cache_dir == NULL)
+            return FALSE;
+
+          cache_path = g_file_get_path (cache_dir);
+          if (!ostree_repo_set_cache_dir (repo,
+                                          AT_FDCWD, cache_path,
+                                          cancellable, error))
+            return FALSE;
+        }
+
+      if (!g_file_query_exists (repodir, cancellable))
+        {
+          OstreeRepoMode mode = OSTREE_REPO_MODE_BARE_USER_ONLY;
+          const char *mode_env = g_getenv ("FLATPAK_OSTREE_REPO_MODE");
+
+          if (g_strcmp0 (mode_env, "user-only") == 0)
+            mode = OSTREE_REPO_MODE_BARE_USER_ONLY;
+          if (g_strcmp0 (mode_env, "user") == 0)
+            mode = OSTREE_REPO_MODE_BARE_USER;
+
+          if (!ostree_repo_create (repo, mode, cancellable, &my_error))
+            {
+              flatpak_rm_rf (repodir, cancellable, NULL);
+
+              if (allow_empty)
+                return TRUE;
+
+              g_propagate_error (error, g_steal_pointer (&my_error));
+              return FALSE;
+            }
+
+          /* Create .changes file early to avoid polling non-existing file in monitor */
+          flatpak_dir_mark_changed (self, NULL);
+        }
+      else
+        {
+          if (!ostree_repo_open (repo, cancellable, error))
+            {
+              g_autofree char *repopath = NULL;
+
+              repopath = g_file_get_path (repodir);
+              g_prefix_error (error, _("While opening repository %s: "), repopath);
+              return FALSE;
+            }
+        }
+
+      /* Reset min-free-space-percent to 0, this keeps being a problem for a lot of people */
+      if (!use_helper)
+        {
+          GKeyFile *orig_config = NULL;
+          g_autofree char *orig_min_free_space_percent = NULL;
+
+          orig_config = ostree_repo_get_config (repo);
+          orig_min_free_space_percent = g_key_file_get_value (orig_config, "core", "min-free-space-percent", NULL);
+          if (orig_min_free_space_percent == NULL)
+            {
+              GKeyFile *config = ostree_repo_copy_config (repo);
+
+              g_key_file_set_string (config, "core", "min-free-space-percent", "0");
+              if (!ostree_repo_write_config (repo, config, error))
+                return FALSE;
+
+              if (!ostree_repo_reload_config (repo, cancellable, error))
+                return FALSE;
+            }
+        }
+
+      /* Make sure we didn't reenter weirdly */
+      g_assert (self->repo == NULL);
+      self->repo = g_object_ref (repo);
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_ensure_repo (FlatpakDir   *self,
+                         GCancellable *cancellable,
+                         GError      **error)
+{
+  return _flatpak_dir_ensure_repo (self, FALSE, cancellable, error);
+}
+
+gboolean
+flatpak_dir_maybe_ensure_repo (FlatpakDir   *self,
+                               GCancellable *cancellable,
+                               GError      **error)
+{
+  return _flatpak_dir_ensure_repo (self, TRUE, cancellable, error);
+}
+
+char *
+flatpak_dir_get_config (FlatpakDir *self,
+                        const char *key,
+                        GError    **error)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *ostree_key = g_strconcat ("xa.", key, NULL);
+
+  return g_key_file_get_string (config, "core", ostree_key, error);
+}
+
+gboolean
+flatpak_dir_set_config (FlatpakDir *self,
+                        const char *key,
+                        const char *value,
+                        GError    **error)
+{
+  GKeyFile *config = ostree_repo_copy_config (self->repo);
+  g_autofree char *ostree_key = g_strconcat ("xa.", key, NULL);
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      FlatpakSystemHelper *system_helper;
+      FlatpakHelperConfigureFlags flags = 0;
+      const char *installation = flatpak_dir_get_id (self);
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      if (value == NULL)
+       {
+         flags |= FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET;
+         value = "";
+       }
+
+      g_debug ("Calling system helper: Configure");
+      if (!flatpak_system_helper_call_configure_sync (system_helper,
+                                                     flags, key, value,
+                                                     installation ? installation : "",
+                                                     NULL, error))
+        return FALSE;
+
+      return TRUE;
+    }
+
+  if (value == NULL)
+    g_key_file_remove_key (config, "core", ostree_key, NULL);
+  else
+    g_key_file_set_value (config, "core", ostree_key, value);
+
+  if (!ostree_repo_write_config (self->repo, config, error))
+    return FALSE;
+
+  if (!ostree_repo_reload_config (self->repo, NULL, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_mark_changed (FlatpakDir *self,
+                          GError    **error)
+{
+  g_autoptr(GFile) changed_file = NULL;
+
+  changed_file = flatpak_dir_get_changed_path (self);
+  if (!g_file_replace_contents (changed_file, "", 0, NULL, FALSE,
+                                G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_remove_appstream (FlatpakDir   *self,
+                              const char   *remote,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  g_autoptr(GFile) appstream_dir = NULL;
+  g_autoptr(GFile) remote_dir = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  appstream_dir = g_file_get_child (flatpak_dir_get_path (self), "appstream");
+  remote_dir = g_file_get_child (appstream_dir, remote);
+
+  if (g_file_query_exists (remote_dir, cancellable) &&
+      !flatpak_rm_rf (remote_dir, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_deploy_appstream (FlatpakDir          *self,
+                              const char          *remote,
+                              const char          *arch,
+                              gboolean            *out_changed,
+                              GCancellable        *cancellable,
+                              GError             **error)
+{
+  g_autoptr(GFile) appstream_dir = NULL;
+  g_autoptr(GFile) remote_dir = NULL;
+  g_autoptr(GFile) arch_dir = NULL;
+  g_autoptr(GFile) checkout_dir = NULL;
+  g_autoptr(GFile) real_checkout_dir = NULL;
+  g_autoptr(GFile) timestamp_file = NULL;
+  g_autofree char *arch_path = NULL;
+  gboolean checkout_exists;
+  g_autofree char *remote_and_branch = NULL;
+  const char *old_checksum = NULL;
+  g_autofree char *new_checksum = NULL;
+  g_autoptr(GFile) active_link = NULL;
+  g_autofree char *branch = NULL;
+  g_autoptr(GFile) old_checkout_dir = NULL;
+  g_autoptr(GFile) active_tmp_link = NULL;
+  g_autoptr(GError) tmp_error = NULL;
+  g_autofree char *checkout_dir_path = NULL;
+  OstreeRepoCheckoutAtOptions options = { 0, };
+  glnx_autofd int dfd = -1;
+  g_autoptr(GFileInfo) file_info = NULL;
+  g_autofree char *tmpname = g_strdup (".active-XXXXXX");
+  g_auto(GLnxLockFile) lock = { 0, };
+
+  /* Keep a shared repo lock to avoid prunes removing objects we're relying on
+   * while we do the checkout. This could happen if the ref changes after we
+   * read its current value for the checkout. */
+  if (!flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error))
+    return FALSE;
+
+  appstream_dir = g_file_get_child (flatpak_dir_get_path (self), "appstream");
+  remote_dir = g_file_get_child (appstream_dir, remote);
+  arch_dir = g_file_get_child (remote_dir, arch);
+  active_link = g_file_get_child (arch_dir, "active");
+  timestamp_file = g_file_get_child (arch_dir, ".timestamp");
+
+  arch_path = g_file_get_path (arch_dir);
+  if (g_mkdir_with_parents (arch_path, 0755) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  if (!glnx_opendirat (AT_FDCWD, arch_path, TRUE, &dfd, error))
+    return FALSE;
+
+  old_checksum = NULL;
+  file_info = g_file_query_info (active_link, OSTREE_GIO_FAST_QUERYINFO,
+                                 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                 cancellable, NULL);
+  if (file_info != NULL)
+    old_checksum =  g_file_info_get_symlink_target (file_info);
+
+  branch = g_strdup_printf ("appstream/%s", arch);
+  remote_and_branch = g_strdup_printf ("%s:%s", remote, branch);
+  if (!ostree_repo_resolve_rev (self->repo, remote_and_branch, TRUE, &new_checksum, error))
+    return FALSE;
+
+  real_checkout_dir = g_file_get_child (arch_dir, new_checksum);
+  checkout_exists = g_file_query_exists (real_checkout_dir, NULL);
+
+  if (old_checksum != NULL && new_checksum != NULL &&
+      strcmp (old_checksum, new_checksum) == 0 &&
+      checkout_exists)
+    {
+      if (!g_file_replace_contents (timestamp_file, "", 0, NULL, FALSE,
+                                    G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, error))
+        return FALSE;
+
+      if (out_changed)
+        *out_changed = FALSE;
+
+      return TRUE; /* No changes, don't checkout */
+    }
+
+  {
+    g_autofree char *template = g_strdup_printf (".%s-XXXXXX", new_checksum);
+    g_autoptr(GFile) tmp_dir_template = g_file_get_child (arch_dir, template);
+    checkout_dir_path = g_file_get_path (tmp_dir_template);
+    if (g_mkdtemp_full (checkout_dir_path, 0755) == NULL)
+      {
+        g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                     _("Can't create deploy directory"));
+        return FALSE;
+      }
+  }
+  checkout_dir = g_file_new_for_path (checkout_dir_path);
+
+  options.mode = OSTREE_REPO_CHECKOUT_MODE_USER;
+  options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES;
+  options.enable_fsync = FALSE; /* We checkout to a temp dir and sync before moving it in place */
+  options.bareuseronly_dirs = TRUE; /* https://github.com/ostreedev/ostree/pull/927 */
+
+  if (!ostree_repo_checkout_at (self->repo, &options,
+                                AT_FDCWD, checkout_dir_path, new_checksum,
+                                cancellable, error))
+    return FALSE;
+
+  glnx_gen_temp_name (tmpname);
+  active_tmp_link = g_file_get_child (arch_dir, tmpname);
+
+  if (!g_file_make_symbolic_link (active_tmp_link, new_checksum, cancellable, error))
+    return FALSE;
+
+  if (syncfs (dfd) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  /* By now the checkout to the temporary directory is on disk, as is the temporary
+     symlink pointing to the final target. */
+
+  if (!g_file_move (checkout_dir, real_checkout_dir, G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
+                    cancellable, NULL, NULL, error))
+    return FALSE;
+
+  if (syncfs (dfd) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  if (!flatpak_file_rename (active_tmp_link,
+                            active_link,
+                            cancellable, error))
+    return FALSE;
+
+  if (old_checksum != NULL &&
+      g_strcmp0 (old_checksum, new_checksum) != 0)
+    {
+      old_checkout_dir = g_file_get_child (arch_dir, old_checksum);
+      if (!flatpak_rm_rf (old_checkout_dir, cancellable, &tmp_error))
+        g_warning ("Unable to remove old appstream checkout: %s", tmp_error->message);
+    }
+
+  if (!g_file_replace_contents (timestamp_file, "", 0, NULL, FALSE,
+                                G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, error))
+    return FALSE;
+
+  /* If we added a new checkout, touch the toplevel dir to tell people that they need
+     to re-scan */
+  if (!checkout_exists)
+    {
+      g_autofree char *appstream_dir_path = g_file_get_path (appstream_dir);
+      utime (appstream_dir_path, NULL);
+    }
+
+  if (out_changed)
+    *out_changed = TRUE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_check_for_appstream_update (FlatpakDir          *self,
+                                        const char          *remote,
+                                        const char          *arch)
+{
+  const char *old_checksum = NULL;
+  g_autofree char *new_checksum = NULL;
+  g_autoptr(GFile) active_link = NULL;
+  g_autofree char *branch = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
+
+  if (!flatpak_dir_maybe_ensure_repo (self, NULL, NULL))
+    return TRUE;
+
+  active_link = flatpak_build_file (flatpak_dir_get_path (self),
+                                     "appstream",
+                                     remote,
+                                     arch,
+                                     "active",
+                                     NULL);
+
+  file_info = g_file_query_info (active_link, OSTREE_GIO_FAST_QUERYINFO,
+                                 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                 NULL, NULL);
+  if (file_info != NULL)
+    old_checksum =  g_file_info_get_symlink_target (file_info);
+
+  branch = g_strdup_printf ("appstream/%s", arch);
+
+  new_checksum = flatpak_dir_lookup_ref_from_summary (self, remote, branch,
+                                                      NULL, NULL, NULL, NULL);
+  if (new_checksum == NULL)
+    {
+      g_debug ("No %s branch for remote %s, ignoring", branch, remote);
+      return FALSE; /* No appstream branch, don't update, no error */
+    }
+
+  return g_strcmp0 (new_checksum, old_checksum) != 0;
+}
+
+gboolean
+flatpak_dir_update_appstream (FlatpakDir          *self,
+                              const char          *remote,
+                              const char          *arch,
+                              gboolean            *out_changed,
+                              OstreeAsyncProgress *progress,
+                              GCancellable        *cancellable,
+                              GError             **error)
+{
+  g_autofree char *branch = NULL;
+  g_autofree char *remote_and_branch = NULL;
+  g_autofree char *new_checksum = NULL;
+  const char *installation;
+
+  if (out_changed)
+    *out_changed = FALSE;
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  branch = g_strdup_printf ("appstream/%s", arch);
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      g_auto(GLnxLockFile) child_repo_lock = { 0, };
+      FlatpakSystemHelper *system_helper;
+      gboolean is_oci;
+      g_autoptr(GFile) child_repo_file = NULL;
+      g_autofree char *child_repo_path = NULL;
+
+      system_helper = flatpak_dir_get_system_helper (self);
+
+      g_assert (system_helper != NULL);
+
+      is_oci = flatpak_dir_get_remote_oci (self, remote);
+
+      if (is_oci)
+        {
+          g_autoptr(FlatpakOciRegistry) registry = NULL;
+          g_autoptr(GError) local_error = NULL;
+          g_autofree char *latest_alt_commit = NULL;
+          G_GNUC_UNUSED g_autofree char *latest_commit =
+            flatpak_dir_read_latest (self, remote, branch, &latest_alt_commit, cancellable, NULL);
+
+          registry = flatpak_dir_create_system_child_oci_registry (self, &child_repo_lock, error);
+          if (registry == NULL)
+            return FALSE;
+
+          child_repo_file = g_file_new_for_uri (flatpak_oci_registry_get_uri (registry));
+
+          if (!flatpak_dir_mirror_oci (self, registry, remote, branch, latest_alt_commit, progress, cancellable, &local_error))
+            {
+              if (g_error_matches (local_error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
+                return TRUE;
+              else
+                {
+                  g_propagate_error (error, g_steal_pointer (&local_error));
+                  return FALSE;
+                }
+            }
+        }
+      else
+        {
+          g_autoptr(GBytes) summary_copy = NULL;
+          g_autoptr(GBytes) summary_sig_copy = NULL;
+          g_autoptr(GFile) summary_file = NULL;
+          g_autoptr(GFile) summary_sig_file = NULL;
+
+          g_autoptr(OstreeRepo) child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, NULL, error);
+          if (child_repo == NULL)
+            return FALSE;
+
+          if (!flatpak_dir_remote_fetch_summary (self, remote,
+                                                 &summary_copy, &summary_sig_copy,
+                                                 cancellable, error))
+            return FALSE;
+
+          /* No need to use an existing OstreeRepoFinderResult array, since
+           * appstream updates do not need to be atomic wrt other updates. */
+          if (!flatpak_dir_pull (self, remote, branch, NULL, NULL, NULL,
+                                 child_repo, FLATPAK_PULL_FLAGS_NONE, OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 progress, cancellable, error))
+            return FALSE;
+
+          summary_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary");
+          if (!g_file_replace_contents (summary_file,
+                                        g_bytes_get_data (summary_copy, NULL),
+                                        g_bytes_get_size (summary_copy),
+                                        NULL, FALSE, 0, NULL, cancellable, NULL))
+            return FALSE;
+
+          summary_sig_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary.sig");
+          if (!g_file_replace_contents (summary_sig_file,
+                                        g_bytes_get_data (summary_sig_copy, NULL),
+                                        g_bytes_get_size (summary_sig_copy),
+                                        NULL, FALSE, 0, NULL, cancellable, NULL))
+            return FALSE;
+
+          if (!ostree_repo_resolve_rev (child_repo, branch, TRUE, &new_checksum, error))
+            return FALSE;
+
+          child_repo_file = g_object_ref (ostree_repo_get_path (child_repo));
+        }
+
+      child_repo_path = g_file_get_path (child_repo_file);
+
+      installation = flatpak_dir_get_id (self);
+
+      g_debug ("Calling system helper: DeployAppstream");
+      if (!flatpak_system_helper_call_deploy_appstream_sync (system_helper,
+                                                             child_repo_path,
+                                                             remote,
+                                                             arch,
+                                                             installation ? installation : "",
+                                                             cancellable,
+                                                             error))
+        return FALSE;
+
+      (void) flatpak_rm_rf (child_repo_file, NULL, NULL);
+
+      return TRUE;
+    }
+
+  /* No need to use an existing OstreeRepoFinderResult array, since
+   * appstream updates do not need to be atomic wrt other updates. */
+  if (!flatpak_dir_pull (self, remote, branch, NULL, NULL, NULL, NULL, FLATPAK_PULL_FLAGS_NONE, OSTREE_REPO_PULL_FLAGS_NONE, progress,
+                         cancellable, error))
+    return FALSE;
+
+  remote_and_branch = g_strdup_printf ("%s:%s", remote, branch);
+
+  if (!ostree_repo_resolve_rev (self->repo, remote_and_branch, TRUE, &new_checksum, error))
+    return FALSE;
+
+  return flatpak_dir_deploy_appstream (self,
+                                       remote,
+                                       arch,
+                                       out_changed,
+                                       cancellable,
+                                       error);
+}
+
+#ifdef FLATPAK_ENABLE_P2P
+static void
+async_result_cb (GObject      *obj,
+                 GAsyncResult *result,
+                 gpointer      user_data)
+{
+  GAsyncResult **result_out = user_data;
+  *result_out = g_object_ref (result);
+}
+#endif  /* FLATPAK_ENABLE_P2P */
+
+static void
+default_progress_changed (OstreeAsyncProgress *progress,
+                          gpointer             user_data)
+{
+  guint outstanding_extra_data;
+  guint64 transferred_extra_data_bytes;
+  guint64 total_extra_data_bytes;
+
+  outstanding_extra_data = ostree_async_progress_get_uint (progress, "outstanding-extra-data");
+  total_extra_data_bytes = ostree_async_progress_get_uint64 (progress, "total-extra-data-bytes");
+  transferred_extra_data_bytes = ostree_async_progress_get_uint64 (progress, "transferred-extra-data-bytes");
+
+  if (outstanding_extra_data > 0)
+    {
+      g_autofree char *transferred = g_format_size (transferred_extra_data_bytes);
+      g_autofree char *total = g_format_size (total_extra_data_bytes);
+      g_autofree char *line = g_strdup_printf ("Downloading extra data %s/%s", transferred, total);
+      glnx_console_text (line);
+    }
+  else
+    ostree_repo_pull_default_console_progress_changed (progress, user_data);
+}
+
+/* Get the configured collection-id for @remote_name, squashing empty strings into
+ * %NULL. Return %TRUE if the ID was fetched successfully, or if it was unset or
+ * empty. */
+static gboolean
+repo_get_remote_collection_id (OstreeRepo  *repo,
+                               const char  *remote_name,
+                               char       **collection_id_out,
+                               GError     **error)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  if (collection_id_out != NULL)
+    {
+      if (!ostree_repo_get_remote_option (repo, remote_name, "collection-id",
+                                          NULL, collection_id_out, error))
+        return FALSE;
+      if (*collection_id_out != NULL && **collection_id_out == '\0')
+        g_clear_pointer (collection_id_out, g_free);
+    }
+#else  /* if !FLATPAK_ENABLE_P2P */
+  if (collection_id_out != NULL)
+    *collection_id_out = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+  return TRUE;
+}
+
+/* Get options for the OSTree pull operation which can be shared between
+ * collection-based and normal pulls. Update @builder in place. */
+static void
+get_common_pull_options (GVariantBuilder     *builder,
+                         const gchar * const *dirs_to_pull,
+                         gboolean             force_disable_deltas,
+                         OstreeRepoPullFlags  flags,
+                         OstreeAsyncProgress *progress)
+{
+  guint32 update_freq = 0;
+
+  if (dirs_to_pull)
+    {
+      g_variant_builder_add (builder, "{s@v}", "subdirs",
+                             g_variant_new_variant (g_variant_new_strv ((const char * const *)dirs_to_pull, -1)));
+      force_disable_deltas = TRUE;
+    }
+
+  if (force_disable_deltas)
+    {
+      g_variant_builder_add (builder, "{s@v}", "disable-static-deltas",
+                             g_variant_new_variant (g_variant_new_boolean (TRUE)));
+    }
+
+  g_variant_builder_add (builder, "{s@v}", "inherit-transaction",
+                         g_variant_new_variant (g_variant_new_boolean (TRUE)));
+
+  g_variant_builder_add (builder, "{s@v}", "flags",
+                         g_variant_new_variant (g_variant_new_int32 (flags)));
+
+  if (progress != NULL)
+    update_freq = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "update-frequency"));
+  if (update_freq == 0)
+    update_freq = FLATPAK_DEFAULT_UPDATE_FREQUENCY;
+
+  g_variant_builder_add (builder, "{s@v}", "update-frequency",
+                         g_variant_new_variant (g_variant_new_uint32 (update_freq)));
+}
+
+/* This is a copy of ostree_repo_pull_one_dir that always disables
+   static deltas if subdir is used */
+static gboolean
+repo_pull_one_dir (OstreeRepo          *self,
+                   const char          *remote_name,
+                   const char         **dirs_to_pull,
+                   const char          *ref_to_fetch,
+                   const char          *rev_to_fetch,
+                   const OstreeRepoFinderResult * const *results_to_fetch,
+                   FlatpakPullFlags     flatpak_flags,
+                   OstreeRepoPullFlags  flags,
+                   OstreeAsyncProgress *progress,
+                   GCancellable        *cancellable,
+                   GError             **error)
+{
+  gboolean force_disable_deltas = (flatpak_flags & FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS) != 0;
+  g_autofree char *remote_and_branch = NULL;
+  g_autofree char *current_checksum = NULL;
+  g_autoptr(GVariant) old_commit = NULL;
+  g_autoptr(GVariant) new_commit = NULL;
+  const char *revs_to_fetch[2];
+  gboolean res = FALSE;
+  g_autofree gchar *collection_id = NULL;
+
+  /* If @results_to_fetch is set, @rev_to_fetch must be. */
+  g_assert (results_to_fetch == NULL || rev_to_fetch != NULL);
+
+  /* We always want this on for every type of pull */
+  flags |= OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES;
+
+  if (!repo_get_remote_collection_id (self, remote_name, &collection_id, NULL))
+    g_clear_pointer (&collection_id, g_free);
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (collection_id != NULL)
+    {
+      GVariantBuilder find_builder, pull_builder;
+      g_autoptr(GVariant) find_options = NULL, pull_options = NULL;
+      g_autoptr(GMainContext) context = NULL;
+      g_autoptr(GAsyncResult) find_result = NULL, pull_result = NULL;
+      g_auto(OstreeRepoFinderResultv) results = NULL;
+      OstreeCollectionRef collection_ref;
+      OstreeCollectionRef *collection_refs_to_fetch[2];
+      guint32 update_freq = 0;
+
+      /* Find options */
+      g_variant_builder_init (&find_builder, G_VARIANT_TYPE ("a{sv}"));
+
+      if (force_disable_deltas)
+        {
+          g_variant_builder_add (&find_builder, "{s@v}", "disable-static-deltas",
+                                 g_variant_new_variant (g_variant_new_boolean (TRUE)));
+        }
+
+      collection_ref.collection_id = collection_id;
+      collection_ref.ref_name = (char *) ref_to_fetch;
+
+      collection_refs_to_fetch[0] = &collection_ref;
+      collection_refs_to_fetch[1] = NULL;
+
+      if (progress != NULL)
+        update_freq = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "update-frequency"));
+      if (update_freq == 0)
+        update_freq = FLATPAK_DEFAULT_UPDATE_FREQUENCY;
+
+      g_variant_builder_add (&find_builder, "{s@v}", "update-frequency",
+                             g_variant_new_variant (g_variant_new_uint32 (update_freq)));
+
+      find_options = g_variant_ref_sink (g_variant_builder_end (&find_builder));
+
+      /* Pull options */
+      g_variant_builder_init (&pull_builder, G_VARIANT_TYPE ("a{sv}"));
+      get_common_pull_options (&pull_builder, dirs_to_pull,
+                               force_disable_deltas, flags, progress);
+      pull_options = g_variant_ref_sink (g_variant_builder_end (&pull_builder));
+
+      context = g_main_context_new ();
+      g_main_context_push_thread_default (context);
+
+      if (results_to_fetch == NULL)
+        {
+          ostree_repo_find_remotes_async (self, (const OstreeCollectionRef * const *) collection_refs_to_fetch,
+                                          find_options,
+                                          NULL  /* default finders */, progress, cancellable,
+                                          async_result_cb, &find_result);
+
+          while (find_result == NULL)
+            g_main_context_iteration (context, TRUE);
+
+          results = ostree_repo_find_remotes_finish (self, find_result, error);
+          results_to_fetch = (const OstreeRepoFinderResult * const *) results;
+        }
+
+      if (results_to_fetch != NULL)
+        {
+          ostree_repo_pull_from_remotes_async (self, results_to_fetch,
+                                               pull_options, progress,
+                                               cancellable, async_result_cb,
+                                               &pull_result);
+
+          while (pull_result == NULL)
+            g_main_context_iteration (context, TRUE);
+
+          res = ostree_repo_pull_from_remotes_finish (self, pull_result, error);
+        }
+      else
+        res = FALSE;
+
+      g_main_context_pop_thread_default (context);
+    }
+  else
+    res = FALSE;
+
+  if (!res)
+    {
+      if (error != NULL && *error != NULL)
+        g_debug ("Failed to pull using find-remotes; falling back to normal pull: %s", (*error)->message);
+      g_clear_error (error);
+    }
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (!res)
+    {
+      GVariantBuilder builder;
+      g_autoptr(GVariant) options = NULL;
+      const char *refs_to_fetch[2];
+
+      /* Pull options */
+      g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+      get_common_pull_options (&builder, dirs_to_pull,
+                               force_disable_deltas, flags, progress);
+
+      refs_to_fetch[0] = ref_to_fetch;
+      refs_to_fetch[1] = NULL;
+      g_variant_builder_add (&builder, "{s@v}", "refs",
+                             g_variant_new_variant (g_variant_new_strv ((const char * const *) refs_to_fetch, -1)));
+
+      revs_to_fetch[0] = rev_to_fetch;
+      revs_to_fetch[1] = NULL;
+      g_variant_builder_add (&builder, "{s@v}", "override-commit-ids",
+                             g_variant_new_variant (g_variant_new_strv ((const char * const *) revs_to_fetch, -1)));
+
+      options = g_variant_ref_sink (g_variant_builder_end (&builder));
+
+      remote_and_branch = g_strdup_printf ("%s:%s", remote_name, ref_to_fetch);
+      if (!ostree_repo_resolve_rev (self, remote_and_branch, TRUE, &current_checksum, error))
+        return FALSE;
+      if (current_checksum != NULL &&
+          !ostree_repo_load_commit (self, current_checksum, &old_commit, NULL, error))
+        return FALSE;
+
+      if (!ostree_repo_pull_with_options (self, remote_name, options,
+                                          progress, cancellable, error))
+        return FALSE;
+    }
+
+  if (old_commit &&
+      (flatpak_flags & FLATPAK_PULL_FLAGS_ALLOW_DOWNGRADE) == 0)
+    {
+      guint64 old_timestamp;
+      guint64 new_timestamp;
+
+      if (!ostree_repo_load_commit (self, rev_to_fetch, &new_commit, NULL, error))
+        return FALSE;
+
+      old_timestamp = ostree_commit_get_timestamp (old_commit);
+      new_timestamp = ostree_commit_get_timestamp (new_commit);
+
+      if (new_timestamp < old_timestamp)
+        return flatpak_fail (error, "Update is older then current version");
+    }
+
+  return TRUE;
+}
+
+static void
+ensure_soup_session (FlatpakDir *self)
+{
+  if (g_once_init_enter (&self->soup_session))
+    {
+      SoupSession *soup_session;
+
+      soup_session = flatpak_create_soup_session (PACKAGE_STRING);
+
+      if (g_getenv ("OSTREE_DEBUG_HTTP"))
+        soup_session_add_feature (soup_session, (SoupSessionFeature *) soup_logger_new (SOUP_LOGGER_LOG_BODY, 500));
+
+      g_once_init_leave (&self->soup_session, soup_session);
+    }
+}
+
+typedef struct {
+  OstreeAsyncProgress *progress;
+  guint64 previous_dl;
+} ExtraDataProgress;
+
+static void
+extra_data_progress_report (guint64 downloaded_bytes,
+                            gpointer user_data)
+{
+  ExtraDataProgress *extra_progress = user_data;
+
+  if (extra_progress->progress)
+    ostree_async_progress_set_uint64 (extra_progress->progress, "transferred-extra-data-bytes",
+                                      extra_progress->previous_dl + downloaded_bytes);
+
+}
+
+static gboolean
+flatpak_dir_setup_extra_data (FlatpakDir           *self,
+                              OstreeRepo           *repo,
+                              const char           *repository,
+                              const char           *ref,
+                              const char           *rev,
+                              const OstreeRepoFinderResult * const *results,
+                              FlatpakPullFlags      flatpak_flags,
+                              OstreeAsyncProgress  *progress,
+                              GCancellable         *cancellable,
+                              GError              **error)
+{
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  int i;
+  gsize n_extra_data;
+  guint64 total_download_size;
+
+  /* If @results is set, @rev must be. */
+  g_assert (results == NULL || rev != NULL);
+
+  extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
+  if (extra_data_sources == NULL)
+    {
+      /* Pull the commits (and only the commits) to check for extra data
+       * again. Here we don't pass the progress because we don't want any
+       * reports coming out of it. */
+      if (!repo_pull_one_dir (repo, repository,
+                              NULL,
+                              ref,
+                              rev,
+                              results,
+                              flatpak_flags,
+                              OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY,
+                              NULL,
+                              cancellable,
+                              error))
+        return FALSE;
+
+      extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
+    }
+
+  n_extra_data = 0;
+  total_download_size = 0;
+
+  if (extra_data_sources != NULL)
+    n_extra_data = g_variant_n_children (extra_data_sources);
+
+  if (n_extra_data > 0)
+    {
+      if ((flatpak_flags & FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA) == 0)
+        return flatpak_fail (error, "extra data not supported for non-gpg-verified local system installs");
+
+      for (i = 0; i < n_extra_data; i++)
+        {
+          guint64 download_size;
+
+          flatpak_repo_parse_extra_data_sources (extra_data_sources, i,
+                                                 NULL,
+                                                 &download_size,
+                                                 NULL,
+                                                 NULL,
+                                                 NULL);
+
+          total_download_size += download_size;
+        }
+    }
+
+  if (progress)
+    {
+      ostree_async_progress_set (progress,
+                                 "outstanding-extra-data", "u", n_extra_data,
+                                 "total-extra-data", "u", n_extra_data,
+                                 "total-extra-data-bytes", "t", total_download_size,
+                                 "transferred-extra-data-bytes", "t", (guint64) 0,
+                                 "downloading-extra-data", "u", 0,
+                                 NULL);
+    }
+
+  return TRUE;
+}
+
+static inline void
+reset_async_progress_extra_data (OstreeAsyncProgress *progress)
+{
+  if (progress)
+    ostree_async_progress_set_uint (progress, "downloading-extra-data", 0);
+}
+
+static gboolean
+flatpak_dir_pull_extra_data (FlatpakDir          *self,
+                             OstreeRepo          *repo,
+                             const char          *repository,
+                             const char          *ref,
+                             const char          *rev,
+                             FlatpakPullFlags     flatpak_flags,
+                             OstreeAsyncProgress *progress,
+                             GCancellable        *cancellable,
+                             GError             **error)
+{
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  g_autoptr(GVariant) detached_metadata = NULL;
+  g_auto(GVariantDict) new_metadata_dict = FLATPAK_VARIANT_DICT_INITIALIZER;
+  g_autoptr(GVariantBuilder) extra_data_builder = NULL;
+  g_autoptr(GVariant) new_detached_metadata = NULL;
+  g_autoptr(GVariant) extra_data = NULL;
+  g_autoptr(GFile) base_dir = NULL;
+  int i;
+  gsize n_extra_data;
+  ExtraDataProgress extra_data_progress = { NULL };
+
+  extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, cancellable, NULL);
+  if (extra_data_sources == NULL)
+    return TRUE;
+
+  n_extra_data = g_variant_n_children (extra_data_sources);
+  if (n_extra_data == 0)
+    return TRUE;
+
+  if ((flatpak_flags & FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA) == 0)
+    return flatpak_fail (error, "extra data not supported for non-gpg-verified local system installs");
+
+  extra_data_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(ayay)"));
+
+  /* Other fields were already set in flatpak_dir_setup_extra_data() */
+  if (progress)
+    {
+      ostree_async_progress_set (progress,
+                                 "start-time-extra-data", "t", g_get_monotonic_time (),
+                                 "downloading-extra-data", "u", 1,
+                                 NULL);
+    }
+
+  extra_data_progress.progress = progress;
+
+  base_dir = flatpak_get_user_base_dir_location ();
+
+  for (i = 0; i < n_extra_data; i++)
+    {
+      const char *extra_data_uri = NULL;
+      g_autofree char *extra_data_sha256 = NULL;
+      const char *extra_data_name = NULL;
+      guint64 download_size;
+      guint64 installed_size;
+      g_autofree char *sha256 = NULL;
+      const guchar *sha256_bytes;
+      g_autoptr(GBytes) bytes = NULL;
+      g_autoptr(GFile) extra_local_file = NULL;
+
+      flatpak_repo_parse_extra_data_sources (extra_data_sources, i,
+                                             &extra_data_name,
+                                             &download_size,
+                                             &installed_size,
+                                             &sha256_bytes,
+                                             &extra_data_uri);
+
+      if (sha256_bytes == NULL)
+        return flatpak_fail (error, _("Invalid sha256 for extra data uri %s"), extra_data_uri);
+
+      extra_data_sha256 = ostree_checksum_from_bytes (sha256_bytes);
+
+      if (*extra_data_name == 0)
+        return flatpak_fail (error, _("Empty name for extra data uri %s"), extra_data_uri);
+
+      /* Don't allow file uris here as that could read local files based on remote data */
+      if (!g_str_has_prefix (extra_data_uri, "http:") &&
+          !g_str_has_prefix (extra_data_uri, "https:"))
+        {
+          reset_async_progress_extra_data (progress);
+          return flatpak_fail (error, _("Unsupported extra data uri %s"), extra_data_uri);
+        }
+
+      /* TODO: Download to disk to support resumed downloads on error */
+
+      extra_local_file = flatpak_build_file (base_dir, "extra-data", extra_data_sha256, extra_data_name, NULL);
+      if (g_file_query_exists (extra_local_file, cancellable))
+        {
+          g_debug ("Loading extra-data from local file %s", g_file_get_path (extra_local_file));
+          gsize extra_local_size;
+          g_autofree char *extra_local_contents = NULL;
+          g_autoptr(GError) my_error = NULL;
+
+          if (!g_file_load_contents (extra_local_file, cancellable, &extra_local_contents, &extra_local_size, NULL, &my_error))
+            return flatpak_fail (error, _("Failed to load local extra-data %s: %s"),
+                                 flatpak_file_get_path_cached (extra_local_file), my_error->message);
+          if (extra_local_size != download_size)
+            return flatpak_fail (error, _("Wrong size for extra-data %s"), flatpak_file_get_path_cached (extra_local_file));
+
+          bytes = g_bytes_new (extra_local_contents, extra_local_size);
+        }
+      else
+        {
+          ensure_soup_session (self);
+          bytes = flatpak_load_http_uri (self->soup_session, extra_data_uri, 0, NULL, NULL,
+                                         extra_data_progress_report, &extra_data_progress,
+                                         cancellable, error);
+        }
+
+      if (bytes == NULL)
+        {
+          reset_async_progress_extra_data (progress);
+          g_prefix_error (error, _("While downloading %s: "), extra_data_uri);
+          return FALSE;
+        }
+
+      if (g_bytes_get_size (bytes) != download_size)
+        {
+          reset_async_progress_extra_data (progress);
+          return flatpak_fail (error, _("Wrong size for extra data %s"), extra_data_uri);
+        }
+
+      extra_data_progress.previous_dl += download_size;
+      if (progress)
+        ostree_async_progress_set_uint (progress, "outstanding-extra-data", n_extra_data - i - 1);
+
+      sha256 = g_compute_checksum_for_bytes (G_CHECKSUM_SHA256, bytes);
+      if (strcmp (sha256, extra_data_sha256) != 0)
+        {
+          reset_async_progress_extra_data (progress);
+          return flatpak_fail (error, _("Invalid checksum for extra data %s"), extra_data_uri);
+        }
+
+      g_variant_builder_add (extra_data_builder,
+                             "(^ay@ay)",
+                             extra_data_name,
+                             g_variant_new_from_bytes (G_VARIANT_TYPE ("ay"), bytes, TRUE));
+    }
+
+  extra_data = g_variant_ref_sink (g_variant_builder_end (extra_data_builder));
+
+  reset_async_progress_extra_data (progress);
+
+  if (!ostree_repo_read_commit_detached_metadata (repo, rev, &detached_metadata,
+                                                  cancellable, error))
+    return FALSE;
+
+  g_variant_dict_init (&new_metadata_dict, detached_metadata);
+  g_variant_dict_insert_value (&new_metadata_dict, "xa.extra-data", extra_data);
+  new_detached_metadata = g_variant_ref_sink (g_variant_dict_end (&new_metadata_dict));
+
+  /* There is a commitmeta size limit when pulling, so we have to side-load it
+     when installing in the system repo */
+  if (flatpak_flags & FLATPAK_PULL_FLAGS_SIDELOAD_EXTRA_DATA)
+    {
+      int dfd =  ostree_repo_get_dfd (repo);
+      g_autoptr(GVariant) normalized = g_variant_get_normal_form (new_detached_metadata);
+      gsize normalized_size = g_variant_get_size (normalized);
+      const guint8 *data = g_variant_get_data (normalized);
+      g_autofree char *filename = NULL;
+
+      filename = g_strconcat (rev, ".commitmeta", NULL);
+      if (!glnx_file_replace_contents_at (dfd, filename,
+                                          data, normalized_size,
+                                          0, cancellable, error))
+        {
+          g_prefix_error (error, "Unable to write sideloaded detached metadata: ");
+          return FALSE;
+        }
+    }
+  else
+    {
+      if (!ostree_repo_write_commit_detached_metadata (repo, rev, new_detached_metadata,
+                                                       cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static char *
+lookup_oci_registry_uri_from_summary (GVariant *summary,
+                                      GError **error)
+{
+  g_autoptr(GVariant) extensions = g_variant_get_child_value (summary, 1);
+  g_autofree char *registry_uri = NULL;
+
+  if (!g_variant_lookup (extensions, "xa.oci-registry-uri", "s", &registry_uri))
+    {
+      flatpak_fail (error, _("Remote OCI index has no registry uri"));
+      return NULL;
+    }
+
+  return g_steal_pointer (&registry_uri);
+}
+
+static char *
+flatpak_dir_lookup_ref_from_summary (FlatpakDir          *self,
+                                     const char          *remote,
+                                     const          char *ref,
+                                     GVariant           **out_variant,
+                                     GVariant           **out_summary,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  g_autoptr(GVariant) summary = NULL;
+  g_autofree char *latest_rev = NULL;
+  g_autofree char *collection_id = NULL;
+
+  summary = fetch_remote_summary_file (self, remote, NULL, cancellable, error);
+  if (summary == NULL)
+    return NULL;
+
+  /* Derive the collection ID from the remote we are querying. This will act as
+   * a sanity check on the summary ref lookup. */
+  if (!repo_get_remote_collection_id (self->repo, remote, &collection_id, error))
+    return FALSE;
+
+  if (!flatpak_summary_lookup_ref (summary, collection_id, ref, &latest_rev, out_variant))
+    {
+      flatpak_fail (error, "No such ref '%s' in remote %s", ref, remote);
+      return NULL;
+    }
+
+  if (out_summary)
+    *out_summary = g_steal_pointer (&summary);
+
+  return g_steal_pointer (&latest_rev);
+}
+
+static void
+oci_pull_init_progress (OstreeAsyncProgress *progress)
+{
+  guint64 start_time = g_get_monotonic_time () - 2;
+
+  if (progress == NULL)
+    return;
+
+  ostree_async_progress_set (progress,
+                             "outstanding-fetches", "u", 0,
+                             "outstanding-writes", "u", 0,
+                             "fetched", "u", 0,
+                             "requested", "u", 0,
+                             "scanning", "u", 0,
+                             "scanned-metadata", "u", 0,
+                             "bytes-transferred", "t", (guint64) 0,
+                             "start-time", "t", start_time,
+                             "outstanding-metadata-fetches", "u", 0,
+                             "metadata-fetched", "u", 0,
+                             "outstanding-extra-data", "u", 0,
+                             "total-extra-data", "u", 0,
+                             "total-extra-data-bytes", "t", (guint64) 0,
+                             "transferred-extra-data-bytes", "t", (guint64) 0,
+                             "downloading-extra-data", "u", 0,
+                             "fetched-delta-parts", "u", 0,
+                             "total-delta-parts", "u", 0,
+                             "fetched-delta-fallbacks", "u", 0,
+                             "total-delta-fallbacks", "u", 0,
+                             "fetched-delta-part-size", "t", (guint64) 0,
+                             "total-delta-part-size", "t", (guint64) 0,
+                             "total-delta-part-usize", "t", (guint64) 0,
+                             "total-delta-superblocks", "u", 0,
+                             "status", "s", "",
+                             NULL);
+}
+
+static void
+oci_pull_progress_cb (guint64 total_size, guint64 pulled_size,
+                      guint32 n_layers, guint32 pulled_layers,
+                      gpointer data)
+{
+  OstreeAsyncProgress *progress = data;
+
+  if (progress == NULL)
+    return;
+
+  /* Deltas */
+  ostree_async_progress_set (progress,
+                             "outstanding-fetches", "u", n_layers - pulled_layers,
+                             "fetched-delta-parts", "u", pulled_layers,
+                             "total-delta-parts", "u", n_layers,
+                             "fetched-delta-fallbacks", "u", 0,
+                             "total-delta-fallbacks", "u", 0,
+                             "fetched-delta-part-size", "t", pulled_size,
+                             "total-delta-part-size", "t", total_size,
+                             "total-delta-part-usize", "t", total_size,
+                             "total-delta-superblocks", "u", 0,
+                             NULL);
+}
+
+/* Look up a piece of per-repository metadata. Previously, this was stored in
+ * the summary file; now it’s stored the commit metadata of a special branch.
+ * Differentiate based on whether the collection ID is set for the remote.
+ * Returns %FALSE on error or if @key doesn’t exist (in which case, no error is
+ * set). */
+gboolean
+flatpak_dir_lookup_repo_metadata (FlatpakDir    *self,
+                                  const char    *remote_name,
+                                  GCancellable  *cancellable,
+                                  GError       **error,
+                                  const char    *key,
+                                  const char    *format_string,
+                                  ...)
+{
+  va_list args;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autoptr(GVariant) value = NULL;
+  g_autofree char *collection_id = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+    return FALSE;
+
+  if (collection_id == NULL)
+    {
+      g_autoptr(GVariant) summary_v = NULL;
+
+      summary_v = fetch_remote_summary_file (self, remote_name, NULL, cancellable, error);
+      if (summary_v == NULL)
+        return FALSE;
+
+      metadata = g_variant_get_child_value (summary_v, 1);
+    }
+  else
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      g_autofree char *latest_rev = NULL;
+      g_autoptr(GVariant) commit_v = NULL;
+
+      /* Make sure the branch is up to date. */
+      if (!flatpak_dir_fetch_remote_repo_metadata (self, remote_name, cancellable, error))
+        return FALSE;
+
+      /* Look up the commit containing the latest repository metadata. */
+      latest_rev = flatpak_dir_lookup_ref_from_summary (self, remote_name,
+                                                        OSTREE_REPO_METADATA_REF,
+                                                        NULL, NULL,
+                                                        cancellable, error);
+      if (latest_rev == NULL)
+        return FALSE;
+
+      if (!ostree_repo_load_commit (self->repo, latest_rev, &commit_v, NULL, error))
+        return FALSE;
+
+      metadata = g_variant_get_child_value (commit_v, 0);
+#else  /* if !FLATPAK_ENABLE_P2P */
+      g_assert_not_reached ();
+#endif  /* !FLATPAK_ENABLE_P2P */
+    }
+
+  /* Extract the metadata from it, if set. */
+  value = g_variant_lookup_value (metadata, key, NULL);
+
+  if (value == NULL)
+    return FALSE;
+  if (!g_variant_check_format_string (value, format_string, FALSE))
+    return FALSE;
+
+  va_start (args, format_string);
+  g_variant_get_va (value, format_string, NULL, &args);
+  va_end (args);
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_dir_mirror_oci (FlatpakDir          *self,
+                        FlatpakOciRegistry  *dst_registry,
+                        const char          *remote,
+                        const char          *ref,
+                        const char          *skip_if_current_is,
+                        OstreeAsyncProgress *progress,
+                        GCancellable        *cancellable,
+                        GError             **error)
+{
+  g_autoptr(FlatpakOciRegistry) registry = NULL;
+  g_autofree char *oci_uri = NULL;
+  g_autofree char *registry_uri = NULL;
+  g_autofree char *oci_digest = NULL;
+  g_autofree char *latest_rev = NULL;
+  g_auto(GLnxConsoleRef) console = { 0, };
+  g_autoptr(OstreeAsyncProgress) console_progress = NULL;
+  g_autoptr(GVariant) summary_element = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *oci_repository = NULL;
+  gboolean res;
+
+  if (!ostree_repo_remote_get_url (self->repo,
+                                   remote,
+                                   &oci_uri,
+                                   error))
+    return FALSE;
+
+  /* We use the summary so that we can reuse any cached json */
+  latest_rev = flatpak_dir_lookup_ref_from_summary (self, remote, ref, &summary_element, &summary,
+                                                    cancellable, error);
+  if (latest_rev == NULL)
+    return FALSE;
+
+  if (skip_if_current_is != NULL && strcmp (latest_rev, skip_if_current_is) == 0)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                   _("%s commit %s already installed"), ref, latest_rev);
+      return FALSE;
+    }
+
+  metadata = g_variant_get_child_value (summary_element, 2);
+  g_variant_lookup (metadata, "xa.oci-repository", "s", &oci_repository);
+
+  oci_digest = g_strconcat ("sha256:", latest_rev, NULL);
+
+  registry_uri = lookup_oci_registry_uri_from_summary (summary, error);
+  if (registry_uri == NULL)
+    return FALSE;
+
+  registry = flatpak_oci_registry_new (registry_uri, FALSE, -1, NULL, error);
+  if (registry == NULL)
+    return FALSE;
+
+  if (progress == NULL)
+    {
+      glnx_console_lock (&console);
+      if (console.is_tty)
+        {
+          console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
+          progress = console_progress;
+        }
+    }
+
+  oci_pull_init_progress (progress);
+
+  g_debug ("Mirroring OCI image %s", oci_digest);
+
+  res = flatpak_mirror_image_from_oci (dst_registry, registry, oci_repository, oci_digest, oci_pull_progress_cb,
+                                       progress, cancellable, error);
+
+  if (progress)
+    ostree_async_progress_finish (progress);
+
+  if (!res)
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_dir_pull_oci (FlatpakDir          *self,
+                      const char          *remote,
+                      const char          *ref,
+                      OstreeRepo          *repo,
+                      FlatpakPullFlags     flatpak_flags,
+                      OstreeRepoPullFlags  flags,
+                      OstreeAsyncProgress *progress,
+                      GCancellable        *cancellable,
+                      GError             **error)
+{
+  g_autoptr(FlatpakOciRegistry) registry = NULL;
+  g_autoptr(FlatpakOciVersioned) versioned = NULL;
+  g_autofree char *full_ref = NULL;
+  g_autofree char *oci_uri = NULL;
+  g_autofree char *registry_uri = NULL;
+  g_autofree char *oci_repository = NULL;
+  g_autofree char *oci_digest = NULL;
+  g_autofree char *checksum = NULL;
+  g_auto(GLnxConsoleRef) console = { 0, };
+  g_autoptr(OstreeAsyncProgress) console_progress = NULL;
+  g_autoptr(GVariant) summary_element = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autofree char *latest_alt_commit = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *latest_rev = NULL;
+  G_GNUC_UNUSED g_autofree char *latest_commit =
+    flatpak_dir_read_latest (self, remote, ref, &latest_alt_commit, cancellable, NULL);
+
+  /* This doesn't support specifying a specific digest, because that can't work
+     with OCI signatures. We need to get that from the index */
+  if (!ostree_repo_remote_get_url (self->repo,
+                                   remote,
+                                   &oci_uri,
+                                   error))
+    return FALSE;
+
+  /* We use the summary so that we can reuse any cached json */
+  latest_rev =
+    flatpak_dir_lookup_ref_from_summary (self, remote, ref, &summary_element, &summary,
+                                         cancellable, error);
+  if (latest_rev == NULL)
+    return FALSE;
+
+  metadata = g_variant_get_child_value (summary_element, 2);
+  g_variant_lookup (metadata, "xa.oci-repository", "s", &oci_repository);
+
+  oci_digest = g_strconcat ("sha256:", latest_rev, NULL);
+
+  /* Short circuit if we've already got this commit */
+  if (latest_alt_commit != NULL && strcmp (oci_digest + strlen ("sha256:"), latest_alt_commit) == 0)
+    return TRUE;
+
+  registry_uri = lookup_oci_registry_uri_from_summary (summary, error);
+  if (registry_uri == NULL)
+    return FALSE;
+
+  registry = flatpak_oci_registry_new (registry_uri, FALSE, -1, NULL, error);
+  if (registry == NULL)
+    return FALSE;
+
+  versioned = flatpak_oci_registry_load_versioned (registry, oci_repository, oci_digest,
+                                                  NULL, cancellable, error);
+  if (versioned == NULL)
+    return FALSE;
+
+  if (!FLATPAK_IS_OCI_MANIFEST (versioned))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Image is not a manifest");
+      return FALSE;
+    }
+
+  full_ref = g_strdup_printf ("%s:%s", remote, ref);
+
+  if (repo == NULL)
+    repo = self->repo;
+
+  if (progress == NULL)
+    {
+      glnx_console_lock (&console);
+      if (console.is_tty)
+        {
+          console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
+          progress = console_progress;
+        }
+    }
+
+  oci_pull_init_progress (progress);
+
+  g_debug ("Pulling OCI image %s", oci_digest);
+
+  checksum = flatpak_pull_from_oci (repo, registry, oci_repository, oci_digest, FLATPAK_OCI_MANIFEST (versioned),
+                                    remote, ref, oci_pull_progress_cb, progress, cancellable, error);
+
+  if (progress)
+    ostree_async_progress_finish (progress);
+
+  if (checksum == NULL)
+    return FALSE;
+
+  g_debug ("Imported OCI image as checksum %s", checksum);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_pull (FlatpakDir          *self,
+                  const char          *repository,
+                  const char          *ref,
+                  const char          *opt_rev,
+                  const OstreeRepoFinderResult * const *opt_results,
+                  const char         **subpaths,
+                  OstreeRepo          *repo,
+                  FlatpakPullFlags     flatpak_flags,
+                  OstreeRepoPullFlags  flags,
+                  OstreeAsyncProgress *progress,
+                  GCancellable        *cancellable,
+                  GError             **error)
+{
+  gboolean ret = FALSE;
+  const char *rev;
+  g_autofree char *url = NULL;
+  g_auto(GLnxConsoleRef) console = { 0, };
+  g_autoptr(OstreeAsyncProgress) console_progress = NULL;
+  g_autoptr(GPtrArray) subdirs_arg = NULL;
+#ifdef FLATPAK_ENABLE_P2P
+  g_auto(OstreeRepoFinderResultv) allocated_results = NULL;
+#endif
+  const OstreeRepoFinderResult * const *results;
+  g_auto(GLnxLockFile) lock = { 0, };
+
+  /* If @opt_results is set, @opt_rev must be. */
+  g_return_val_if_fail (opt_results == NULL || opt_rev != NULL, FALSE);
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  /* Keep a shared repo lock to avoid prunes removing objects we're relying on
+   * while we do the pull. There are two cases we protect against. 1) objects
+   * we need but that were already decided was locall available could be removed,
+   * and 2) during the transaction commit objects that not yet have a ref to the
+   * could be considered unreachable.
+   */
+  if (repo == NULL && !flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error))
+    return FALSE;
+
+  if (flatpak_dir_get_remote_oci (self, repository))
+    return flatpak_dir_pull_oci (self, repository, ref, repo, flatpak_flags,
+                                 flags, progress, cancellable, error);
+
+  if (!ostree_repo_remote_get_url (self->repo,
+                                   repository,
+                                   &url,
+                                   error))
+    return FALSE;
+
+  if (*url == 0)
+    return TRUE; /* Empty url, silently disables updates */
+
+  /* Set up progress reporting. */
+  if (progress == NULL)
+    {
+      glnx_console_lock (&console);
+      if (console.is_tty)
+        {
+          console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
+          progress = console_progress;
+        }
+    }
+
+  /* We get the rev ahead of time so that we know it for looking up e.g. extra-data
+     and to make sure we're atomically using a single rev if we happen to do multiple
+     pulls (e.g. with subpaths) */
+  if (opt_rev != NULL)
+    {
+      rev = opt_rev;
+      results = opt_results;
+    }
+  else
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      g_autofree char *collection_id = NULL;
+
+      if (!repo_get_remote_collection_id (self->repo, repository, &collection_id, NULL))
+        collection_id = NULL;
+
+      if (collection_id != NULL && *collection_id != '\0')
+        {
+          GVariantBuilder find_builder;
+          g_autoptr(GVariant) find_options = NULL;
+          g_autoptr(GMainContext) context = NULL;
+          g_autoptr(GAsyncResult) find_result = NULL;
+          OstreeCollectionRef collection_ref;
+          OstreeCollectionRef *collection_refs_to_fetch[2];
+          gboolean force_disable_deltas = (flatpak_flags & FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS) != 0;
+          guint update_freq = 0;
+          gsize i;
+
+          g_variant_builder_init (&find_builder, G_VARIANT_TYPE ("a{sv}"));
+
+          if (force_disable_deltas)
+            {
+              g_variant_builder_add (&find_builder, "{s@v}", "disable-static-deltas",
+                                     g_variant_new_variant (g_variant_new_boolean (TRUE)));
+            }
+
+          collection_ref.collection_id = collection_id;
+          collection_ref.ref_name = (char *) ref;
+
+          collection_refs_to_fetch[0] = &collection_ref;
+          collection_refs_to_fetch[1] = NULL;
+
+          if (progress != NULL)
+            update_freq = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "update-frequency"));
+          if (update_freq == 0)
+            update_freq = FLATPAK_DEFAULT_UPDATE_FREQUENCY;
+
+          g_variant_builder_add (&find_builder, "{s@v}", "update-frequency",
+                                 g_variant_new_variant (g_variant_new_uint32 (update_freq)));
+
+          find_options = g_variant_ref_sink (g_variant_builder_end (&find_builder));
+
+          context = g_main_context_new ();
+          g_main_context_push_thread_default (context);
+
+          ostree_repo_find_remotes_async (self->repo, (const OstreeCollectionRef * const *) collection_refs_to_fetch,
+                                          find_options,
+                                          NULL  /* default finders */, progress, cancellable,
+                                          async_result_cb, &find_result);
+
+          while (find_result == NULL)
+            g_main_context_iteration (context, TRUE);
+
+          allocated_results = ostree_repo_find_remotes_finish (self->repo, find_result, error);
+
+          g_main_context_pop_thread_default (context);
+
+          results = (const OstreeRepoFinderResult * const *) allocated_results;
+          if (results == NULL)
+            return FALSE;
+
+          for (i = 0, rev = NULL; results[i] != NULL && rev == NULL; i++)
+            rev = g_hash_table_lookup (results[i]->ref_to_checksum, &collection_ref);
+
+          if (rev == NULL)
+            return flatpak_fail (error, "No such ref (%s, %s) in remote %s or elsewhere",
+                                 collection_ref.collection_id, collection_ref.ref_name, repository);
+        }
+      else
+#endif  /* FLATPAK_ENABLE_P2P */
+        {
+          rev = flatpak_dir_lookup_ref_from_summary (self, repository, ref, NULL, NULL, cancellable, error);
+          results = NULL;
+        }
+
+      if (rev == NULL)
+        {
+          g_assert (error == NULL || *error != NULL);
+          return FALSE;
+        }
+    }
+
+  if (repo == NULL)
+    repo = self->repo;
+
+  /* Past this we must use goto out, so we clean up console and
+     abort the transaction on error */
+
+  if (subpaths != NULL && subpaths[0] != NULL)
+    {
+      subdirs_arg = g_ptr_array_new_with_free_func (g_free);
+      int i;
+      g_ptr_array_add (subdirs_arg, g_strdup ("/metadata"));
+      for (i = 0; subpaths[i] != NULL; i++)
+        g_ptr_array_add (subdirs_arg,
+                         g_build_filename ("/files", subpaths[i], NULL));
+      g_ptr_array_add (subdirs_arg, NULL);
+    }
+
+  if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+    goto out;
+
+  /* Setup extra data information before starting to pull, so we can have precise
+   * progress reports */
+  if (!flatpak_dir_setup_extra_data (self, repo, repository,
+                                     ref, rev, results,
+                                     flatpak_flags,
+                                     progress,
+                                     cancellable,
+                                     error))
+    goto out;
+
+  if (!repo_pull_one_dir (repo, repository,
+                          subdirs_arg ? (const char **)subdirs_arg->pdata : NULL,
+                          ref, rev, results, flatpak_flags, flags,
+                          progress,
+                          cancellable, error))
+    {
+      g_prefix_error (error, _("While pulling %s from remote %s: "), ref, repository);
+      goto out;
+    }
+
+  if (!flatpak_dir_pull_extra_data (self, repo,
+                                    repository,
+                                    ref, rev,
+                                    flatpak_flags,
+                                    progress,
+                                    cancellable,
+                                    error))
+    goto out;
+
+
+  if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  if (!ret)
+    ostree_repo_abort_transaction (repo, cancellable, NULL);
+
+  if (progress)
+    ostree_async_progress_finish (progress);
+
+  return ret;
+}
+
+static gboolean
+repo_pull_one_local_untrusted (FlatpakDir          *self,
+                               OstreeRepo          *repo,
+                               const char          *remote_name,
+                               const char          *url,
+                               const char         **dirs_to_pull,
+                               const char          *ref,
+                               const char          *checksum,
+                               OstreeAsyncProgress *progress,
+                               GCancellable        *cancellable,
+                               GError             **error)
+{
+  /* The latter flag was introduced in https://github.com/ostreedev/ostree/pull/926 */
+  const OstreeRepoPullFlags flags = OSTREE_REPO_PULL_FLAGS_UNTRUSTED |OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES;
+  GVariantBuilder builder;
+  g_auto(GLnxConsoleRef) console = { 0, };
+  g_autoptr(OstreeAsyncProgress) console_progress = NULL;
+  gboolean res;
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+  const char *refs[2] = { NULL, NULL };
+  const char *commits[2] = { NULL, NULL };
+
+  if (progress == NULL)
+    {
+      glnx_console_lock (&console);
+      if (console.is_tty)
+        {
+          console_progress = ostree_async_progress_new_and_connect (default_progress_changed, &console);
+          progress = console_progress;
+        }
+    }
+
+  refs[0] = ref;
+  commits[0] = checksum;
+
+  g_variant_builder_add (&builder, "{s@v}", "flags",
+                         g_variant_new_variant (g_variant_new_int32 (flags)));
+  g_variant_builder_add (&builder, "{s@v}", "refs",
+                         g_variant_new_variant (g_variant_new_strv ((const char * const *) refs, -1)));
+  g_variant_builder_add (&builder, "{s@v}", "override-commit-ids",
+                         g_variant_new_variant (g_variant_new_strv ((const char * const *) commits, -1)));
+  g_variant_builder_add (&builder, "{s@v}", "override-remote-name",
+                         g_variant_new_variant (g_variant_new_string (remote_name)));
+  g_variant_builder_add (&builder, "{s@v}", "gpg-verify",
+                         g_variant_new_variant (g_variant_new_boolean (TRUE)));
+  g_variant_builder_add (&builder, "{s@v}", "gpg-verify-summary",
+                         g_variant_new_variant (g_variant_new_boolean (TRUE)));
+  g_variant_builder_add (&builder, "{s@v}", "inherit-transaction",
+                         g_variant_new_variant (g_variant_new_boolean (TRUE)));
+  g_variant_builder_add (&builder, "{s@v}", "update-frequency",
+                         g_variant_new_variant (g_variant_new_uint32 (FLATPAK_DEFAULT_UPDATE_FREQUENCY)));
+
+  if (dirs_to_pull)
+    {
+      g_variant_builder_add (&builder, "{s@v}", "subdirs",
+                             g_variant_new_variant (g_variant_new_strv ((const char * const *)dirs_to_pull, -1)));
+      g_variant_builder_add (&builder, "{s@v}", "disable-static-deltas",
+                             g_variant_new_variant (g_variant_new_boolean (TRUE)));
+    }
+
+  res = ostree_repo_pull_with_options (repo, url, g_variant_builder_end (&builder),
+                                       progress, cancellable, error);
+
+  if (progress)
+    ostree_async_progress_finish (progress);
+
+  return res;
+}
+
+gboolean
+flatpak_dir_pull_untrusted_local (FlatpakDir          *self,
+                                  const char          *src_path,
+                                  const char          *remote_name,
+                                  const char          *ref,
+                                  const char         **subpaths,
+                                  OstreeAsyncProgress *progress,
+                                  GCancellable        *cancellable,
+                                  GError             **error)
+{
+  g_autoptr(GFile) path_file = g_file_new_for_path (src_path);
+  g_autoptr(GFile) summary_file = g_file_get_child (path_file, "summary");
+  g_autoptr(GFile) summary_sig_file = g_file_get_child (path_file, "summary.sig");
+  g_autofree char *url = g_file_get_uri (path_file);
+  g_autofree char *checksum = NULL;
+  g_autofree char *current_checksum = NULL;
+  gboolean gpg_verify_summary;
+  gboolean gpg_verify;
+  g_autofree char *collection_id = NULL;
+  char *summary_data = NULL;
+  char *summary_sig_data = NULL;
+  g_autofree char *remote_and_branch = NULL;
+  gsize summary_data_size, summary_sig_data_size;
+  g_autoptr(GBytes) summary_bytes = NULL;
+  g_autoptr(GBytes) summary_sig_bytes = NULL;
+  g_autoptr(OstreeGpgVerifyResult) gpg_result = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GVariant) old_commit = NULL;
+  g_autoptr(OstreeRepo) src_repo = NULL;
+  g_autoptr(GVariant) new_commit = NULL;
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  g_autoptr(GPtrArray) subdirs_arg = NULL;
+  g_auto(GLnxLockFile) lock = { 0, };
+  gboolean ret = FALSE;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  /* Keep a shared repo lock to avoid prunes removing objects we're relying on
+   * while we do the pull. There are two cases we protect against. 1) objects
+   * we need but that were already decided was locall available could be removed,
+   * and 2) during the transaction commit objects that not yet have a ref to the
+   * could be considered unreachable.
+   */
+  if (!flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error))
+    return FALSE;
+
+  if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, remote_name,
+                                                  &gpg_verify_summary, error))
+    return FALSE;
+
+  if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+    return FALSE;
+
+  if (!ostree_repo_remote_get_gpg_verify (self->repo, remote_name,
+                                          &gpg_verify, error))
+    return FALSE;
+
+  /* This was verified in the client, but lets do it here too */
+  if ((!gpg_verify_summary && collection_id == NULL) || !gpg_verify)
+    return flatpak_fail (error, "Can't pull from untrusted non-gpg verified remote");
+
+  /* We verify the summary manually before anything else to make sure
+     we've got something right before looking too hard at the repo and
+     so we can check for a downgrade before pulling and updating the
+     ref */
+
+  if (!g_file_load_contents (summary_file, cancellable,
+                             &summary_data, &summary_data_size, NULL, NULL))
+    return flatpak_fail (error, "No summary found");
+  summary_bytes = g_bytes_new_take (summary_data, summary_data_size);
+
+  if (gpg_verify_summary)
+    {
+      if (!g_file_load_contents (summary_sig_file, cancellable,
+                                 &summary_sig_data, &summary_sig_data_size, NULL, NULL))
+        return flatpak_fail (error, "GPG verification enabled, but no summary signatures found");
+
+      summary_sig_bytes = g_bytes_new_take (summary_sig_data, summary_sig_data_size);
+
+      gpg_result = ostree_repo_verify_summary (self->repo,
+                                               remote_name,
+                                               summary_bytes,
+                                               summary_sig_bytes,
+                                               cancellable, error);
+      if (gpg_result == NULL)
+        return FALSE;
+
+      if (ostree_gpg_verify_result_count_valid (gpg_result) == 0)
+        return flatpak_fail (error, "GPG signatures found, but none are in trusted keyring");
+    }
+
+  g_clear_object (&gpg_result);
+
+  summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT, summary_bytes, FALSE));
+  if (!flatpak_summary_lookup_ref (summary,
+                                   collection_id,
+                                   ref,
+                                   &checksum, NULL))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   _("Can't find %s in remote %s"), ref, remote_name);
+      return FALSE;
+    }
+
+  remote_and_branch = g_strdup_printf ("%s:%s", remote_name, ref);
+  if (!ostree_repo_resolve_rev (self->repo, remote_and_branch, TRUE, &current_checksum, error))
+    return FALSE;
+
+  if (current_checksum != NULL &&
+      !ostree_repo_load_commit (self->repo, current_checksum, &old_commit, NULL, NULL))
+    return FALSE;
+
+  src_repo = ostree_repo_new (path_file);
+  if (!ostree_repo_open (src_repo, cancellable, error))
+    return FALSE;
+
+  if (gpg_verify)
+    {
+      gpg_result = ostree_repo_verify_commit_for_remote (src_repo, checksum, remote_name, cancellable, error);
+      if (gpg_result == NULL)
+        return FALSE;
+
+      if (ostree_gpg_verify_result_count_valid (gpg_result) == 0)
+        return flatpak_fail (error, "GPG signatures found, but none are in trusted keyring");
+    }
+
+  g_clear_object (&gpg_result);
+
+  if (!ostree_repo_load_commit (src_repo, checksum, &new_commit, NULL, error))
+    return FALSE;
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (gpg_verify)
+    {
+      /* Verify the commit’s binding to the ref and to the repo. See
+       * verify_bindings() in libostree. */
+      g_autoptr(GVariant) new_commit_metadata = g_variant_get_child_value (new_commit, 0);
+      g_autofree const char **commit_refs = NULL;
+
+      if (!g_variant_lookup (new_commit_metadata,
+                             OSTREE_COMMIT_META_KEY_REF_BINDING,
+                             "^a&s",
+                             &commit_refs))
+        {
+          /* Early return here - if the remote collection ID is NULL, then
+           * we certainly will not verify the collection binding in the
+           * commit.
+           */
+          if (collection_id != NULL)
+            return flatpak_fail (error,
+                                 "expected commit metadata to have ref "
+                                 "binding information, found none");
+        }
+
+      if (collection_id != NULL &&
+          !g_strv_contains ((const char *const *) commit_refs, ref))
+        {
+          return flatpak_fail (error, "commit has no requested ref ‘%s’ "
+                               "in ref binding metadata",
+                               ref);
+        }
+
+      if (collection_id != NULL)
+        {
+          const char *commit_collection_id;
+          if (!g_variant_lookup (new_commit_metadata,
+                                 "ostree.collection-binding",
+                                 "&s",
+                                 &commit_collection_id))
+            return flatpak_fail (error,
+                                 "expected commit metadata to have collection ID "
+                                 "binding information, found none");
+          if (!g_str_equal (commit_collection_id, collection_id))
+            return flatpak_fail (error,
+                                 "commit has collection ID ‘%s’ in collection binding "
+                                 "metadata, while the remote it came from has "
+                                 "collection ID ‘%s’",
+                                 commit_collection_id, collection_id);
+        }
+    }
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (old_commit)
+    {
+      guint64 old_timestamp;
+      guint64 new_timestamp;
+
+      old_timestamp = ostree_commit_get_timestamp (old_commit);
+      new_timestamp = ostree_commit_get_timestamp (new_commit);
+
+      if (new_timestamp < old_timestamp)
+        return flatpak_fail (error, "Not allowed to downgrade %s", ref);
+    }
+
+  if (subpaths != NULL && subpaths[0] != NULL)
+    {
+      subdirs_arg = g_ptr_array_new_with_free_func (g_free);
+      int i;
+      g_ptr_array_add (subdirs_arg, g_strdup ("/metadata"));
+      for (i = 0; subpaths[i] != NULL; i++)
+        g_ptr_array_add (subdirs_arg,
+                         g_build_filename ("/files", subpaths[i], NULL));
+      g_ptr_array_add (subdirs_arg, NULL);
+    }
+
+  if (!ostree_repo_prepare_transaction (self->repo, NULL, cancellable, error))
+    goto out;
+
+  /* Past this we must use goto out, so we abort the transaction on error */
+
+  if (!repo_pull_one_local_untrusted (self, self->repo, remote_name, url,
+                                      subdirs_arg ? (const char **)subdirs_arg->pdata : NULL,
+                                      ref, checksum, progress,
+                                      cancellable, error))
+    {
+      g_prefix_error (error, _("While pulling %s from remote %s: "), ref, remote_name);
+      goto out;
+    }
+
+  /* Get the out of bands extra-data required due to an ostree pull
+     commitmeta size limit */
+  extra_data_sources = flatpak_commit_get_extra_data_sources (new_commit, NULL);
+  if (extra_data_sources)
+    {
+      GFile *dir = ostree_repo_get_path (src_repo);
+      g_autoptr(GFile) file = NULL;
+      g_autofree char *filename = NULL;
+      g_autofree char *commitmeta = NULL;
+      gsize commitmeta_size;
+      g_autoptr(GVariant) new_metadata = NULL;
+
+      filename = g_strconcat (checksum, ".commitmeta", NULL);
+      file = g_file_get_child (dir, filename);
+      if (!g_file_load_contents (file, cancellable,
+                                 &commitmeta, &commitmeta_size,
+                                 NULL, error))
+        goto out;
+
+      new_metadata = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("a{sv}"),
+                                                                  commitmeta, commitmeta_size,
+                                                                  FALSE,
+                                                                  g_free, commitmeta));
+      g_steal_pointer (&commitmeta); /* steal into the variant */
+
+      if (!ostree_repo_write_commit_detached_metadata (self->repo, checksum, new_metadata, cancellable, error))
+        goto out;
+    }
+
+  if (!ostree_repo_commit_transaction (self->repo, NULL, cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  if (!ret)
+    ostree_repo_abort_transaction (self->repo, cancellable, NULL);
+
+  if (progress)
+    ostree_async_progress_finish (progress);
+
+  return ret;
+}
+
+char *
+flatpak_dir_current_ref (FlatpakDir   *self,
+                         const char   *name,
+                         GCancellable *cancellable)
+{
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFile) current_link = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
+
+  base = g_file_get_child (flatpak_dir_get_path (self), "app");
+  dir = g_file_get_child (base, name);
+
+  current_link = g_file_get_child (dir, "current");
+
+  file_info = g_file_query_info (current_link, OSTREE_GIO_FAST_QUERYINFO,
+                                 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                 cancellable, NULL);
+  if (file_info == NULL)
+    return NULL;
+
+  return g_strconcat ("app/", name, "/", g_file_info_get_symlink_target (file_info), NULL);
+}
+
+gboolean
+flatpak_dir_drop_current_ref (FlatpakDir   *self,
+                              const char   *name,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFile) current_link = NULL;
+  g_auto(GStrv) refs = NULL;
+  g_autofree char *current_ref = NULL;
+  const char *other_ref = NULL;
+
+  base = g_file_get_child (flatpak_dir_get_path (self), "app");
+  dir = g_file_get_child (base, name);
+
+  current_ref = flatpak_dir_current_ref (self, name, cancellable);
+
+  if (flatpak_dir_list_refs_for_name (self, "app", name, &refs, cancellable, NULL))
+    {
+      int i;
+      for (i = 0; refs[i] != NULL; i++)
+        {
+          if (g_strcmp0 (refs[i], current_ref) != 0)
+            {
+              other_ref = refs[i];
+              break;
+            }
+        }
+    }
+
+  current_link = g_file_get_child (dir, "current");
+
+  if (!g_file_delete (current_link, cancellable, error))
+    return FALSE;
+
+  if (other_ref)
+    {
+      if (!flatpak_dir_make_current_ref (self, other_ref, cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_make_current_ref (FlatpakDir   *self,
+                              const char   *ref,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFile) current_link = NULL;
+  g_auto(GStrv) ref_parts = NULL;
+  g_autofree char *rest = NULL;
+  gboolean ret = FALSE;
+
+  ref_parts = g_strsplit (ref, "/", -1);
+
+  g_assert (g_strv_length (ref_parts) == 4);
+  g_assert (strcmp (ref_parts[0], "app") == 0);
+
+  base = g_file_get_child (flatpak_dir_get_path (self), ref_parts[0]);
+  dir = g_file_get_child (base, ref_parts[1]);
+
+  current_link = g_file_get_child (dir, "current");
+
+  g_file_delete (current_link, cancellable, NULL);
+
+  if (*ref_parts[3] != 0)
+    {
+      rest = g_strdup_printf ("%s/%s", ref_parts[2], ref_parts[3]);
+      if (!g_file_make_symbolic_link (current_link, rest, cancellable, error))
+        goto out;
+    }
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+gboolean
+flatpak_dir_list_refs_for_name (FlatpakDir   *self,
+                                const char   *kind,
+                                const char   *name,
+                                char       ***refs_out,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+  g_autoptr(GPtrArray) refs = NULL;
+
+  base = g_file_get_child (flatpak_dir_get_path (self), kind);
+  dir = g_file_get_child (base, name);
+
+  refs = g_ptr_array_new ();
+
+  if (!g_file_query_exists (dir, cancellable))
+    {
+      ret = TRUE;
+      goto out;
+    }
+
+  dir_enum = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
+                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        cancellable, error);
+  if (!dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)))
+    {
+      g_autoptr(GFile) child = NULL;
+      g_autoptr(GFileEnumerator) dir_enum2 = NULL;
+      g_autoptr(GFileInfo) child_info2 = NULL;
+      const char *arch;
+
+      arch = g_file_info_get_name (child_info);
+
+      if (g_file_info_get_file_type (child_info) != G_FILE_TYPE_DIRECTORY ||
+          strcmp (arch, "data") == 0 /* There used to be a data dir here, lets ignore it */)
+        {
+          g_clear_object (&child_info);
+          continue;
+        }
+
+      child = g_file_get_child (dir, arch);
+      g_clear_object (&dir_enum2);
+      dir_enum2 = g_file_enumerate_children (child, OSTREE_GIO_FAST_QUERYINFO,
+                                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                             cancellable, error);
+      if (!dir_enum2)
+        goto out;
+
+      while ((child_info2 = g_file_enumerator_next_file (dir_enum2, cancellable, &temp_error)))
+        {
+          const char *branch;
+
+          if (g_file_info_get_file_type (child_info2) == G_FILE_TYPE_DIRECTORY)
+            {
+              branch = g_file_info_get_name (child_info2);
+              g_ptr_array_add (refs,
+                               g_strdup_printf ("%s/%s/%s/%s", kind, name, arch, branch));
+            }
+
+          g_clear_object (&child_info2);
+        }
+
+
+      if (temp_error != NULL)
+        goto out;
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    goto out;
+
+  g_ptr_array_sort (refs, flatpak_strcmp0_ptr);
+
+  ret = TRUE;
+
+out:
+  if (ret)
+    {
+      g_ptr_array_add (refs, NULL);
+      *refs_out = (char **) g_ptr_array_free (refs, FALSE);
+      refs = NULL;
+    }
+
+  if (temp_error != NULL)
+    g_propagate_error (error, temp_error);
+
+  return ret;
+}
+
+gboolean
+flatpak_dir_list_refs (FlatpakDir   *self,
+                       const char   *kind,
+                       char       ***refs_out,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) base = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+  g_autoptr(GPtrArray) refs = NULL;
+
+  refs = g_ptr_array_new ();
+
+  base = g_file_get_child (flatpak_dir_get_path (self), kind);
+
+  if (!g_file_query_exists (base, cancellable))
+    {
+      ret = TRUE;
+      goto out;
+    }
+
+  dir_enum = g_file_enumerate_children (base, OSTREE_GIO_FAST_QUERYINFO,
+                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        cancellable, error);
+  if (!dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)))
+    {
+      gchar **sub_refs = NULL;
+      const char *name;
+      int i;
+
+      if (g_file_info_get_file_type (child_info) != G_FILE_TYPE_DIRECTORY)
+        {
+          g_clear_object (&child_info);
+          continue;
+        }
+
+      name = g_file_info_get_name (child_info);
+
+      if (!flatpak_dir_list_refs_for_name (self, kind, name, &sub_refs, cancellable, error))
+        goto out;
+
+      for (i = 0; sub_refs[i] != NULL; i++)
+        g_ptr_array_add (refs, sub_refs[i]);
+      g_free (sub_refs);
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    goto out;
+
+  ret = TRUE;
+
+  g_ptr_array_sort (refs, flatpak_strcmp0_ptr);
+
+out:
+  if (ret)
+    {
+      g_ptr_array_add (refs, NULL);
+      *refs_out = (char **) g_ptr_array_free (refs, FALSE);
+      refs = NULL;
+    }
+
+  if (temp_error != NULL)
+    g_propagate_error (error, temp_error);
+
+  return ret;
+}
+
+char *
+flatpak_dir_read_latest (FlatpakDir   *self,
+                         const char   *remote,
+                         const char   *ref,
+                         char        **out_alt_id,
+                         GCancellable *cancellable,
+                         GError      **error)
+{
+  g_autofree char *remote_and_ref = NULL;
+  g_autofree char *alt_id = NULL;
+  char *res = NULL;
+
+  /* There may be several remotes with the same branch (if we for
+   * instance changed the origin, so prepend the current origin to
+   * make sure we get the right one */
+
+  if (remote)
+    remote_and_ref = g_strdup_printf ("%s:%s", remote, ref);
+  else
+    remote_and_ref = g_strdup (ref);
+
+  if (!ostree_repo_resolve_rev (self->repo, remote_and_ref, FALSE, &res, error))
+    return NULL;
+
+  if (out_alt_id)
+    {
+      g_autoptr(GVariant) commit_data = NULL;
+      g_autoptr(GVariant) commit_metadata = NULL;
+
+      if (!ostree_repo_load_commit (self->repo, res, &commit_data, NULL, error))
+        return NULL;
+
+      commit_metadata = g_variant_get_child_value (commit_data, 0);
+      g_variant_lookup (commit_metadata, "xa.alt-id", "s", &alt_id);
+
+      *out_alt_id = g_steal_pointer (&alt_id);
+     }
+
+  return res;
+}
+
+char *
+flatpak_dir_read_active (FlatpakDir   *self,
+                         const char   *ref,
+                         GCancellable *cancellable)
+{
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) active_link = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+  active_link = g_file_get_child (deploy_base, "active");
+
+  file_info = g_file_query_info (active_link, OSTREE_GIO_FAST_QUERYINFO,
+                                 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                 cancellable, NULL);
+  if (file_info == NULL)
+    return NULL;
+
+  return g_strdup (g_file_info_get_symlink_target (file_info));
+}
+
+gboolean
+flatpak_dir_set_active (FlatpakDir   *self,
+                        const char   *ref,
+                        const char   *active_id,
+                        GCancellable *cancellable,
+                        GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) active_tmp_link = NULL;
+  g_autoptr(GFile) active_link = NULL;
+  g_autoptr(GError) my_error = NULL;
+  g_autofree char *tmpname = g_strdup (".active-XXXXXX");
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+  active_link = g_file_get_child (deploy_base, "active");
+
+  if (active_id != NULL)
+    {
+      glnx_gen_temp_name (tmpname);
+      active_tmp_link = g_file_get_child (deploy_base, tmpname);
+      if (!g_file_make_symbolic_link (active_tmp_link, active_id, cancellable, error))
+        goto out;
+
+      if (!flatpak_file_rename (active_tmp_link,
+                                active_link,
+                                cancellable, error))
+        goto out;
+    }
+  else
+    {
+      if (!g_file_delete (active_link, cancellable, &my_error) &&
+          !g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_propagate_error (error, my_error);
+          my_error = NULL;
+          goto out;
+        }
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+static gboolean
+flatpak_dir_run_triggers (FlatpakDir   *self,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  g_autoptr(GFile) triggersdir = NULL;
+  GError *temp_error = NULL;
+  const char *triggerspath;
+
+  triggerspath = g_getenv ("FLATPAK_TRIGGERSDIR");
+  if (triggerspath == NULL)
+    triggerspath = FLATPAK_TRIGGERDIR;
+
+  g_debug ("running triggers from %s", triggerspath);
+
+  triggersdir = g_file_new_for_path (triggerspath);
+
+  dir_enum = g_file_enumerate_children (triggersdir, "standard::type,standard::name",
+                                        0, cancellable, error);
+  if (!dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)) != NULL)
+    {
+      g_autoptr(GFile) child = NULL;
+      const char *name;
+      GError *trigger_error = NULL;
+
+      name = g_file_info_get_name (child_info);
+
+      child = g_file_get_child (triggersdir, name);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_REGULAR &&
+          g_str_has_suffix (name, ".trigger"))
+        {
+          g_autoptr(GPtrArray) argv_array = NULL;
+          /* We need to canonicalize the basedir, because if has a symlink
+             somewhere the bind mount will be on the target of that, not
+             at that exact path. */
+          g_autofree char *basedir_orig = g_file_get_path (self->basedir);
+          g_autofree char *basedir = realpath (basedir_orig, NULL);
+
+          g_debug ("running trigger %s", name);
+
+          argv_array = g_ptr_array_new_with_free_func (g_free);
+#ifdef DISABLE_SANDBOXED_TRIGGERS
+          g_ptr_array_add (argv_array, g_file_get_path (child));
+          g_ptr_array_add (argv_array, g_strdup (basedir));
+#else
+          g_ptr_array_add (argv_array, g_strdup (flatpak_get_bwrap ()));
+          g_ptr_array_add (argv_array, g_strdup ("--unshare-ipc"));
+          g_ptr_array_add (argv_array, g_strdup ("--unshare-net"));
+          g_ptr_array_add (argv_array, g_strdup ("--unshare-pid"));
+          g_ptr_array_add (argv_array, g_strdup ("--ro-bind"));
+          g_ptr_array_add (argv_array, g_strdup ("/"));
+          g_ptr_array_add (argv_array, g_strdup ("/"));
+          g_ptr_array_add (argv_array, g_strdup ("--proc"));
+          g_ptr_array_add (argv_array, g_strdup ("/proc"));
+          g_ptr_array_add (argv_array, g_strdup ("--dev"));
+          g_ptr_array_add (argv_array, g_strdup ("/dev"));
+          g_ptr_array_add (argv_array, g_strdup ("--bind"));
+          g_ptr_array_add (argv_array, g_strdup (basedir));
+          g_ptr_array_add (argv_array, g_strdup (basedir));
+#endif
+          g_ptr_array_add (argv_array, g_file_get_path (child));
+          g_ptr_array_add (argv_array, g_strdup (basedir));
+          g_ptr_array_add (argv_array, NULL);
+
+          if (!g_spawn_sync ("/",
+                             (char **) argv_array->pdata,
+                             NULL,
+                             G_SPAWN_SEARCH_PATH,
+                             NULL, NULL,
+                             NULL, NULL,
+                             NULL, &trigger_error))
+            {
+              g_warning ("Error running trigger %s: %s", name, trigger_error->message);
+              g_clear_error (&trigger_error);
+            }
+        }
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+static gboolean
+read_fd (int          fd,
+         struct stat *stat_buf,
+         gchar      **contents,
+         gsize       *length,
+         GError     **error)
+{
+  gchar *buf;
+  gsize bytes_read;
+  gsize size;
+  gsize alloc_size;
+
+  size = stat_buf->st_size;
+
+  alloc_size = size + 1;
+  buf = g_try_malloc (alloc_size);
+
+  if (buf == NULL)
+    {
+      g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM,
+                           _("Not enough memory"));
+      return FALSE;
+    }
+
+  bytes_read = 0;
+  while (bytes_read < size)
+    {
+      gssize rc;
+
+      rc = read (fd, buf + bytes_read, size - bytes_read);
+
+      if (rc < 0)
+        {
+          if (errno != EINTR)
+            {
+              int save_errno = errno;
+
+              g_free (buf);
+              g_set_error_literal (error, G_FILE_ERROR, g_file_error_from_errno (save_errno),
+                                   _("Failed to read from exported file"));
+              return FALSE;
+            }
+        }
+      else if (rc == 0)
+        {
+          break;
+        }
+      else
+        {
+          bytes_read += rc;
+        }
+    }
+
+  buf[bytes_read] = '\0';
+
+  if (length)
+    *length = bytes_read;
+
+  *contents = buf;
+
+  return TRUE;
+}
+
+/* This is conservative, but lets us avoid escaping most
+   regular Exec= lines, which is nice as that can sometimes
+   cause problems for apps launching desktop files. */
+static gboolean
+need_quotes (const char *str)
+{
+  const char *p;
+
+  for (p = str; *p; p++)
+    {
+      if (!g_ascii_isalnum (*p) &&
+          strchr ("-_%.=:/@", *p) == NULL)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static char *
+maybe_quote (const char *str)
+{
+  if (need_quotes (str))
+    return g_shell_quote (str);
+  return g_strdup (str);
+}
+
+typedef enum {
+  INI_FILE_TYPE_SEARCH_PROVIDER = 1,
+} ExportedIniFileType;
+
+static gboolean
+export_ini_file (int           parent_fd,
+                 const char   *name,
+                 ExportedIniFileType ini_type,
+                 struct stat  *stat_buf,
+                 char        **target,
+                 GCancellable *cancellable,
+                 GError      **error)
+{
+  glnx_autofd int desktop_fd = -1;
+  g_autofree char *tmpfile_name = g_strdup_printf ("export-ini-XXXXXX");
+  g_autoptr(GOutputStream) out_stream = NULL;
+  g_autofree gchar *data = NULL;
+  gsize data_len;
+  g_autofree gchar *new_data = NULL;
+  gsize new_data_len;
+  g_autoptr(GKeyFile) keyfile = NULL;
+
+  if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error) ||
+      !read_fd (desktop_fd, stat_buf, &data, &data_len, error))
+    return FALSE;
+
+  keyfile = g_key_file_new ();
+  if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error))
+    return FALSE;
+
+  if (ini_type == INI_FILE_TYPE_SEARCH_PROVIDER)
+    g_key_file_set_boolean (keyfile, "Shell Search Provider", "DefaultDisabled", TRUE);
+
+  new_data = g_key_file_to_data (keyfile, &new_data_len, error);
+  if (new_data == NULL)
+    return FALSE;
+
+  if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error) ||
+      !g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error) ||
+      !g_output_stream_close (out_stream, cancellable, error))
+    return FALSE;
+
+  if (target)
+    *target = g_steal_pointer (&tmpfile_name);
+
+  return TRUE;
+}
+
+static inline void
+xml_autoptr_cleanup_generic_free (void *p)
+{
+  void **pp = (void**)p;
+  if (*pp)
+    xmlFree (*pp);
+}
+
+
+#define xml_autofree _GLIB_CLEANUP(xml_autoptr_cleanup_generic_free)
+
+/* This verifies the basic layout of the files, then it removes
+ * any magic matches, and makes all glob matches have a very low
+ * priority (weight = 5). This should make it pretty safe to
+ * export mime types, because the should not override the system
+ * ones in any weird ways. */
+static gboolean
+rewrite_mime_xml (xmlDoc *doc)
+{
+  xmlNode *root_element = xmlDocGetRootElement (doc);
+  xmlNode *top_node = NULL;
+
+  for (top_node = root_element; top_node; top_node = top_node->next)
+    {
+      xmlNode *mime_node = NULL;
+      if (top_node->type != XML_ELEMENT_NODE)
+        continue;
+
+      if (strcmp ((char *)top_node->name, "mime-info") != 0)
+        return FALSE;
+
+      for (mime_node = top_node->children; mime_node; mime_node = mime_node->next)
+        {
+          xmlNode *sub_node = NULL;
+          xmlNode *next_sub_node = NULL;
+
+          xml_autofree xmlChar *mimetype = NULL;
+          if (mime_node->type != XML_ELEMENT_NODE)
+            continue;
+
+          if (strcmp ((char *)mime_node->name, "mime-type") != 0)
+            return FALSE;
+
+          mimetype = xmlGetProp (mime_node, (xmlChar *)"type");
+          for (sub_node = mime_node->children; sub_node; sub_node = next_sub_node)
+            {
+              next_sub_node = sub_node->next;
+
+              if (sub_node->type != XML_ELEMENT_NODE)
+                continue;
+
+              if (strcmp ((char *)sub_node->name, "magic") == 0)
+                {
+                  g_warning ("Removing magic mime rule from exports");
+                  xmlUnlinkNode (sub_node);
+                  xmlFreeNode(sub_node);
+                }
+              else if (strcmp ((char *)sub_node->name, "glob") == 0)
+                {
+                  xmlSetProp (sub_node,
+                              (const xmlChar *)"weight",
+                              (const xmlChar *)"5");
+                }
+            }
+        }
+    }
+
+  return TRUE;
+}
+
+static gboolean
+export_mime_file (int           parent_fd,
+                  const char   *name,
+                  struct stat  *stat_buf,
+                  char        **target,
+                  GCancellable *cancellable,
+                  GError      **error)
+{
+  glnx_autofd int desktop_fd = -1;
+  g_autofree char *tmpfile_name = g_strdup_printf ("export-mime-XXXXXX");
+  g_autoptr(GOutputStream) out_stream = NULL;
+  g_autofree gchar *data = NULL;
+  gsize data_len;
+  xmlDoc *doc = NULL;
+  xml_autofree xmlChar *xmlbuff = NULL;
+  int buffersize;
+
+  if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error) ||
+      !read_fd (desktop_fd, stat_buf, &data, &data_len, error))
+    return FALSE;
+
+  doc = xmlReadMemory (data, data_len, NULL, NULL,  0);
+  if (doc == NULL)
+    return flatpak_fail (error, _("Error reading mimetype xml file"));
+
+  if (!rewrite_mime_xml (doc))
+    {
+      xmlFreeDoc (doc);
+      return flatpak_fail (error, _("Invalid mimetype xml file"));
+    }
+
+  xmlDocDumpFormatMemory (doc, &xmlbuff, &buffersize, 1);
+  xmlFreeDoc (doc);
+
+  if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error) ||
+      !g_output_stream_write_all (out_stream, xmlbuff, buffersize, NULL, cancellable, error) ||
+      !g_output_stream_close (out_stream, cancellable, error))
+    return FALSE;
+
+  if (target)
+    *target = g_steal_pointer (&tmpfile_name);
+
+  return TRUE;
+}
+
+static gboolean
+export_desktop_file (const char   *app,
+                     const char   *branch,
+                     const char   *arch,
+                     GKeyFile     *metadata,
+                     int           parent_fd,
+                     const char   *name,
+                     struct stat  *stat_buf,
+                     char        **target,
+                     GCancellable *cancellable,
+                     GError      **error)
+{
+  gboolean ret = FALSE;
+  glnx_autofd int desktop_fd = -1;
+  g_autofree char *tmpfile_name = g_strdup_printf ("export-desktop-XXXXXX");
+  g_autoptr(GOutputStream) out_stream = NULL;
+  g_autofree gchar *data = NULL;
+  gsize data_len;
+  g_autofree gchar *new_data = NULL;
+  gsize new_data_len;
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_autofree gchar *old_exec = NULL;
+  gint old_argc;
+  g_auto(GStrv) old_argv = NULL;
+  g_auto(GStrv) groups = NULL;
+  GString *new_exec = NULL;
+  g_autofree char *escaped_app = maybe_quote (app);
+  g_autofree char *escaped_branch = maybe_quote (branch);
+  g_autofree char *escaped_arch = maybe_quote (arch);
+  int i;
+
+  if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error))
+    goto out;
+
+  if (!read_fd (desktop_fd, stat_buf, &data, &data_len, error))
+    goto out;
+
+  keyfile = g_key_file_new ();
+  if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error))
+    goto out;
+
+  if (g_str_has_suffix (name, ".service"))
+    {
+      g_autofree gchar *dbus_name = NULL;
+      g_autofree gchar *expected_dbus_name = g_strndup (name, strlen (name) - strlen (".service"));
+
+      dbus_name = g_key_file_get_string (keyfile, "D-BUS Service", "Name", NULL);
+
+      if (dbus_name == NULL || strcmp (dbus_name, expected_dbus_name) != 0)
+        {
+          flatpak_fail (error, "dbus service file %s has wrong name", name);
+          return FALSE;
+        }
+    }
+
+  if (g_str_has_suffix (name, ".desktop"))
+    {
+      gsize length;
+      g_auto(GStrv) tags = g_key_file_get_string_list (metadata,
+                                                       "Application",
+                                                       "tags", &length,
+                                                       NULL);
+
+      if (tags != NULL)
+        {
+          g_key_file_set_string_list (keyfile,
+                                      "Desktop Entry",
+                                      "X-Flatpak-Tags",
+                                      (const char * const *) tags, length);
+        }
+
+      /* Add a marker so consumers can easily find out that this launches a sandbox */
+      g_key_file_set_string (keyfile, "Desktop Entry", "X-Flatpak", app);
+    }
+
+  groups = g_key_file_get_groups (keyfile, NULL);
+
+  for (i = 0; groups[i] != NULL; i++)
+    {
+      g_key_file_remove_key (keyfile, groups[i], "TryExec", NULL);
+
+      /* Remove this to make sure nothing tries to execute it outside the sandbox*/
+      g_key_file_remove_key (keyfile, groups[i], "X-GNOME-Bugzilla-ExtraInfoScript", NULL);
+
+      new_exec = g_string_new ("");
+      g_string_append_printf (new_exec, FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s", escaped_branch, escaped_arch);
+
+      old_exec = g_key_file_get_string (keyfile, groups[i], "Exec", NULL);
+      if (old_exec && g_shell_parse_argv (old_exec, &old_argc, &old_argv, NULL) && old_argc >= 1)
+        {
+          int i;
+          g_autofree char *command = maybe_quote (old_argv[0]);
+
+          g_string_append_printf (new_exec, " --command=%s", command);
+
+          for (i = 1; i < old_argc; i++)
+            {
+              if (strcasecmp (old_argv[i], "%f") == 0 ||
+                  strcasecmp (old_argv[i], "%u") == 0)
+                {
+                  g_string_append (new_exec, " --file-forwarding");
+                  break;
+                }
+            }
+
+          g_string_append (new_exec, " ");
+          g_string_append (new_exec, escaped_app);
+
+          for (i = 1; i < old_argc; i++)
+            {
+              g_autofree char *arg = maybe_quote (old_argv[i]);
+
+              if (strcasecmp (arg, "%f") == 0)
+                g_string_append_printf (new_exec, " @@ %s @@", arg);
+              else if (strcasecmp (arg, "%u") == 0)
+                g_string_append_printf (new_exec, " @@u %s @@", arg);
+              else
+                g_string_append_printf (new_exec, " %s", arg);
+            }
+        }
+      else
+        {
+          g_string_append (new_exec, " ");
+          g_string_append (new_exec, escaped_app);
+        }
+
+      g_key_file_set_string (keyfile, groups[i], G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec->str);
+    }
+
+  new_data = g_key_file_to_data (keyfile, &new_data_len, error);
+  if (new_data == NULL)
+    goto out;
+
+  if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error))
+    goto out;
+
+  if (!g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error))
+    goto out;
+
+  if (!g_output_stream_close (out_stream, cancellable, error))
+    goto out;
+
+  if (target)
+    *target = g_steal_pointer (&tmpfile_name);
+
+  ret = TRUE;
+out:
+
+  if (new_exec != NULL)
+    g_string_free (new_exec, TRUE);
+
+  return ret;
+}
+
+static gboolean
+rewrite_export_dir (const char   *app,
+                    const char   *branch,
+                    const char   *arch,
+                    GKeyFile     *metadata,
+                    int           source_parent_fd,
+                    const char   *source_name,
+                    GCancellable *cancellable,
+                    GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_auto(GLnxDirFdIterator) source_iter = {0};
+  g_autoptr(GHashTable) visited_children = NULL;
+  struct dirent *dent;
+
+  if (!glnx_dirfd_iterator_init_at (source_parent_fd, source_name, FALSE, &source_iter, error))
+    goto out;
+
+  visited_children = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  while (TRUE)
+    {
+      struct stat stbuf;
+
+      if (!glnx_dirfd_iterator_next_dent (&source_iter, &dent, cancellable, error))
+        goto out;
+
+      if (dent == NULL)
+        break;
+
+      if (g_hash_table_contains (visited_children, dent->d_name))
+        continue;
+
+      /* Avoid processing the same file again if it was re-created during an export */
+      g_hash_table_insert (visited_children, g_strdup (dent->d_name), GINT_TO_POINTER (1));
+
+      if (fstatat (source_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
+        {
+          if (errno == ENOENT)
+            {
+              continue;
+            }
+          else
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+        }
+
+      if (S_ISDIR (stbuf.st_mode))
+        {
+          if (!rewrite_export_dir (app, branch, arch, metadata,
+                                   source_iter.fd, dent->d_name,
+                                   cancellable, error))
+            goto out;
+        }
+      else if (S_ISREG (stbuf.st_mode))
+        {
+          g_autofree gchar *new_name = NULL;
+
+          if (!flatpak_has_name_prefix (dent->d_name, app))
+            {
+              g_warning ("Non-prefixed filename %s in app %s, removing.", dent->d_name, app);
+              if (unlinkat (source_iter.fd, dent->d_name, 0) != 0 && errno != ENOENT)
+                {
+                  glnx_set_error_from_errno (error);
+                  goto out;
+                }
+            }
+
+          if (g_str_has_suffix (dent->d_name, ".desktop") ||
+              g_str_has_suffix (dent->d_name, ".service"))
+            {
+              if (!export_desktop_file (app, branch, arch, metadata,
+                                        source_iter.fd, dent->d_name, &stbuf, &new_name, cancellable, error))
+                goto out;
+            }
+
+          if (strcmp (source_name, "search-providers") == 0 &&
+              g_str_has_suffix (dent->d_name, ".ini"))
+            {
+              if (!export_ini_file (source_iter.fd, dent->d_name, INI_FILE_TYPE_SEARCH_PROVIDER,
+                                    &stbuf, &new_name, cancellable, error))
+                goto out;
+            }
+
+          if (strcmp (source_name, "packages") == 0 &&
+              g_str_has_suffix (dent->d_name, ".xml"))
+            {
+              if (!export_mime_file (source_iter.fd, dent->d_name,
+                                     &stbuf, &new_name, cancellable, error))
+                goto out;
+            }
+
+          if (new_name)
+            {
+              g_hash_table_insert (visited_children, g_strdup (new_name), GINT_TO_POINTER (1));
+
+              if (renameat (source_iter.fd, new_name, source_iter.fd, dent->d_name) != 0)
+                {
+                  glnx_set_error_from_errno (error);
+                  goto out;
+                }
+            }
+        }
+      else
+        {
+          g_warning ("Not exporting file %s of unsupported type.", dent->d_name);
+          if (unlinkat (source_iter.fd, dent->d_name, 0) != 0 && errno != ENOENT)
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+        }
+    }
+
+  ret = TRUE;
+out:
+
+  return ret;
+}
+
+static gboolean
+flatpak_rewrite_export_dir (const char   *app,
+                            const char   *branch,
+                            const char   *arch,
+                            GKeyFile     *metadata,
+                            GFile        *source,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  gboolean ret = FALSE;
+
+  /* The fds are closed by this call */
+  if (!rewrite_export_dir (app, branch, arch, metadata,
+                           AT_FDCWD, flatpak_file_get_path_cached (source),
+                           cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+
+static gboolean
+export_dir (int           source_parent_fd,
+            const char   *source_name,
+            const char   *source_symlink_prefix,
+            const char   *source_relpath,
+            int           destination_parent_fd,
+            const char   *destination_name,
+            GCancellable *cancellable,
+            GError      **error)
+{
+  gboolean ret = FALSE;
+  int res;
+
+  g_auto(GLnxDirFdIterator) source_iter = {0};
+  glnx_autofd int destination_dfd = -1;
+  struct dirent *dent;
+
+  if (!glnx_dirfd_iterator_init_at (source_parent_fd, source_name, FALSE, &source_iter, error))
+    goto out;
+
+  do
+    res = mkdirat (destination_parent_fd, destination_name, 0755);
+  while (G_UNLIKELY (res == -1 && errno == EINTR));
+  if (res == -1)
+    {
+      if (errno != EEXIST)
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
+    }
+
+  if (!glnx_opendirat (destination_parent_fd, destination_name, TRUE,
+                       &destination_dfd, error))
+    goto out;
+
+  while (TRUE)
+    {
+      struct stat stbuf;
+
+      if (!glnx_dirfd_iterator_next_dent (&source_iter, &dent, cancellable, error))
+        goto out;
+
+      if (dent == NULL)
+        break;
+
+      if (fstatat (source_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
+        {
+          if (errno == ENOENT)
+            {
+              continue;
+            }
+          else
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+        }
+
+      if (S_ISDIR (stbuf.st_mode))
+        {
+          g_autofree gchar *child_symlink_prefix = g_build_filename ("..", source_symlink_prefix, dent->d_name, NULL);
+          g_autofree gchar *child_relpath = g_strconcat (source_relpath, dent->d_name, "/", NULL);
+
+          if (!export_dir (source_iter.fd, dent->d_name, child_symlink_prefix, child_relpath, destination_dfd, dent->d_name,
+                           cancellable, error))
+            goto out;
+        }
+      else if (S_ISREG (stbuf.st_mode))
+        {
+          g_autofree gchar *target = NULL;
+
+          target = g_build_filename (source_symlink_prefix, dent->d_name, NULL);
+
+          if (unlinkat (destination_dfd, dent->d_name, 0) != 0 && errno != ENOENT)
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+
+          if (symlinkat (target, destination_dfd, dent->d_name) != 0)
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+        }
+    }
+
+  ret = TRUE;
+out:
+
+  return ret;
+}
+
+static gboolean
+flatpak_export_dir (GFile        *source,
+                    GFile        *destination,
+                    const char   *symlink_prefix,
+                    GCancellable *cancellable,
+                    GError      **error)
+{
+  const char *exported_subdirs[] = {
+    "share/applications",                  "../..",
+    "share/icons",                         "../..",
+    "share/dbus-1/services",               "../../..",
+    "share/gnome-shell/search-providers",  "../../..",
+    "share/mime/packages",                 "../../..",
+    "bin",                                 "..",
+  };
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS(exported_subdirs); i = i + 2)
+    {
+      /* The fds are closed by this call */
+      g_autoptr(GFile) sub_source = g_file_resolve_relative_path (source, exported_subdirs[i]);
+      g_autoptr(GFile) sub_destination = g_file_resolve_relative_path (destination, exported_subdirs[i]);
+      g_autofree char *sub_symlink_prefix = g_build_filename (exported_subdirs[i+1], symlink_prefix, exported_subdirs[i], NULL);
+
+      if (!g_file_query_exists (sub_source, cancellable))
+        continue;
+
+      if (!flatpak_mkdir_p (sub_destination, cancellable, error))
+        return FALSE;
+
+      if (!export_dir (AT_FDCWD, flatpak_file_get_path_cached (sub_source), sub_symlink_prefix, "",
+                       AT_FDCWD, flatpak_file_get_path_cached (sub_destination),
+                       cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_update_exports (FlatpakDir   *self,
+                            const char   *changed_app,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) exports = NULL;
+  g_autofree char *current_ref = NULL;
+  g_autofree char *active_id = NULL;
+  g_autofree char *symlink_prefix = NULL;
+
+  exports = flatpak_dir_get_exports_dir (self);
+
+  if (!flatpak_mkdir_p (exports, cancellable, error))
+    goto out;
+
+  if (changed_app &&
+      (current_ref = flatpak_dir_current_ref (self, changed_app, cancellable)) &&
+      (active_id = flatpak_dir_read_active (self, current_ref, cancellable)))
+    {
+      g_autoptr(GFile) deploy_base = NULL;
+      g_autoptr(GFile) active = NULL;
+      g_autoptr(GFile) export = NULL;
+
+      deploy_base = flatpak_dir_get_deploy_dir (self, current_ref);
+      active = g_file_get_child (deploy_base, active_id);
+      export = g_file_get_child (active, "export");
+
+      if (g_file_query_exists (export, cancellable))
+        {
+          symlink_prefix = g_build_filename ("..", "app", changed_app, "current", "active", "export", NULL);
+          if (!flatpak_export_dir (export, exports,
+                                   symlink_prefix,
+                                   cancellable,
+                                   error))
+            goto out;
+        }
+    }
+
+  if (!flatpak_remove_dangling_symlinks (exports, cancellable, error))
+    goto out;
+
+  if (!flatpak_dir_run_triggers (self, cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+static gboolean
+extract_extra_data (FlatpakDir          *self,
+                    const char          *checksum,
+                    GFile               *extradir,
+                    gboolean            *created_extra_data,
+                    GCancellable        *cancellable,
+                    GError             **error)
+{
+  g_autoptr(GVariant) detached_metadata = NULL;
+  g_autoptr(GVariant) extra_data = NULL;
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  g_autoptr(GError) local_error = NULL;
+  gsize i, n_extra_data = 0;
+  gsize n_extra_data_sources;
+
+  extra_data_sources = flatpak_repo_get_extra_data_sources (self->repo, checksum,
+                                                            cancellable, &local_error);
+  if (extra_data_sources == NULL)
+    {
+      /* This should protect us against potential errors at the OSTree level
+         (e.g. ostree_repo_load_variant), so that we don't report success. */
+      if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          return FALSE;
+        }
+
+      return TRUE;
+    }
+
+  n_extra_data_sources = g_variant_n_children (extra_data_sources);
+  if (n_extra_data_sources == 0)
+    return TRUE;
+
+  g_debug ("extracting extra data to %s", g_file_get_path (extradir));
+
+  if (!ostree_repo_read_commit_detached_metadata (self->repo, checksum, &detached_metadata,
+                                                  cancellable, error))
+    {
+      g_prefix_error (error, _("While getting detached metadata: "));
+      return FALSE;
+    }
+
+  if (detached_metadata == NULL)
+    return flatpak_fail (error, "Extra data missing in detached metadata");
+
+  extra_data = g_variant_lookup_value (detached_metadata, "xa.extra-data",
+                                       G_VARIANT_TYPE ("a(ayay)"));
+  if (extra_data == NULL)
+    return flatpak_fail (error, "Extra data missing in detached metadata");
+
+  n_extra_data = g_variant_n_children (extra_data);
+  if (n_extra_data < n_extra_data_sources)
+    return flatpak_fail (error, "Extra data missing in detached metadata");
+
+  if (!flatpak_mkdir_p (extradir, cancellable, error))
+    {
+      g_prefix_error (error, _("While creating extradir: "));
+      return FALSE;
+    }
+
+  for (i = 0; i < n_extra_data_sources; i++)
+    {
+      g_autofree char *extra_data_sha256 = NULL;
+      const guchar *extra_data_sha256_bytes;
+      const char *extra_data_source_name = NULL;
+      guint64 download_size;
+      gboolean found;
+      int j;
+
+      flatpak_repo_parse_extra_data_sources (extra_data_sources, i,
+                                             &extra_data_source_name,
+                                             &download_size,
+                                             NULL,
+                                             &extra_data_sha256_bytes,
+                                             NULL);
+
+      if (extra_data_sha256_bytes == NULL)
+        return flatpak_fail (error, _("Invalid sha256 for extra data"));
+
+      extra_data_sha256 = ostree_checksum_from_bytes (extra_data_sha256_bytes);
+
+      /* We need to verify the data in the commitmeta again, because the only signed
+         thing is the commit, which has the source info. We could have accidentally
+         picked up some other commitmeta stuff from the remote, or via the untrusted
+         local-pull of the system helper. */
+      found = FALSE;
+      for (j = 0; j < n_extra_data; j++)
+        {
+          g_autoptr(GVariant) content = NULL;
+          g_autoptr(GFile) dest = NULL;
+          g_autofree char *sha256 = NULL;
+          const char *extra_data_name = NULL;
+          const guchar  *data;
+          gsize len;
+
+          g_variant_get_child (extra_data, j, "(^ay@ay)",
+                               &extra_data_name,
+                               &content);
+
+          if (strcmp (extra_data_source_name, extra_data_name) != 0)
+            continue;
+
+          data = g_variant_get_data (content);
+          len = g_variant_get_size (content);
+
+          if (len != download_size)
+            return flatpak_fail (error, _("Wrong size for extra data"));
+
+          sha256 = g_compute_checksum_for_data (G_CHECKSUM_SHA256, data, len);
+          if (strcmp (sha256, extra_data_sha256) != 0)
+            return flatpak_fail (error, _("Invalid checksum for extra data"));
+
+          dest = g_file_get_child (extradir, extra_data_name);
+          if (!g_file_replace_contents (dest,
+                                        g_variant_get_data (content),
+                                        g_variant_get_size (content),
+                                        NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
+                                        NULL, cancellable, error))
+            {
+              g_prefix_error (error, _("While writing extra data file '%s': "), extra_data_name);
+              return FALSE;
+            }
+          found = TRUE;
+        }
+
+      if (!found)
+        return flatpak_fail (error, "Extra data %s missing in detached metadata", extra_data_source_name);
+    }
+
+  *created_extra_data = TRUE;
+
+  return TRUE;
+}
+
+static void
+child_setup (gpointer user_data)
+{
+  GArray *fd_array = user_data;
+  int i;
+
+  /* If no fd_array was specified, don't care. */
+  if (fd_array == NULL)
+    return;
+
+  /* Otherwise, mark not - close-on-exec all the fds in the array */
+  for (i = 0; i < fd_array->len; i++)
+    {
+      int fd = g_array_index (fd_array, int, i);
+
+      /* We also seek all fds to the start, because this lets
+         us use the same fd_array multiple times */
+      if (lseek (fd, 0, SEEK_SET) < 0)
+        g_printerr ("lseek error in child setup");
+
+      fcntl (fd, F_SETFD, 0);
+    }
+}
+
+static gboolean
+apply_extra_data (FlatpakDir          *self,
+                  GFile               *checkoutdir,
+                  GCancellable        *cancellable,
+                  GError             **error)
+{
+  g_autoptr(GFile) metadata = NULL;
+  g_autofree char *metadata_contents = NULL;
+  gsize metadata_size;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autofree char *id = NULL;
+  g_autofree char *runtime = NULL;
+  g_autofree char *runtime_ref = NULL;
+  g_autoptr(FlatpakDeploy) runtime_deploy = NULL;
+  g_autoptr(FlatpakBwrap) bwrap = NULL;
+  g_autoptr(GFile) app_files = NULL;
+  g_autoptr(GFile) apply_extra_file = NULL;
+  g_autoptr(GFile) app_export_file = NULL;
+  g_autoptr(GFile) extra_export_file = NULL;
+  g_autoptr(GFile) extra_files = NULL;
+  g_autoptr(GFile) runtime_files = NULL;
+  g_auto(GStrv) runtime_ref_parts = NULL;
+  g_autoptr(FlatpakContext) app_context = NULL;
+  g_auto(GStrv) minimal_envp = NULL;
+  int exit_status;
+  const char *group = FLATPAK_METADATA_GROUP_APPLICATION;
+  g_autoptr(GError) local_error = NULL;
+
+  apply_extra_file = g_file_resolve_relative_path (checkoutdir, "files/bin/apply_extra");
+  if (!g_file_query_exists (apply_extra_file, cancellable))
+    return TRUE;
+
+  metadata = g_file_get_child (checkoutdir, "metadata");
+
+  if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, error))
+    return FALSE;
+
+  metakey = g_key_file_new ();
+  if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
+    return FALSE;
+
+  id = g_key_file_get_string (metakey, group, FLATPAK_METADATA_KEY_NAME,
+                              &local_error);
+  if (id == NULL)
+    {
+      group = FLATPAK_METADATA_GROUP_RUNTIME;
+      id = g_key_file_get_string (metakey, group, FLATPAK_METADATA_KEY_NAME,
+                                  NULL);
+      if (id == NULL)
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          return FALSE;
+        }
+      g_clear_error (&local_error);
+    }
+
+  runtime = g_key_file_get_string (metakey, group,
+                                   FLATPAK_METADATA_KEY_RUNTIME, error);
+  if (runtime == NULL)
+    return FALSE;
+
+  runtime_ref = g_build_filename ("runtime", runtime, NULL);
+
+  runtime_ref_parts = flatpak_decompose_ref (runtime_ref, error);
+  if (runtime_ref_parts == NULL)
+    return FALSE;
+
+  if (!g_key_file_get_boolean (metakey, FLATPAK_METADATA_GROUP_EXTRA_DATA,
+                               FLATPAK_METADATA_KEY_NO_RUNTIME, NULL))
+    {
+      runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, cancellable, error);
+      if (runtime_deploy == NULL)
+        return FALSE;
+      runtime_files = flatpak_deploy_get_files (runtime_deploy);
+    }
+
+  app_files = g_file_get_child (checkoutdir, "files");
+  app_export_file = g_file_get_child (checkoutdir, "export");
+  extra_files = g_file_get_child (app_files, "extra");
+  extra_export_file = g_file_get_child (extra_files, "export");
+
+  minimal_envp = flatpak_run_get_minimal_env (FALSE, FALSE);
+  bwrap = flatpak_bwrap_new (minimal_envp);
+  flatpak_bwrap_add_args (bwrap, flatpak_get_bwrap (), NULL);
+
+  if (runtime_files)
+    flatpak_bwrap_add_args (bwrap,
+                            "--ro-bind", flatpak_file_get_path_cached (runtime_files), "/usr",
+                            "--lock-file", "/usr/.ref",
+                            NULL);
+
+  flatpak_bwrap_add_args (bwrap,
+                          "--ro-bind", flatpak_file_get_path_cached (app_files), "/app",
+                          "--bind", flatpak_file_get_path_cached (extra_files), "/app/extra",
+                          "--chdir", "/app/extra",
+                          NULL);
+
+  if (!flatpak_run_setup_base_argv (bwrap, runtime_files, NULL, runtime_ref_parts[2],
+                                    FLATPAK_RUN_FLAG_NO_SESSION_HELPER,
+                                    error))
+    return FALSE;
+
+  app_context = flatpak_context_new ();
+
+  if (!flatpak_run_add_environment_args (bwrap, NULL,
+                                         FLATPAK_RUN_FLAG_NO_SESSION_BUS_PROXY |
+                                         FLATPAK_RUN_FLAG_NO_SYSTEM_BUS_PROXY |
+                                         FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY,
+                                         id,
+                                         app_context, NULL, NULL, cancellable, error))
+    return FALSE;
+
+  g_ptr_array_add (bwrap->argv, g_strdup ("/app/bin/apply_extra"));
+
+  g_ptr_array_add (bwrap->argv, NULL);
+
+  g_debug ("Running /app/bin/apply_extra ");
+
+  if (!g_spawn_sync (NULL,
+                     (char **) bwrap->argv->pdata,
+                     bwrap->envp,
+                     G_SPAWN_SEARCH_PATH,
+                     child_setup, bwrap->fds,
+                     NULL, NULL,
+                     &exit_status,
+                     error))
+    return FALSE;
+
+  if (exit_status != 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   _("apply_extra script failed, exit status %d"), exit_status);
+      return FALSE;
+    }
+
+  if (g_file_query_exists (extra_export_file, cancellable))
+    {
+      if (!flatpak_mkdir_p (app_export_file, cancellable, error))
+        return FALSE;
+      if (!flatpak_cp_a (extra_export_file,
+                         app_export_file,
+                         FLATPAK_CP_FLAGS_MERGE,
+                         cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_deploy (FlatpakDir          *self,
+                    const char          *origin,
+                    const char          *ref,
+                    const char          *checksum_or_latest,
+                    const char * const * subpaths,
+                    GVariant            *old_deploy_data,
+                    GCancellable        *cancellable,
+                    GError             **error)
+{
+  g_autofree char *resolved_ref = NULL;
+
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) checkoutdir = NULL;
+  g_autoptr(GFile) bindir = NULL;
+  g_autofree char *checkoutdirpath = NULL;
+  g_autoptr(GFile) real_checkoutdir = NULL;
+  g_autoptr(GFile) dotref = NULL;
+  g_autoptr(GFile) files_etc = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_autoptr(GFile) deploy_data_file = NULL;
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autoptr(GFile) export = NULL;
+  g_autoptr(GFile) extradir = NULL;
+  g_autoptr(GKeyFile) keyfile = NULL;
+  guint64 installed_size = 0;
+  OstreeRepoCheckoutAtOptions options = { 0, };
+  const char *checksum;
+  glnx_autofd int checkoutdir_dfd = -1;
+  g_autoptr(GFile) tmp_dir_template = NULL;
+  g_autoptr(GVariant) commit_data = NULL;
+  g_autofree char *tmp_dir_path = NULL;
+  g_autofree char *alt_id = NULL;
+  const char *xa_metadata = NULL;
+  const char *xa_ref = NULL;
+  g_autofree char *checkout_basename = NULL;
+  gboolean created_extra_data = FALSE;
+  g_autoptr(GVariant) commit_metadata = NULL;
+  GVariantBuilder metadata_builder;
+  g_auto(GLnxLockFile) lock = { 0, };
+  gboolean is_app;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  /* Keep a shared repo lock to avoid prunes removing objects we're relying on
+   * while we do the checkout. This could happen if the ref changes after we
+   * read its current value for the checkout. */
+  if (!flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error))
+    return FALSE;
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+
+  if (checksum_or_latest == NULL)
+    {
+      g_debug ("No checksum specified, getting tip of %s from origin %s", ref, origin);
+
+      resolved_ref = flatpak_dir_read_latest (self, origin, ref, NULL, cancellable, error);
+      if (resolved_ref == NULL)
+        {
+          g_prefix_error (error, _("While trying to resolve ref %s: "), ref);
+          return FALSE;
+        }
+
+      checksum = resolved_ref;
+      g_debug ("tip resolved to: %s", checksum);
+    }
+  else
+    {
+      g_autoptr(GFile) root = NULL;
+      g_autofree char *commit = NULL;
+
+      checksum = checksum_or_latest;
+      g_debug ("Looking for checksum %s in local repo", checksum);
+      if (!ostree_repo_read_commit (self->repo, checksum, &root, &commit, cancellable, NULL))
+        return flatpak_fail (error, _("%s is not available"), ref);
+    }
+
+  if (!ostree_repo_load_commit (self->repo, checksum, &commit_data, NULL, error))
+    return FALSE;
+
+  commit_metadata = g_variant_get_child_value (commit_data, 0);
+  g_variant_lookup (commit_metadata, "xa.alt-id", "s", &alt_id);
+
+  checkout_basename = flatpak_dir_get_deploy_subdir (self, checksum, subpaths);
+
+  real_checkoutdir = g_file_get_child (deploy_base, checkout_basename);
+  if (g_file_query_exists (real_checkoutdir, cancellable))
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                   _("%s branch %s already installed"), ref, checksum);
+      return FALSE;
+    }
+
+  g_autofree char *template = g_strdup_printf (".%s-XXXXXX", checkout_basename);
+  tmp_dir_template = g_file_get_child (deploy_base, template);
+  tmp_dir_path = g_file_get_path (tmp_dir_template);
+
+  if (g_mkdtemp_full (tmp_dir_path, 0755) == NULL)
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           _("Can't create deploy directory"));
+      return FALSE;
+    }
+
+  checkoutdir = g_file_new_for_path (tmp_dir_path);
+
+  if (!ostree_repo_read_commit (self->repo, checksum, &root, NULL, cancellable, error))
+    {
+      g_prefix_error (error, _("Failed to read commit %s: "), checksum);
+      return FALSE;
+    }
+
+  if (!flatpak_repo_collect_sizes (self->repo, root, &installed_size, NULL, cancellable, error))
+    return FALSE;
+
+  options.mode = OSTREE_REPO_CHECKOUT_MODE_USER;
+  options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES;
+  options.enable_fsync = FALSE; /* We checkout to a temp dir and sync before moving it in place */
+  options.bareuseronly_dirs = TRUE; /* https://github.com/ostreedev/ostree/pull/927 */
+  checkoutdirpath = g_file_get_path (checkoutdir);
+
+  if (subpaths == NULL || *subpaths == NULL)
+    {
+      if (!ostree_repo_checkout_at (self->repo, &options,
+                                    AT_FDCWD, checkoutdirpath,
+                                    checksum,
+                                    cancellable, error))
+        {
+          g_prefix_error (error, _("While trying to checkout %s into %s: "), checksum, checkoutdirpath);
+          return FALSE;
+        }
+    }
+  else
+    {
+      g_autofree char *checkoutdirpath = g_file_get_path (checkoutdir);
+      g_autoptr(GFile) files = g_file_get_child (checkoutdir, "files");
+      g_autoptr(GFile) root = NULL;
+      g_autofree char *commit = NULL;
+      int i;
+
+      if (!g_file_make_directory_with_parents (files, cancellable, error))
+        return FALSE;
+
+      options.subpath = "/metadata";
+
+      if (!ostree_repo_read_commit (self->repo, checksum, &root,  &commit, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_checkout_at (self->repo, &options,
+                                    AT_FDCWD, checkoutdirpath,
+                                    checksum,
+                                    cancellable, error))
+        {
+          g_prefix_error (error, _("While trying to checkout metadata subpath: "));
+          return FALSE;
+        }
+
+      for (i = 0; subpaths[i] != NULL; i++)
+        {
+          g_autofree char *subpath = g_build_filename ("/files", subpaths[i], NULL);
+          g_autofree char *dstpath = g_build_filename (checkoutdirpath, "/files", subpaths[i], NULL);
+          g_autofree char *dstpath_parent = g_path_get_dirname (dstpath);
+          g_autoptr(GFile) child = NULL;
+
+          child = g_file_resolve_relative_path (root, subpath);
+
+          if (!g_file_query_exists (child, cancellable))
+            {
+              g_debug ("subpath %s not in tree", subpaths[i]);
+              continue;
+            }
+
+          if (g_mkdir_with_parents (dstpath_parent, 0755))
+            {
+              glnx_set_error_from_errno (error);
+              return FALSE;
+            }
+
+          options.subpath = subpath;
+          if (!ostree_repo_checkout_at (self->repo, &options,
+                                        AT_FDCWD, dstpath,
+                                        checksum,
+                                        cancellable, error))
+            {
+              g_prefix_error (error, _("While trying to checkout metadata subpath: "));
+              return FALSE;
+            }
+        }
+    }
+
+  /* Extract any extra data */
+  extradir = g_file_resolve_relative_path (checkoutdir, "files/extra");
+  if (!flatpak_rm_rf (extradir, cancellable, error))
+    {
+      g_prefix_error (error, _("While trying to remove existing extra dir: "));
+      return FALSE;
+    }
+
+  if (!extract_extra_data (self, checksum, extradir, &created_extra_data, cancellable, error))
+    return FALSE;
+
+  if (created_extra_data)
+    {
+      if (!apply_extra_data (self, checkoutdir, cancellable, error))
+        {
+          g_prefix_error (error, _("While trying to apply extra data: "));
+          return FALSE;
+        }
+    }
+
+  g_variant_lookup (commit_metadata, "xa.ref", "s", &xa_ref);
+  if (xa_ref != NULL)
+    {
+      gboolean gpg_verify_summary;
+
+      if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, origin, &gpg_verify_summary, error))
+        return FALSE;
+
+      if (gpg_verify_summary)
+        {
+          /* If we're using signed summaries, then the security is really due to the signatures on
+           * the summary, and the xa.ref is not needed for security. In particular, endless are
+           * currently using one single commit on multiple branches to handle devel/stable promotion.
+           * So, to support this we report branch discrepancies as a warning, rather than as an error.
+           * See https://github.com/flatpak/flatpak/pull/1013 for more discussion.
+           */
+          g_auto(GStrv) checkout_ref = NULL;
+          g_auto(GStrv) commit_ref = NULL;
+
+          checkout_ref = flatpak_decompose_ref (ref, error);
+          if (checkout_ref == NULL)
+            {
+              g_prefix_error (error, _("Invalid deployed ref %s: "), ref);
+              return FALSE;
+            }
+
+          commit_ref = flatpak_decompose_ref (xa_ref, error);
+          if (commit_ref == NULL)
+            {
+              g_prefix_error (error, _("Invalid commit ref %s: "), xa_ref);
+              return FALSE;
+            }
+
+          /* Fatal if kind/name/arch don't match. Warn for branch mismatch. */
+          if (strcmp (checkout_ref[0], commit_ref[0]) != 0)
+            {
+              g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                           _("Deployed ref %s kind does not match commit (%s)"),
+                           ref, xa_ref);
+              return FALSE;
+            }
+
+          if (strcmp (checkout_ref[1], commit_ref[1]) != 0)
+            {
+              g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                           _("Deployed ref %s name does not match commit (%s)"),
+                           ref, xa_ref);
+              return FALSE;
+            }
+
+          if (strcmp (checkout_ref[2], commit_ref[2]) != 0)
+            {
+              g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                           _("Deployed ref %s arch does not match commit (%s)"),
+                           ref, xa_ref);
+              return FALSE;
+            }
+
+          if (strcmp (checkout_ref[3], commit_ref[3]) != 0)
+            g_warning (_("Deployed ref %s branch does not match commit (%s)"),
+                       ref, xa_ref);
+        }
+      else if (strcmp (ref, xa_ref) != 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                       _("Deployed ref %s does not match commit (%s)"), ref, xa_ref);
+          return FALSE;
+        }
+    }
+
+  /* Check the metadata in the commit to make sure it matches the actual
+     deployed metadata, in case we relied on the one in the commit for
+     a decision */
+  g_variant_lookup (commit_metadata, "xa.metadata", "s", &xa_metadata);
+  if (xa_metadata != NULL)
+    {
+      g_autoptr(GFile) metadata_file = g_file_resolve_relative_path (checkoutdir, "metadata");
+      char *metadata_contents;
+
+      if (!g_file_load_contents (metadata_file, NULL,
+                                 &metadata_contents, NULL, NULL, NULL) ||
+          strcmp (metadata_contents, xa_metadata) != 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+                       _("Deployed metadata does not match commit"));
+          return FALSE;
+        }
+    }
+
+  dotref = g_file_resolve_relative_path (checkoutdir, "files/.ref");
+  if (!g_file_replace_contents (dotref, "", 0, NULL, FALSE,
+                                G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error))
+    return TRUE;
+
+
+  keyfile = g_key_file_new ();
+  metadata = g_file_get_child (checkoutdir, "metadata");
+  if (g_file_query_exists (metadata, cancellable))
+    {
+      g_autofree char *path = g_file_get_path (metadata);
+
+      if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, error))
+        return FALSE;
+    }
+
+  export = g_file_get_child (checkoutdir, "export");
+
+  /* Never export any binaries bundled with the app */
+  bindir = g_file_get_child (export, "bin");
+  if (!flatpak_rm_rf (bindir, cancellable, error))
+    return FALSE;
+
+  is_app = g_str_has_prefix (ref, "app/");
+
+  if (!is_app) /* is runtime */
+    {
+      /* Ensure that various files exists as regular files in /usr/etc, as we
+         want to bind-mount over them */
+      files_etc = g_file_resolve_relative_path (checkoutdir, "files/etc");
+      if (g_file_query_exists (files_etc, cancellable))
+        {
+          char *etcfiles[] = {"passwd", "group", "machine-id" };
+          g_autoptr(GFile) etc_resolve_conf = g_file_get_child (files_etc, "resolv.conf");
+          int i;
+          for (i = 0; i < G_N_ELEMENTS (etcfiles); i++)
+            {
+              g_autoptr(GFile) etc_file = g_file_get_child (files_etc, etcfiles[i]);
+              GFileType type;
+
+              type = g_file_query_file_type (etc_file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                             cancellable);
+              if (type == G_FILE_TYPE_REGULAR)
+                continue;
+
+              if (type != G_FILE_TYPE_UNKNOWN)
+                {
+                  /* Already exists, but not regular, probably symlink. Remove it */
+                  if (!g_file_delete (etc_file, cancellable, error))
+                    return FALSE;
+                }
+
+              if (!g_file_replace_contents (etc_file, "", 0, NULL, FALSE,
+                                            G_FILE_CREATE_REPLACE_DESTINATION,
+                                            NULL, cancellable, error))
+                return FALSE;
+            }
+
+          if (g_file_query_exists (etc_resolve_conf, cancellable) &&
+              !g_file_delete (etc_resolve_conf, cancellable, error))
+            return TRUE;
+
+          if (!g_file_make_symbolic_link (etc_resolve_conf,
+                                          "/run/host/monitor/resolv.conf",
+                                          cancellable, error))
+            return FALSE;
+        }
+
+      /* Runtime should never export anything */
+      if (!flatpak_rm_rf (export, cancellable, error))
+        return FALSE;
+    }
+  else /* is app */
+    {
+      g_auto(GStrv) ref_parts = g_strsplit (ref, "/", -1);
+      g_autoptr(GFile) wrapper = g_file_get_child (bindir, ref_parts[1]);
+      g_autofree char *escaped_app = maybe_quote (ref_parts[1]);
+      g_autofree char *escaped_branch = maybe_quote (ref_parts[3]);
+      g_autofree char *escaped_arch = maybe_quote (ref_parts[2]);
+      g_autofree char *bin_data = NULL;
+      int r;
+
+      if (!flatpak_mkdir_p (bindir, cancellable, error))
+        return FALSE;
+
+      bin_data = g_strdup_printf ("#!/bin/sh\nexec %s/flatpak run --branch=%s --arch=%s %s \"$@\"\n",
+                                  FLATPAK_BINDIR, escaped_branch, escaped_arch, escaped_app);
+      if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE,
+                                    G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error))
+        return FALSE;
+
+      do
+        r = fchmodat (AT_FDCWD, flatpak_file_get_path_cached (wrapper), 0755, 0);
+      while (G_UNLIKELY (r == -1 && errno == EINTR));
+      if (r == -1)
+        return glnx_throw_errno_prefix (error, "fchmodat");
+
+      if (!flatpak_rewrite_export_dir (ref_parts[1], ref_parts[3], ref_parts[2],
+                                       keyfile, export,
+                                       cancellable,
+                                       error))
+        return FALSE;
+
+    }
+
+  g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));
+  if (alt_id)
+    g_variant_builder_add (&metadata_builder, "{s@v}", "alt-id",
+                           g_variant_new_variant (g_variant_new_string (alt_id)));
+
+  deploy_data = flatpak_dir_new_deploy_data (origin,
+                                             checksum,
+                                             (char **) subpaths,
+                                             installed_size,
+                                             g_variant_builder_end (&metadata_builder));
+
+  deploy_data_file = g_file_get_child (checkoutdir, "deploy");
+  if (!flatpak_variant_save (deploy_data_file, deploy_data, cancellable, error))
+    return FALSE;
+
+  if (!glnx_opendirat (AT_FDCWD, checkoutdirpath, TRUE, &checkoutdir_dfd, error))
+    return FALSE;
+
+  if (syncfs (checkoutdir_dfd) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  if (!g_file_move (checkoutdir, real_checkoutdir, G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
+                    cancellable, NULL, NULL, error))
+    return FALSE;
+
+  if (!flatpak_dir_set_active (self, ref, checkout_basename, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+/* -origin remotes are deleted when the last ref refering to it is undeployed */
+void
+flatpak_dir_prune_origin_remote (FlatpakDir *self,
+                                 const char *remote)
+{
+  if (remote != NULL &&
+      g_str_has_suffix (remote, "-origin") &&
+      flatpak_dir_get_remote_noenumerate (self, remote) &&
+      !flatpak_dir_remote_has_deploys (self, remote))
+    {
+      if (flatpak_dir_use_system_helper (self, NULL))
+        {
+          FlatpakSystemHelper *system_helper;
+          const char *installation = flatpak_dir_get_id (self);
+          g_autoptr(GVariant) gpg_data_v = NULL;
+
+          system_helper = flatpak_dir_get_system_helper (self);
+          g_assert (system_helper != NULL);
+
+          gpg_data_v = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL));
+
+          g_debug ("Calling system helper: ConfigureRemote");
+          flatpak_system_helper_call_configure_remote_sync (system_helper,
+                                                            0, remote,
+                                                            "",
+                                                            gpg_data_v,
+                                                            installation ? installation : "",
+                                                            NULL, NULL);
+        }
+      else
+        ostree_repo_remote_delete (self->repo, remote, NULL, NULL);
+    }
+}
+
+gboolean
+flatpak_dir_deploy_install (FlatpakDir   *self,
+                            const char   *ref,
+                            const char   *origin,
+                            const char  **subpaths,
+                            gboolean      reinstall,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  g_auto(GLnxLockFile) lock = { 0, };
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) old_deploy_dir = NULL;
+  gboolean created_deploy_base = FALSE;
+  gboolean ret = FALSE;
+  g_autoptr(GError) local_error = NULL;
+  g_auto(GStrv) ref_parts = g_strsplit (ref, "/", -1);
+  g_autofree char *remove_ref_from_remote = NULL;
+
+  if (!flatpak_dir_lock (self, &lock,
+                         cancellable, error))
+    goto out;
+
+  old_deploy_dir = flatpak_dir_get_if_deployed (self, ref, NULL, cancellable);
+  if (old_deploy_dir != NULL)
+    {
+      if (reinstall)
+        {
+          g_autofree char *old_active = flatpak_dir_read_active (self, ref, cancellable);
+          g_autoptr(GVariant) old_deploy = NULL;
+          const char *old_origin;
+
+          old_deploy = flatpak_load_deploy_data (old_deploy_dir, cancellable, error);
+          if (old_deploy == NULL)
+            goto out;
+
+          /* If the old install was from a different remote, remove the ref */
+          old_origin = flatpak_deploy_data_get_origin (old_deploy);
+          if (strcmp (old_origin, origin) != 0)
+            remove_ref_from_remote = g_strdup (old_origin);
+
+          g_debug ("Removing old deployment for reinstall");
+          if (!flatpak_dir_undeploy (self, ref, old_active,
+                                     TRUE, FALSE,
+                                     cancellable, error))
+            goto out;
+        }
+      else
+        {
+          g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                       _("%s branch %s already installed"), ref_parts[1], ref_parts[3]);
+          goto out;
+        }
+    }
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+  if (!g_file_make_directory_with_parents (deploy_base, cancellable, &local_error))
+    {
+      if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          goto out;
+        }
+    }
+
+  /* After we create the deploy base we must goto out on errors */
+  created_deploy_base = TRUE;
+
+  if (!flatpak_dir_deploy (self, origin, ref, NULL, (const char * const *) subpaths, NULL, cancellable, error))
+    goto out;
+
+  if (g_str_has_prefix (ref, "app/"))
+    {
+
+      if (!flatpak_dir_make_current_ref (self, ref, cancellable, error))
+        goto out;
+
+      if (!flatpak_dir_update_exports (self, ref_parts[1], cancellable, error))
+        goto out;
+    }
+
+  /* Remove old ref if the reinstalled was from a different remote */
+  if (remove_ref_from_remote != NULL)
+    {
+      if (!flatpak_dir_remove_ref (self, remove_ref_from_remote, ref, cancellable, error))
+        goto out;
+
+      flatpak_dir_prune_origin_remote (self, remove_ref_from_remote);
+    }
+
+  /* Release lock before doing possibly slow prune */
+  glnx_release_lock_file (&lock);
+
+  flatpak_dir_cleanup_removed (self, cancellable, NULL);
+
+  if (!flatpak_dir_mark_changed (self, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  if (created_deploy_base && !ret)
+    flatpak_rm_rf (deploy_base, cancellable, NULL);
+
+  return ret;
+}
+
+
+gboolean
+flatpak_dir_deploy_update (FlatpakDir   *self,
+                           const char   *ref,
+                           const char   *checksum_or_latest,
+                           const char **opt_subpaths,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autoptr(GVariant) old_deploy_data = NULL;
+  g_auto(GLnxLockFile) lock = { 0, };
+  g_autofree const char **old_subpaths = NULL;
+  g_autofree char *old_active = NULL;
+  const char *old_origin;
+
+  if (!flatpak_dir_lock (self, &lock,
+                         cancellable, error))
+    return FALSE;
+
+  old_deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                                 cancellable, error);
+  if (old_deploy_data == NULL)
+    return FALSE;
+
+  old_active = flatpak_dir_read_active (self, ref, cancellable);
+
+  old_origin = flatpak_deploy_data_get_origin (old_deploy_data);
+  old_subpaths = flatpak_deploy_data_get_subpaths (old_deploy_data);
+  if (!flatpak_dir_deploy (self,
+                           old_origin,
+                           ref,
+                           checksum_or_latest,
+                           opt_subpaths ? opt_subpaths : old_subpaths,
+                           old_deploy_data,
+                           cancellable, error))
+    return FALSE;
+
+  if (old_active &&
+      !flatpak_dir_undeploy (self, ref, old_active,
+                             TRUE, FALSE,
+                             cancellable, error))
+    return FALSE;
+
+  if (g_str_has_prefix (ref, "app/"))
+    {
+      g_auto(GStrv) ref_parts = g_strsplit (ref, "/", -1);
+
+      if (!flatpak_dir_update_exports (self, ref_parts[1], cancellable, error))
+        return FALSE;
+    }
+
+  /* Release lock before doing possibly slow prune */
+  glnx_release_lock_file (&lock);
+
+  flatpak_dir_prune (self, cancellable, NULL);
+
+  if (!flatpak_dir_mark_changed (self, error))
+    return FALSE;
+
+  flatpak_dir_cleanup_removed (self, cancellable, NULL);
+
+  return TRUE;
+}
+
+static FlatpakOciRegistry *
+flatpak_dir_create_system_child_oci_registry (FlatpakDir   *self,
+                                              GLnxLockFile *file_lock,
+                                              GError      **error)
+{
+  g_autoptr(GFile) cache_dir = NULL;
+  g_autoptr(GFile) repo_dir = NULL;
+  g_autofree char *repo_url = NULL;
+  g_autofree char *tmpdir_name = NULL;
+  g_autoptr(FlatpakOciRegistry) new_registry = NULL;
+
+  g_assert (!self->user);
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  cache_dir = flatpak_ensure_system_user_cache_dir_location (error);
+  if (cache_dir == NULL)
+    return NULL;
+
+  if (!flatpak_allocate_tmpdir (AT_FDCWD,
+                                flatpak_file_get_path_cached (cache_dir),
+                                "child-oci-", &tmpdir_name,
+                                NULL,
+                                file_lock,
+                                NULL,
+                                NULL, error))
+    return NULL;
+
+  repo_dir = g_file_get_child (cache_dir, tmpdir_name);
+  repo_url = g_file_get_uri (repo_dir);
+
+  new_registry = flatpak_oci_registry_new (repo_url, TRUE , -1,
+                                           NULL, error);
+  if (new_registry == NULL)
+    return NULL;
+
+  return g_steal_pointer (&new_registry);
+}
+
+
+static OstreeRepo *
+flatpak_dir_create_system_child_repo (FlatpakDir   *self,
+                                      GLnxLockFile *file_lock,
+                                      const char   *optional_commit,
+                                      GError      **error)
+{
+  g_autoptr(GFile) cache_dir = NULL;
+  g_autoptr(GFile) repo_dir = NULL;
+  g_autoptr(GFile) repo_dir_config = NULL;
+  g_autoptr(OstreeRepo) repo = NULL;
+  g_autofree char *tmpdir_name = NULL;
+  g_autoptr(OstreeRepo) new_repo = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  OstreeRepoMode mode = OSTREE_REPO_MODE_BARE_USER;
+  const char *mode_str = "bare-user";
+  g_autofree char *current_mode = NULL;
+  const char *mode_env = g_getenv ("FLATPAK_OSTREE_REPO_MODE");
+  GKeyFile *orig_config = NULL;
+  g_autofree char *orig_min_free_space_percent = NULL;
+
+  g_assert (!self->user);
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  orig_config = ostree_repo_get_config (self->repo);
+
+  cache_dir = flatpak_ensure_system_user_cache_dir_location (error);
+  if (cache_dir == NULL)
+    return NULL;
+
+  if (!flatpak_allocate_tmpdir (AT_FDCWD,
+                                flatpak_file_get_path_cached (cache_dir),
+                                "repo-", &tmpdir_name,
+                                NULL,
+                                file_lock,
+                                NULL,
+                                NULL, error))
+    return NULL;
+
+  repo_dir = g_file_get_child (cache_dir, tmpdir_name);
+
+  new_repo = ostree_repo_new (repo_dir);
+
+  /* Allow to override the mode when user-only is needed (e.g. live systems) */
+  if (g_strcmp0 (mode_env, "user-only") == 0) {
+    mode = OSTREE_REPO_MODE_BARE_USER_ONLY;
+    mode_str = "bare-user-only";
+  }
+
+  repo_dir_config = g_file_get_child (repo_dir, "config");
+  if (!g_file_query_exists (repo_dir_config, NULL))
+    {
+      if (!ostree_repo_create (new_repo, mode, NULL, error))
+        return NULL;
+    }
+  else
+    {
+      /* Try to open, but on failure, re-create */
+      if (!ostree_repo_open (new_repo, NULL, NULL))
+        {
+          flatpak_rm_rf (repo_dir, NULL, NULL);
+          if (!ostree_repo_create (new_repo, mode, NULL, error))
+            return NULL;
+        }
+    }
+
+  config = ostree_repo_copy_config (new_repo);
+
+  /* Verify that the mode is the expected one; if it isn't, recreate the repo */
+  current_mode = g_key_file_get_string (config, "core", "mode", NULL);
+  if (current_mode == NULL || g_strcmp0 (current_mode, mode_str) != 0)
+    {
+      flatpak_rm_rf (repo_dir, NULL, NULL);
+
+      /* Re-initialize the object because its dir's contents have been deleted (and it
+       * holds internal references to them) */
+      g_object_unref (new_repo);
+      new_repo = ostree_repo_new (repo_dir);
+
+      if (!ostree_repo_create (new_repo, mode, NULL, error))
+        return NULL;
+
+      /* Reload the repo config */
+      g_key_file_free (config);
+      config = ostree_repo_copy_config (new_repo);
+    }
+
+  /* Ensure the config is updated */
+  g_key_file_set_string (config, "core", "parent",
+                         flatpak_file_get_path_cached (ostree_repo_get_path (self->repo)));
+
+  /* Copy the min space percent value so it affects the temporary repo too */
+  orig_min_free_space_percent = g_key_file_get_value (orig_config, "core", "min-free-space-percent", NULL);
+  if (orig_min_free_space_percent)
+    g_key_file_set_value (config, "core", "min-free-space-percent", orig_min_free_space_percent);
+
+  if (!ostree_repo_write_config (new_repo, config, error))
+    return NULL;
+
+  /* We need to reopen to apply the parent config */
+  repo = system_ostree_repo_new (repo_dir);
+  if (!ostree_repo_open (repo, NULL, error))
+    return NULL;
+
+  /* Create a commitpartial in the child repo to ensure we download everything, because
+     any commitpartial state in the parent will not be inherited */
+  if (optional_commit)
+    {
+      g_autofree char *commitpartial_basename = g_strconcat (optional_commit, ".commitpartial", NULL);
+      g_autoptr(GFile) commitpartial =
+        flatpak_build_file (ostree_repo_get_path (repo),
+                            "state", commitpartial_basename, NULL);
+
+      g_file_replace_contents (commitpartial, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, NULL);
+    }
+  return g_steal_pointer (&repo);
+}
+
+gboolean
+flatpak_dir_install (FlatpakDir          *self,
+                     gboolean             no_pull,
+                     gboolean             no_deploy,
+                     gboolean             no_static_deltas,
+                     gboolean             reinstall,
+                     const char          *ref,
+                     const char          *remote_name,
+                     const char         **opt_subpaths,
+                     OstreeAsyncProgress *progress,
+                     GCancellable        *cancellable,
+                     GError             **error)
+{
+  FlatpakPullFlags flatpak_flags;
+
+  flatpak_flags = FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA;
+  if (no_static_deltas)
+    flatpak_flags |= FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      g_autoptr(OstreeRepo) child_repo = NULL;
+      g_auto(GLnxLockFile) child_repo_lock = { 0, };
+      const char *installation = flatpak_dir_get_id (self);
+      const char *empty_subpaths[] = {NULL};
+      const char **subpaths;
+      g_autofree char *child_repo_path = NULL;
+      FlatpakSystemHelper *system_helper;
+      FlatpakHelperDeployFlags helper_flags = 0;
+      g_autofree char *url = NULL;
+      gboolean gpg_verify_summary;
+      gboolean gpg_verify;
+      g_autofree char *collection_id = NULL;
+      gboolean is_oci;
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      if (opt_subpaths)
+        subpaths = opt_subpaths;
+      else
+        subpaths = empty_subpaths;
+
+      if (!flatpak_dir_ensure_repo (self, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_url (self->repo,
+                                       remote_name,
+                                       &url,
+                                       error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, remote_name,
+                                                      &gpg_verify_summary, error))
+        return FALSE;
+
+      if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify (self->repo, remote_name,
+                                              &gpg_verify, error))
+        return FALSE;
+
+      is_oci = flatpak_dir_get_remote_oci (self, remote_name);
+
+      if (no_pull)
+        {
+          /* Do nothing */
+        }
+      else if (is_oci)
+        {
+          g_autoptr(FlatpakOciRegistry) registry = NULL;
+          g_autoptr(GFile) registry_file = NULL;
+
+          registry = flatpak_dir_create_system_child_oci_registry (self, &child_repo_lock, error);
+          if (registry == NULL)
+            return FALSE;
+
+          registry_file = g_file_new_for_uri (flatpak_oci_registry_get_uri (registry));
+
+          child_repo_path = g_file_get_path (registry_file);
+
+          if (!flatpak_dir_mirror_oci (self, registry, remote_name, ref, NULL, progress, cancellable, error))
+            return FALSE;
+        }
+      else if ((!gpg_verify_summary && collection_id == NULL) || !gpg_verify)
+        {
+          /* The remote is not gpg verified, so we don't want to allow installation via
+             a download in the home directory, as there is no way to verify you're not
+             injecting anything into the remote. However, in the case of a remote
+             configured to a local filesystem we can just let the system helper do
+             the installation, as it can then avoid network i/o and be certain the
+             data comes from the right place.
+
+             If a collection ID is available, we can verify the refs in commit
+             metadata. */
+          if (g_str_has_prefix (url, "file:"))
+            helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL;
+          else
+            return flatpak_fail (error, "Can't pull from untrusted non-gpg verified remote");
+        }
+      else
+        {
+          /* We're pulling from a remote source, we do the network mirroring pull as a
+             user and hand back the resulting data to the system-helper, that trusts us
+             due to the GPG signatures in the repo */
+          g_autoptr(GBytes) summary_copy = NULL;
+          g_autoptr(GBytes) summary_sig_copy = NULL;
+          g_autoptr(GFile) summary_file = NULL;
+          g_autoptr(GFile) summary_sig_file = NULL;
+
+          child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, NULL, error);
+          if (child_repo == NULL)
+            return FALSE;
+
+          flatpak_flags |= FLATPAK_PULL_FLAGS_SIDELOAD_EXTRA_DATA;
+
+          if (!flatpak_dir_remote_fetch_summary (self, remote_name,
+                                                 &summary_copy, &summary_sig_copy,
+                                                 cancellable, error))
+            return FALSE;
+
+          /* Don’t resolve a rev or OstreeRepoFinderResult set early; the pull
+           * code will do this. */
+          /* FIXME: Ideally we could merge these two flatpak_dir_pull() calls
+           * so @ref and  %OSTREE_REPO_METADATA_REF are resolved atomically.
+           * However, pulling them separately is no worse than the old code path
+           * where the summary and ref were pulled separately. */
+          if (!flatpak_dir_pull (self, remote_name, ref, NULL, NULL, subpaths,
+                                 child_repo,
+                                 flatpak_flags,
+                                 OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 progress, cancellable, error))
+            return FALSE;
+
+#ifdef FLATPAK_ENABLE_P2P
+          if (collection_id != NULL &&
+              !flatpak_dir_pull (self, remote_name, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL,
+                                 child_repo,
+                                 flatpak_flags,
+                                 OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 progress, cancellable, error))
+            return FALSE;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+          summary_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary");
+          if (!g_file_replace_contents (summary_file,
+                                        g_bytes_get_data (summary_copy, NULL),
+                                        g_bytes_get_size (summary_copy),
+                                        NULL, FALSE, 0, NULL, cancellable, NULL))
+            return FALSE;
+
+          if (collection_id == NULL)
+            {
+              summary_sig_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary.sig");
+              if (!g_file_replace_contents (summary_sig_file,
+                                            g_bytes_get_data (summary_sig_copy, NULL),
+                                            g_bytes_get_size (summary_sig_copy),
+                                            NULL, FALSE, 0, NULL, cancellable, NULL))
+                return FALSE;
+            }
+
+          child_repo_path = g_file_get_path (ostree_repo_get_path (child_repo));
+        }
+
+      if (no_deploy)
+        helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY;
+
+      if (reinstall)
+        helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL;
+
+      g_debug ("Calling system helper: Deploy");
+      if (!flatpak_system_helper_call_deploy_sync (system_helper,
+                                                   child_repo_path ? child_repo_path : "",
+                                                   helper_flags, ref, remote_name,
+                                                   (const char * const *) subpaths,
+                                                   installation ? installation : "",
+                                                   cancellable,
+                                                   error))
+        return FALSE;
+
+      if (child_repo_path)
+        (void) glnx_shutil_rm_rf_at (AT_FDCWD, child_repo_path, NULL, NULL);
+
+      return TRUE;
+    }
+
+  if (!no_pull)
+    {
+      /* Don’t resolve a rev or OstreeRepoFinderResult set early; the pull
+       * code will do this. */
+      if (!flatpak_dir_pull (self, remote_name, ref, NULL, NULL, opt_subpaths, NULL,
+                             flatpak_flags, OSTREE_REPO_PULL_FLAGS_NONE,
+                             progress, cancellable, error))
+        return FALSE;
+    }
+
+  if (!no_deploy)
+    {
+      if (!flatpak_dir_deploy_install (self, ref, remote_name, opt_subpaths,
+                                       reinstall, cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+char *
+flatpak_dir_ensure_bundle_remote (FlatpakDir          *self,
+                                  GFile               *file,
+                                  GBytes              *extra_gpg_data,
+                                  char               **out_ref,
+                                  char               **out_metadata,
+                                  gboolean            *out_created_remote,
+                                  GCancellable        *cancellable,
+                                  GError             **error)
+{
+  g_autofree char *ref = NULL;
+  gboolean created_remote = FALSE;
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *origin = NULL;
+  g_autofree char *fp_metadata = NULL;
+  g_auto(GStrv) parts = NULL;
+  g_autofree char *basename = NULL;
+  g_autoptr(GBytes) included_gpg_data = NULL;
+  GBytes *gpg_data = NULL;
+  g_autofree char *to_checksum = NULL;
+  g_autofree char *remote = NULL;
+  g_autofree char *collection_id = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return NULL;
+
+  metadata = flatpak_bundle_load (file, &to_checksum,
+                                  &ref,
+                                  &origin,
+                                  NULL, &fp_metadata, NULL,
+                                  &included_gpg_data,
+                                  &collection_id,
+                                  error);
+  if (metadata == NULL)
+    return NULL;
+
+  gpg_data = extra_gpg_data ? extra_gpg_data : included_gpg_data;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return NULL;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref, cancellable, NULL);
+  if (deploy_data != NULL)
+    {
+      remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data));
+
+      /* We need to import any gpg keys because otherwise the pull will fail */
+      if (gpg_data != NULL)
+        {
+          g_autoptr(GKeyFile) new_config = NULL;
+
+          new_config = ostree_repo_copy_config (flatpak_dir_get_repo (self));
+
+          if (!flatpak_dir_modify_remote (self, remote, new_config,
+                                          gpg_data, cancellable, error))
+            return NULL;
+        }
+    }
+  else
+    {
+      /* Add a remote for later updates */
+      basename = g_file_get_basename (file);
+      remote = flatpak_dir_create_origin_remote (self,
+                                                 origin,
+                                                 parts[1],
+                                                 basename,
+                                                 ref,
+                                                 gpg_data,
+                                                 collection_id,
+                                                 cancellable,
+                                                 error);
+      if (remote == NULL)
+        return NULL;
+
+      /* From here we need to goto out on error, to clean up */
+      created_remote = TRUE;
+    }
+
+  if (out_created_remote)
+    *out_created_remote = created_remote;
+
+  if (out_ref)
+    *out_ref = g_steal_pointer (&ref);
+
+  if (out_metadata)
+    *out_metadata = g_steal_pointer (&fp_metadata);
+
+
+  return g_steal_pointer (&remote);
+}
+
+gboolean
+flatpak_dir_install_bundle (FlatpakDir          *self,
+                            GFile               *file,
+                            const char          *remote,
+                            char               **out_ref,
+                            GCancellable        *cancellable,
+                            GError             **error)
+{
+  g_autofree char *ref = NULL;
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *origin = NULL;
+  g_auto(GStrv) parts = NULL;
+  g_autofree char *to_checksum = NULL;
+  gboolean gpg_verify;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      FlatpakSystemHelper *system_helper;
+      const char *installation = flatpak_dir_get_id (self);
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      g_debug ("Calling system helper: InstallBundle");
+      if (!flatpak_system_helper_call_install_bundle_sync (system_helper,
+                                                           flatpak_file_get_path_cached (file),
+                                                           0, remote,
+                                                           installation ? installation : "",
+                                                           &ref,
+                                                           cancellable,
+                                                           error))
+        return FALSE;
+
+      if (out_ref)
+        *out_ref = g_steal_pointer (&ref);
+
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  metadata = flatpak_bundle_load (file, &to_checksum,
+                                  &ref,
+                                  &origin,
+                                  NULL, NULL,
+                                  NULL, NULL, NULL,
+                                  error);
+  if (metadata == NULL)
+    return FALSE;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return FALSE;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref, cancellable, NULL);
+  if (deploy_data != NULL)
+    {
+      if (strcmp (flatpak_deploy_data_get_commit (deploy_data), to_checksum) == 0)
+        {
+          g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                       _("This version of %s is already installed"), parts[1]);
+          return FALSE;
+        }
+
+      if (strcmp (remote, flatpak_deploy_data_get_origin (deploy_data)) != 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       _("Can't change remote during bundle install"));
+          return FALSE;
+        }
+    }
+
+  if (!ostree_repo_remote_get_gpg_verify (self->repo, remote,
+                                          &gpg_verify, error))
+    return FALSE;
+
+  if (!flatpak_pull_from_bundle (self->repo,
+                                 file,
+                                 remote,
+                                 ref,
+                                 gpg_verify,
+                                 cancellable,
+                                 error))
+    return FALSE;
+
+  if (deploy_data != NULL)
+    {
+      g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote);
+      g_autofree char *old_url = NULL;
+      g_autoptr(GKeyFile) new_config = NULL;
+
+      /* The pull succeeded, and this is an update. So, we need to update the repo config
+         if anything changed */
+
+      ostree_repo_remote_get_url (self->repo,
+                                  remote,
+                                  &old_url,
+                                  NULL);
+      if (origin != NULL &&
+          (old_url == NULL || strcmp (old_url, origin) != 0))
+        {
+          if (new_config == NULL)
+            new_config = ostree_repo_copy_config (self->repo);
+
+          g_key_file_set_value (new_config, group, "url", origin);
+        }
+
+      if (new_config)
+        {
+          if (!ostree_repo_write_config (self->repo, new_config, error))
+            return FALSE;
+        }
+    }
+
+  if (deploy_data)
+    {
+      if (!flatpak_dir_deploy_update (self, ref, NULL, NULL, cancellable, error))
+        return FALSE;
+    }
+  else
+    {
+      if (!flatpak_dir_deploy_install (self, ref, remote, NULL, FALSE, cancellable, error))
+        return FALSE;
+    }
+
+  if (out_ref)
+    *out_ref = g_steal_pointer (&ref);
+
+  return TRUE;
+}
+
+static gboolean
+_g_strv_equal0 (gchar **a, gchar **b)
+{
+  gboolean ret = FALSE;
+  guint n;
+  if (a == NULL && b == NULL)
+    {
+      ret = TRUE;
+      goto out;
+    }
+  if (a == NULL || b == NULL)
+    goto out;
+  if (g_strv_length (a) != g_strv_length (b))
+    goto out;
+  for (n = 0; a[n] != NULL; n++)
+    if (g_strcmp0 (a[n], b[n]) != 0)
+      goto out;
+  ret = TRUE;
+out:
+  return ret;
+}
+
+char *
+flatpak_dir_check_for_update (FlatpakDir          *self,
+                              const char          *ref,
+                              const char          *remote_name,
+                              const char          *checksum_or_latest,
+                              const char         **opt_subpaths,
+                              gboolean             no_pull,
+                              OstreeRepoFinderResult ***out_results,
+                              GCancellable        *cancellable,
+                              GError             **error)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autofree const char **old_subpaths = NULL;
+  g_autofree const char *remote_and_branch = NULL;
+  const char **subpaths;
+  g_autofree char *url = NULL;
+  g_autofree char *latest_rev = NULL;
+  const char *target_rev = NULL;
+  const char *installed_commit;
+  const char *installed_alt_id;
+  g_autofree char *collection_id = NULL;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                             cancellable, NULL);
+  if (deploy_data != NULL)
+    old_subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+  else
+    old_subpaths = g_new0 (const char *, 1); /* Empty strv == all subpatsh*/
+
+  if (opt_subpaths)
+    subpaths = opt_subpaths;
+  else
+    subpaths = old_subpaths;
+
+  installed_commit = flatpak_deploy_data_get_commit (deploy_data);
+  installed_alt_id = flatpak_deploy_data_get_alt_id (deploy_data);
+
+  if (!ostree_repo_remote_get_url (self->repo, remote_name, &url, error))
+    {
+      return NULL;
+    }
+
+  if (*url == 0)
+    {
+      /* Empty URL => disabled, but we preted to be already installed to avoid warnings */
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                   _("%s branch %s already installed"), ref, installed_commit);
+      return NULL;
+    }
+
+  if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+    return NULL;
+
+  if (no_pull)
+    {
+      remote_and_branch = g_strdup_printf ("%s:%s", remote_name, ref);
+      if (!ostree_repo_resolve_rev (self->repo, remote_and_branch, FALSE, &latest_rev, NULL))
+        {
+          g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                       _("%s branch %s already installed"), ref, installed_commit);
+          return NULL; /* No update, because nothing to update to */
+        }
+    }
+  else if (collection_id != NULL)
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      /* Find the latest rev from the remote and its available mirrors, including
+       * LAN and USB sources. */
+      g_autoptr(GMainContext) context = NULL;
+      g_autoptr(GAsyncResult) find_result = NULL;
+      g_auto(OstreeRepoFinderResultv) results = NULL;
+      OstreeCollectionRef collection_ref = { collection_id, (char *) ref };
+      OstreeCollectionRef *collection_refs_to_fetch[2] = { &collection_ref, NULL };
+      gsize i;
+
+      context = g_main_context_new ();
+      g_main_context_push_thread_default (context);
+
+      ostree_repo_find_remotes_async (self->repo, (const OstreeCollectionRef * const *) collection_refs_to_fetch,
+                                      NULL  /* no options */,
+                                      NULL  /* default finders */,
+                                      NULL  /* no progress reporting */,
+                                      cancellable, async_result_cb, &find_result);
+
+      while (find_result == NULL)
+        g_main_context_iteration (context, TRUE);
+
+      results = ostree_repo_find_remotes_finish (self->repo, find_result, error);
+      if (results == NULL)
+        return NULL;
+
+      for (i = 0; results[i] != NULL && latest_rev == NULL; i++)
+        latest_rev = g_strdup (g_hash_table_lookup (results[i]->ref_to_checksum, &collection_ref));
+
+      if (latest_rev == NULL)
+        {
+          flatpak_fail (error, "No such ref (%s, %s) in remote %s or elsewhere",
+                        collection_ref.collection_id, collection_ref.ref_name, remote_name);
+          return NULL;
+        }
+
+      if (out_results != NULL)
+        *out_results = g_steal_pointer (&results);
+#else  /* if !FLATPAK_ENABLE_P2P */
+      g_assert_not_reached ();
+#endif  /* !FLATPAK_ENABLE_P2P */
+    }
+  else
+    {
+      latest_rev = flatpak_dir_lookup_ref_from_summary (self, remote_name, ref, NULL, NULL, NULL, error);
+      if (latest_rev == NULL)
+        return NULL;
+    }
+
+  if (checksum_or_latest != NULL)
+    target_rev = checksum_or_latest;
+  else
+    target_rev = latest_rev;
+
+  /* Not deployed => update */
+  if (deploy_data == NULL)
+    return g_strdup (target_rev);
+
+  /* Different target commit than deployed => update */
+  if (g_strcmp0 (target_rev, installed_commit) != 0 &&
+      g_strcmp0 (target_rev, installed_alt_id) != 0)
+    return g_strdup (target_rev);
+
+  /* target rev is the same as latest, but maybe something else that is different? */
+
+  /* Same commit, but different subpaths => update */
+  if (!_g_strv_equal0 ((char **)subpaths, (char **)old_subpaths))
+    return g_strdup (target_rev);
+
+  g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+               _("%s branch %s already installed"), ref, installed_commit);
+  return NULL;
+}
+
+gboolean
+flatpak_dir_update (FlatpakDir          *self,
+                    gboolean             no_pull,
+                    gboolean             no_deploy,
+                    gboolean             no_static_deltas,
+                    gboolean             allow_downgrade,
+                    const char          *ref,
+                    const char          *remote_name,
+                    const char          *commit,
+                    const OstreeRepoFinderResult * const *results,
+                    const char         **opt_subpaths,
+                    OstreeAsyncProgress *progress,
+                    GCancellable        *cancellable,
+                    GError             **error)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+  const char **subpaths = NULL;
+  g_autofree char *url = NULL;
+  FlatpakPullFlags flatpak_flags;
+  g_autofree const char **old_subpaths = NULL;
+  gboolean is_oci;
+
+  /* This and @results are calculated in check_for_update. @results will be
+   * %NULL if we don’t support collections. */
+  g_assert (commit != NULL);
+
+  flatpak_flags = FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA;
+  if (allow_downgrade)
+    flatpak_flags |= FLATPAK_PULL_FLAGS_ALLOW_DOWNGRADE;
+  if (no_static_deltas)
+    flatpak_flags |= FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                             cancellable, NULL);
+
+  if (deploy_data != NULL)
+    old_subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+
+  if (opt_subpaths)
+    subpaths = opt_subpaths;
+  else
+    subpaths = old_subpaths;
+
+  if (!ostree_repo_remote_get_url (self->repo, remote_name, &url, error))
+    return FALSE;
+
+  if (*url == 0)
+    return TRUE; /* Empty URL => disabled */
+
+  is_oci = flatpak_dir_get_remote_oci (self, remote_name);
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      const char *installation = flatpak_dir_get_id (self);
+      g_autoptr(OstreeRepo) child_repo = NULL;
+      g_auto(GLnxLockFile) child_repo_lock = { 0, };
+      FlatpakSystemHelper *system_helper;
+      g_autofree char *child_repo_path = NULL;
+      FlatpakHelperDeployFlags helper_flags = 0;
+      g_autofree char *url = NULL;
+      gboolean gpg_verify_summary;
+      gboolean gpg_verify;
+      g_autofree char *collection_id = NULL;
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      if (!OSTREE_CHECK_VERSION(2017,13))
+        {
+          /* If the existing pull is partial, disable static deltas. They can
+           * break on ostree < 2017.13 which doesn't look at the parent repo for
+           * commitpartial state. This was fixed in
+           * https://github.com/ostreedev/ostree/commit/90ebd48f6aaf45c47b48c44354359f973dcf22a8
+           */
+          if (old_subpaths && old_subpaths[0] != NULL)
+            flatpak_flags |= FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS;
+        }
+
+      if (!flatpak_dir_ensure_repo (self, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_url (self->repo,
+                                       remote_name,
+                                       &url,
+                                       error))
+        return FALSE;
+
+      helper_flags = FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE;
+
+      if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, remote_name,
+                                                      &gpg_verify_summary, error))
+        return FALSE;
+
+      if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify (self->repo, remote_name,
+                                              &gpg_verify, error))
+        return FALSE;
+
+      if (no_pull)
+        {
+        }
+      else if ((!gpg_verify_summary && collection_id == NULL) || !gpg_verify)
+        {
+          /* The remote is not gpg verified, so we don't want to allow installation via
+             a download in the home directory, as there is no way to verify you're not
+             injecting anything into the remote. However, in the case of a remote
+             configured to a local filesystem we can just let the system helper do
+             the installation, as it can then avoid network i/o and be certain the
+             data comes from the right place.
+
+             If @collection_id is non-%NULL, we can verify the refs in commit
+             metadata, so don’t need to verify the summary. */
+          if (g_str_has_prefix (url, "file:"))
+            helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL;
+          else
+            return flatpak_fail (error, "Can't pull from untrusted non-gpg verified remote");
+        }
+      else if (is_oci)
+        {
+          g_autoptr(FlatpakOciRegistry) registry = NULL;
+          g_autoptr(GFile) registry_file = NULL;
+
+          registry = flatpak_dir_create_system_child_oci_registry (self, &child_repo_lock, error);
+          if (registry == NULL)
+            return FALSE;
+
+          registry_file = g_file_new_for_uri (flatpak_oci_registry_get_uri (registry));
+
+          child_repo_path = g_file_get_path (registry_file);
+
+          if (!flatpak_dir_mirror_oci (self, registry, remote_name, ref, NULL, progress, cancellable, error))
+            return FALSE;
+        }
+      else
+        {
+          /* We're pulling from a remote source, we do the network mirroring pull as a
+             user and hand back the resulting data to the system-helper, that trusts us
+             due to the GPG signatures in the repo */
+          g_autoptr(GBytes) summary_copy = NULL;
+          g_autoptr(GBytes) summary_sig_copy = NULL;
+          g_autoptr(GFile) summary_file = NULL;
+          g_autoptr(GFile) summary_sig_file = NULL;
+
+          child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, commit, error);
+          if (child_repo == NULL)
+            return FALSE;
+
+          if (!flatpak_dir_remote_fetch_summary (self, remote_name,
+                                                 &summary_copy, &summary_sig_copy,
+                                                 cancellable, error))
+            return FALSE;
+
+          /* FIXME: Ideally we could merge these two flatpak_dir_pull() calls
+           * so @ref and  %OSTREE_REPO_METADATA_REF are resolved atomically.
+           * However, pulling them separately is no worse than the old code path
+           * where the summary and ref were pulled separately. */
+          flatpak_flags |= FLATPAK_PULL_FLAGS_SIDELOAD_EXTRA_DATA;
+          if (!flatpak_dir_pull (self, remote_name, ref, commit, results, subpaths,
+                                 child_repo,
+                                 flatpak_flags, OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 progress, cancellable, error))
+            return FALSE;
+#ifdef FLATPAK_ENABLE_P2P
+          if (collection_id != NULL &&
+              !flatpak_dir_pull (self, remote_name, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL,
+                                 child_repo,
+                                 flatpak_flags, OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 progress, cancellable, error))
+            return FALSE;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+          summary_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary");
+          if (!g_file_replace_contents (summary_file,
+                                        g_bytes_get_data (summary_copy, NULL),
+                                        g_bytes_get_size (summary_copy),
+                                        NULL, FALSE, 0, NULL, cancellable, NULL))
+            return FALSE;
+
+          if (collection_id == NULL)
+            {
+              summary_sig_file = g_file_get_child (ostree_repo_get_path (child_repo), "summary.sig");
+              if (!g_file_replace_contents (summary_sig_file,
+                                            g_bytes_get_data (summary_sig_copy, NULL),
+                                            g_bytes_get_size (summary_sig_copy),
+                                            NULL, FALSE, 0, NULL, cancellable, NULL))
+                return FALSE;
+            }
+
+          child_repo_path = g_file_get_path (ostree_repo_get_path (child_repo));
+        }
+
+      if (no_deploy)
+        helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY;
+
+      g_debug ("Calling system helper: Deploy");
+      if (!flatpak_system_helper_call_deploy_sync (system_helper,
+                                                   child_repo_path ? child_repo_path : "",
+                                                   helper_flags, ref, remote_name,
+                                                   subpaths,
+                                                   installation ? installation : "",
+                                                   cancellable,
+                                                   error))
+        return FALSE;
+
+      if (child_repo_path)
+        (void) glnx_shutil_rm_rf_at (AT_FDCWD, child_repo_path, NULL, NULL);
+
+      return TRUE;
+    }
+
+  if (!no_pull)
+    {
+      if (!flatpak_dir_pull (self, remote_name, ref, commit, results, subpaths,
+                             NULL, flatpak_flags, OSTREE_REPO_PULL_FLAGS_NONE,
+                             progress, cancellable, error))
+        return FALSE;
+    }
+
+  if (!no_deploy)
+    {
+      if (!flatpak_dir_deploy_update (self, ref,
+                                      /* We don't know the local commit id in the OCI case, and
+                                         we only support one version anyway */
+                                      is_oci ? NULL : commit,
+                                      subpaths,
+                                      cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_uninstall (FlatpakDir          *self,
+                       const char          *ref,
+                       FlatpakHelperUninstallFlags flags,
+                       GCancellable        *cancellable,
+                       GError             **error)
+{
+  const char *repository;
+  g_autofree char *current_ref = NULL;
+  gboolean was_deployed;
+  gboolean is_app;
+  const char *name;
+  g_auto(GStrv) parts = NULL;
+  g_auto(GLnxLockFile) lock = { 0, };
+  g_autoptr(GVariant) deploy_data = NULL;
+  gboolean keep_ref = flags & FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF;
+  gboolean force_remove = flags & FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return FALSE;
+  name = parts[1];
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      FlatpakSystemHelper *system_helper;
+      const char *installation = flatpak_dir_get_id (self);
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      g_debug ("Calling system helper: Uninstall");
+      if (!flatpak_system_helper_call_uninstall_sync (system_helper,
+                                                      flags, ref,
+                                                      installation ? installation : "",
+                                                      cancellable, error))
+        return FALSE;
+
+      return TRUE;
+    }
+
+  if (!flatpak_dir_lock (self, &lock,
+                         cancellable, error))
+    return FALSE;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, ref,
+                                             cancellable, error);
+  if (deploy_data == NULL)
+    return FALSE;
+
+  repository = flatpak_deploy_data_get_origin (deploy_data);
+  if (repository == NULL)
+    return FALSE;
+
+  g_debug ("dropping active ref");
+  if (!flatpak_dir_set_active (self, ref, NULL, cancellable, error))
+    return FALSE;
+
+  is_app = g_str_has_prefix (ref, "app/");
+  if (is_app)
+    {
+      current_ref = flatpak_dir_current_ref (self, name, cancellable);
+      if (g_strcmp0 (ref, current_ref) == 0)
+        {
+          g_debug ("dropping current ref");
+          if (!flatpak_dir_drop_current_ref (self, name, cancellable, error))
+            return FALSE;
+        }
+    }
+
+  if (!flatpak_dir_undeploy_all (self, ref, force_remove, &was_deployed, cancellable, error))
+    return FALSE;
+
+  if (!keep_ref &&
+      !flatpak_dir_remove_ref (self, repository, ref, cancellable, error))
+    return FALSE;
+
+  if (is_app &&
+      !flatpak_dir_update_exports (self, name, cancellable, error))
+    return FALSE;
+
+  glnx_release_lock_file (&lock);
+
+  flatpak_dir_prune_origin_remote (self, repository);
+
+  if (!keep_ref)
+    flatpak_dir_prune (self, cancellable, NULL);
+
+  flatpak_dir_cleanup_removed (self, cancellable, NULL);
+
+  if (!flatpak_dir_mark_changed (self, error))
+    return FALSE;
+
+  if (!was_deployed)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s branch %s is not installed"), name, parts[3]);
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_collect_deployed_refs (FlatpakDir   *self,
+                                   const char   *type,
+                                   const char   *name_prefix,
+                                   const char   *branch,
+                                   const char   *arch,
+                                   GHashTable   *hash,
+                                   GCancellable *cancellable,
+                                   GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+
+  dir = g_file_get_child (self->basedir, type);
+  if (!g_file_query_exists (dir, cancellable))
+    return TRUE;
+
+  dir_enum = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
+                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        cancellable,
+                                        error);
+  if (!dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)) != NULL)
+    {
+      const char *name = g_file_info_get_name (child_info);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY &&
+          name[0] != '.' && (name_prefix == NULL || g_str_has_prefix (name, name_prefix)))
+        {
+          g_autoptr(GFile) child1 = g_file_get_child (dir, name);
+          g_autoptr(GFile) child2 = g_file_get_child (child1, branch);
+          g_autoptr(GFile) child3 = g_file_get_child (child2, arch);
+          g_autoptr(GFile) active = g_file_get_child (child3, "active");
+
+          if (g_file_query_exists (active, cancellable))
+            g_hash_table_add (hash, g_strdup (name));
+        }
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+gboolean
+flatpak_dir_collect_unmaintained_refs (FlatpakDir   *self,
+                                       const char   *name_prefix,
+                                       const char   *arch,
+                                       const char   *branch,
+                                       GHashTable   *hash,
+                                       GCancellable *cancellable,
+                                       GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) unmaintained_dir = NULL;
+  g_autoptr(GFileEnumerator) unmaintained_dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+
+  unmaintained_dir = g_file_get_child (self->basedir, "extension");
+  if (!g_file_query_exists (unmaintained_dir, cancellable))
+    return TRUE;
+
+  unmaintained_dir_enum = g_file_enumerate_children (unmaintained_dir, G_FILE_ATTRIBUTE_STANDARD_NAME,
+                                                     G_FILE_QUERY_INFO_NONE,
+                                                     cancellable,
+                                                     error);
+  if (!unmaintained_dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (unmaintained_dir_enum, cancellable, &temp_error)) != NULL)
+    {
+      const char *name = g_file_info_get_name (child_info);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY &&
+          name[0] != '.' && (name_prefix == NULL || g_str_has_prefix (name, name_prefix)))
+        {
+          g_autoptr(GFile) child1 = g_file_get_child (unmaintained_dir, name);
+          g_autoptr(GFile) child2 = g_file_get_child (child1, arch);
+          g_autoptr(GFile) child3 = g_file_get_child (child2, branch);
+
+          if (g_file_query_exists (child3, cancellable))
+            g_hash_table_add (hash, g_strdup (name));
+        }
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+gboolean
+flatpak_dir_list_deployed (FlatpakDir   *self,
+                           const char   *ref,
+                           char       ***deployed_ids,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GPtrArray) ids = NULL;
+  GError *temp_error = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) child = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+
+  ids = g_ptr_array_new_with_free_func (g_free);
+
+  dir_enum = g_file_enumerate_children (deploy_base, OSTREE_GIO_FAST_QUERYINFO,
+                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        cancellable,
+                                        &my_error);
+  if (!dir_enum)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        ret = TRUE; /* Success, but empty */
+      else
+        g_propagate_error (error, g_steal_pointer (&my_error));
+      goto out;
+    }
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)) != NULL)
+    {
+      const char *name;
+
+      name = g_file_info_get_name (child_info);
+
+      g_clear_object (&child);
+      child = g_file_get_child (deploy_base, name);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY &&
+          name[0] != '.' &&
+          strlen (name) == 64)
+        g_ptr_array_add (ids, g_strdup (name));
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  ret = TRUE;
+
+out:
+  if (ret)
+    {
+      g_ptr_array_add (ids, NULL);
+      *deployed_ids = (char **) g_ptr_array_free (g_steal_pointer (&ids), FALSE);
+    }
+
+  return ret;
+
+}
+
+static gboolean
+dir_is_locked (GFile *dir)
+{
+  glnx_autofd int ref_fd = -1;
+  struct flock lock = {0};
+
+  g_autoptr(GFile) reffile = NULL;
+
+  reffile = g_file_resolve_relative_path (dir, "files/.ref");
+
+  ref_fd = open (flatpak_file_get_path_cached (reffile), O_RDWR | O_CLOEXEC);
+  if (ref_fd != -1)
+    {
+      lock.l_type = F_WRLCK;
+      lock.l_whence = SEEK_SET;
+      lock.l_start = 0;
+      lock.l_len = 0;
+
+      if (fcntl (ref_fd, F_GETLK, &lock) == 0)
+        return lock.l_type != F_UNLCK;
+    }
+
+  return FALSE;
+}
+
+gboolean
+flatpak_dir_undeploy (FlatpakDir   *self,
+                      const char   *ref,
+                      const char   *active_id,
+                      gboolean      is_update,
+                      gboolean      force_remove,
+                      GCancellable *cancellable,
+                      GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) checkoutdir = NULL;
+  g_autoptr(GFile) removed_subdir = NULL;
+  g_autoptr(GFile) removed_dir = NULL;
+  g_autofree char *tmpname = g_strdup_printf ("removed-%s-XXXXXX", active_id);
+  g_autofree char *current_active = NULL;
+  g_autoptr(GFile) change_file = NULL;
+  int i;
+
+  g_assert (ref != NULL);
+  g_assert (active_id != NULL);
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+
+  checkoutdir = g_file_get_child (deploy_base, active_id);
+  if (!g_file_query_exists (checkoutdir, cancellable))
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s branch %s not installed"), ref, active_id);
+      goto out;
+    }
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    goto out;
+
+  current_active = flatpak_dir_read_active (self, ref, cancellable);
+  if (current_active != NULL && strcmp (current_active, active_id) == 0)
+    {
+      g_auto(GStrv) deployed_ids = NULL;
+      const char *some_deployment;
+
+      /* We're removing the active deployment, start by repointing that
+         to another deployment if one exists */
+
+      if (!flatpak_dir_list_deployed (self, ref,
+                                      &deployed_ids,
+                                      cancellable, error))
+        goto out;
+
+      some_deployment = NULL;
+      for (i = 0; deployed_ids[i] != NULL; i++)
+        {
+          if (strcmp (deployed_ids[i], active_id) == 0)
+            continue;
+
+          some_deployment = deployed_ids[i];
+          break;
+        }
+
+      if (!flatpak_dir_set_active (self, ref, some_deployment, cancellable, error))
+        goto out;
+    }
+
+  removed_dir = flatpak_dir_get_removed_dir (self);
+  if (!flatpak_mkdir_p (removed_dir, cancellable, error))
+    goto out;
+
+  glnx_gen_temp_name (tmpname);
+  removed_subdir = g_file_get_child (removed_dir, tmpname);
+
+  if (!flatpak_file_rename (checkoutdir,
+                            removed_subdir,
+                            cancellable, error))
+    goto out;
+
+  if (is_update)
+    change_file = g_file_resolve_relative_path (removed_subdir, "files/.updated");
+  else
+    change_file = g_file_resolve_relative_path (removed_subdir, "files/.removed");
+  g_file_replace_contents (change_file, "", 0, NULL, FALSE,
+                           G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, NULL);
+
+  if (force_remove || !dir_is_locked (removed_subdir))
+    {
+      GError *tmp_error = NULL;
+
+      if (!flatpak_rm_rf (removed_subdir, cancellable, &tmp_error))
+        {
+          g_warning ("Unable to remove old checkout: %s", tmp_error->message);
+          g_error_free (tmp_error);
+        }
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+gboolean
+flatpak_dir_undeploy_all (FlatpakDir   *self,
+                          const char   *ref,
+                          gboolean      force_remove,
+                          gboolean     *was_deployed_out,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_auto(GStrv) deployed = NULL;
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) arch_dir = NULL;
+  g_autoptr(GFile) top_dir = NULL;
+  GError *temp_error = NULL;
+  int i;
+  gboolean was_deployed;
+
+  if (!flatpak_dir_list_deployed (self, ref, &deployed, cancellable, error))
+    return FALSE;
+
+  for (i = 0; deployed[i] != NULL; i++)
+    {
+      g_debug ("undeploying %s", deployed[i]);
+      if (!flatpak_dir_undeploy (self, ref, deployed[i], FALSE, force_remove, cancellable, error))
+        return FALSE;
+    }
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+  was_deployed = g_file_query_exists (deploy_base, cancellable);
+  if (was_deployed)
+    {
+      g_debug ("removing deploy base");
+      if (!flatpak_rm_rf (deploy_base, cancellable, error))
+        return FALSE;
+    }
+
+  g_debug ("cleaning up empty directories");
+  arch_dir = g_file_get_parent (deploy_base);
+  if (g_file_query_exists (arch_dir, cancellable) &&
+      !g_file_delete (arch_dir, cancellable, &temp_error))
+    {
+      if (!g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_EMPTY))
+        {
+          g_propagate_error (error, temp_error);
+          return FALSE;
+        }
+      g_clear_error (&temp_error);
+    }
+
+  top_dir = g_file_get_parent (arch_dir);
+  if (g_file_query_exists (top_dir, cancellable) &&
+      !g_file_delete (top_dir, cancellable, &temp_error))
+    {
+      if (!g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_EMPTY))
+        {
+          g_propagate_error (error, temp_error);
+          return FALSE;
+        }
+      g_clear_error (&temp_error);
+    }
+
+  if (was_deployed_out)
+    *was_deployed_out = was_deployed;
+
+  return TRUE;
+}
+
+/**
+ * flatpak_dir_remove_ref:
+ *
+ * @self: a #FlatpakDir
+ * @remote_name: the name of the remote
+ * @ref: the flatpak ref to remove
+ * @cancellable: (nullable) (optional): a #GCancellable
+ * @error: a #GError
+ *
+ * Remove the flatpak ref given by @remote_name:@ref from the underlying
+ * OSTree repo. Attempting to remove a ref that is currently deployed
+ * is an error, you need to uninstall the flatpak first. Note that this does
+ * not remove the objects bound to @ref from the disk, you will need to
+ * call flatpak_dir_prune() to do that.
+ *
+ * Returns: %TRUE if removing the ref succeeded, %FALSE otherwise.
+ */
+gboolean
+flatpak_dir_remove_ref (FlatpakDir   *self,
+                        const char   *remote_name,
+                        const char   *ref,
+                        GCancellable *cancellable,
+                        GError      **error)
+{
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      const char *installation = flatpak_dir_get_id (self);
+      FlatpakSystemHelper *system_helper = flatpak_dir_get_system_helper (self);
+
+      /* If we don't have the system helper, we'll have to try and just remove
+       * the ref as an unprivileged user, which might fail later */
+      if (system_helper)
+        {
+          if (!flatpak_system_helper_call_remove_local_ref_sync (system_helper,
+                                                                 remote_name,
+                                                                 ref,
+                                                                 installation ? installation : "",
+                                                                 cancellable,
+                                                                 error))
+            return FALSE;
+        }
+
+      return TRUE;
+    }
+
+  if (!ostree_repo_set_ref_immediate (self->repo,
+                                      remote_name,
+                                      ref,
+                                      NULL,
+                                      cancellable,
+                                      error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_cleanup_removed (FlatpakDir   *self,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  gboolean ret = FALSE;
+
+  g_autoptr(GFile) removed_dir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+
+  removed_dir = flatpak_dir_get_removed_dir (self);
+  if (!g_file_query_exists (removed_dir, cancellable))
+    return TRUE;
+
+  dir_enum = g_file_enumerate_children (removed_dir, OSTREE_GIO_FAST_QUERYINFO,
+                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        cancellable,
+                                        error);
+  if (!dir_enum)
+    goto out;
+
+  while ((child_info = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)) != NULL)
+    {
+      const char *name = g_file_info_get_name (child_info);
+      g_autoptr(GFile) child = g_file_get_child (removed_dir, name);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY &&
+          !dir_is_locked (child))
+        {
+          GError *tmp_error = NULL;
+          if (!flatpak_rm_rf (child, cancellable, &tmp_error))
+            {
+              g_warning ("Unable to remove old checkout: %s", tmp_error->message);
+              g_error_free (tmp_error);
+            }
+        }
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  ret = TRUE;
+out:
+  return ret;
+}
+
+gboolean
+flatpak_dir_prune (FlatpakDir   *self,
+                   GCancellable *cancellable,
+                   GError      **error)
+{
+  gboolean ret = FALSE;
+  gint objects_total, objects_pruned;
+  guint64 pruned_object_size_total;
+  g_autofree char *formatted_freed_size = NULL;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GError) lock_error = NULL;
+  g_auto(GLnxLockFile) lock = { 0, };
+
+  if (error == NULL)
+    error = &local_error;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      const char *installation = flatpak_dir_get_id (self);
+      FlatpakSystemHelper *system_helper = flatpak_dir_get_system_helper (self);
+
+      /* If we don't have the system helper, we'll have to try and just remove
+       * the ref as an unprivileged user, which might fail later */
+      if (system_helper)
+        {
+          if (!flatpak_system_helper_call_prune_local_repo_sync (system_helper,
+                                                                 installation ? installation : "",
+                                                                 cancellable,
+                                                                 error))
+            return FALSE;
+        }
+
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    goto out;
+
+  /* This could remove objects, so take an exclusive repo lock */
+  if (!flatpak_dir_repo_lock (self, &lock, LOCK_EX | LOCK_NB, cancellable, &lock_error))
+    {
+      /* If we can't get an exclusive lock, don't block for a long time. Eventually
+         the shared lock operation is released and we will do a prune then */
+      if (g_error_matches (lock_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+        {
+          g_debug ("Skipping prune do to in progress operation");
+          return TRUE;
+        }
+
+      g_propagate_error (error, g_steal_pointer (&lock_error));
+      return FALSE;
+    }
+
+  g_debug ("Pruning repo");
+  if (!ostree_repo_prune (self->repo,
+                          OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY,
+                          0,
+                          &objects_total,
+                          &objects_pruned,
+                          &pruned_object_size_total,
+                          cancellable, error))
+    goto out;
+
+  formatted_freed_size = g_format_size_full (pruned_object_size_total, 0);
+  g_debug ("Pruned %d/%d objects, size %s", objects_total, objects_pruned, formatted_freed_size);
+
+  ret = TRUE;
+
+ out:
+
+  /* There was an issue in ostree where for local pulls we don't get a .commitpartial (now fixed),
+     which caused errors when pruning. We print these here, but don't stop processing. */
+  if (local_error != NULL)
+    g_print (_("Pruning repo failed: %s"), local_error->message);
+
+  return ret;
+
+}
+
+GFile *
+flatpak_dir_get_if_deployed (FlatpakDir   *self,
+                             const char   *ref,
+                             const char   *checksum,
+                             GCancellable *cancellable)
+{
+  g_autoptr(GFile) deploy_base = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+
+  deploy_base = flatpak_dir_get_deploy_dir (self, ref);
+
+  if (checksum != NULL)
+    {
+      deploy_dir = g_file_get_child (deploy_base, checksum);
+    }
+  else
+    {
+      g_autoptr(GFile) active_link = g_file_get_child (deploy_base, "active");
+      g_autoptr(GFileInfo) info = NULL;
+      const char *target;
+
+      info = g_file_query_info (active_link,
+                                G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+                                G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                NULL,
+                                NULL);
+      if (info == NULL)
+        return NULL;
+
+      target = g_file_info_get_symlink_target (info);
+      if (target == NULL)
+        return NULL;
+
+      deploy_dir = g_file_get_child (deploy_base, target);
+    }
+
+  if (g_file_query_file_type (deploy_dir, G_FILE_QUERY_INFO_NONE, cancellable) == G_FILE_TYPE_DIRECTORY)
+    return g_object_ref (deploy_dir);
+  return NULL;
+}
+
+GFile *
+flatpak_dir_get_unmaintained_extension_dir_if_exists (FlatpakDir *self,
+                                                      const char *name,
+                                                      const char *arch,
+                                                      const char *branch,
+                                                      GCancellable *cancellable)
+{
+  g_autoptr(GFile) extension_dir = NULL;
+  g_autoptr(GFileInfo) extension_dir_info = NULL;
+
+  extension_dir = flatpak_dir_get_unmaintained_extension_dir (self, name, arch, branch);
+
+  extension_dir_info = g_file_query_info (extension_dir,
+                                          G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+                                          G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                          cancellable,
+                                          NULL);
+  if (extension_dir_info == NULL)
+    return NULL;
+
+  if (g_file_info_get_is_symlink (extension_dir_info))
+      return g_file_new_for_path (g_file_info_get_symlink_target (extension_dir_info));
+  else
+      return g_steal_pointer (&extension_dir);
+}
+
+G_LOCK_DEFINE_STATIC (cache);
+
+/* FIXME: Move all this caching into libostree. */
+static void
+cached_summary_free (CachedSummary *summary)
+{
+  g_bytes_unref (summary->bytes);
+  if (summary->bytes_sig)
+    g_bytes_unref (summary->bytes_sig);
+  g_free (summary->remote);
+  g_free (summary->url);
+  g_free (summary);
+}
+
+static CachedSummary *
+cached_summary_new (GBytes *bytes,
+                    GBytes *bytes_sig,
+                    const char *remote,
+                    const char *url)
+{
+  CachedSummary *summary = g_new0 (CachedSummary, 1);
+  summary->bytes = g_bytes_ref (bytes);
+  if (bytes_sig)
+    summary->bytes_sig = g_bytes_ref (bytes_sig);
+  summary->url = g_strdup (url);
+  summary->remote = g_strdup (remote);
+  summary->time = g_get_monotonic_time ();
+  return summary;
+}
+
+static gboolean
+flatpak_dir_lookup_cached_summary (FlatpakDir  *self,
+                                   GBytes **bytes_out,
+                                   GBytes **bytes_sig_out,
+                                   const char  *name,
+                                   const char  *url)
+{
+  CachedSummary *summary;
+  gboolean res = FALSE;
+
+  G_LOCK (cache);
+
+  if (self->summary_cache == NULL)
+    self->summary_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify)cached_summary_free);
+
+  summary = g_hash_table_lookup (self->summary_cache, name);
+  if (summary)
+    {
+      guint64 now = g_get_monotonic_time ();
+      if ((now - summary->time) < (1000 * 1000 * (SUMMARY_CACHE_TIMEOUT_SEC)) &&
+          strcmp (url, summary->url) == 0)
+        {
+          /* g_debug ("Using cached summary for remote %s", name); */
+          *bytes_out = g_bytes_ref (summary->bytes);
+          if (bytes_sig_out)
+            {
+              if (summary->bytes_sig)
+                *bytes_sig_out = g_bytes_ref (summary->bytes_sig);
+              else
+                *bytes_sig_out = NULL;
+            }
+          res = TRUE;
+        }
+    }
+
+  G_UNLOCK (cache);
+
+  return res;
+}
+
+static void
+flatpak_dir_cache_summary (FlatpakDir  *self,
+                           GBytes      *bytes,
+                           GBytes      *bytes_sig,
+                           const char  *name,
+                           const char  *url)
+{
+  CachedSummary *summary;
+
+  /* No sense caching the summary if there isn't one */
+  if (!bytes)
+      return;
+
+  G_LOCK (cache);
+
+  /* This was already initialized in the cache-miss lookup */
+  g_assert (self->summary_cache != NULL);
+
+  summary = cached_summary_new (bytes, bytes_sig, name, url);
+  g_hash_table_replace (self->summary_cache, summary->remote, summary);
+
+  G_UNLOCK (cache);
+}
+
+static gboolean
+flatpak_dir_remote_make_oci_summary (FlatpakDir   *self,
+                                     const char   *remote,
+                                     GBytes      **out_summary,
+                                     GCancellable *cancellable,
+                                     GError      **error)
+{
+  g_autofree char *oci_uri = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GFile) cache_dir = NULL;
+  g_autoptr(GFile) summary_cache = NULL;
+  g_autofree char *summary_name = NULL;
+  g_autofree char *cache_etag = NULL;
+  g_autofree char *self_name = NULL;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GMappedFile) mfile = NULL;
+  g_autoptr(GBytes) cache_bytes = NULL;
+
+  if (!ostree_repo_remote_get_url (self->repo,
+                                   remote,
+                                   &oci_uri,
+                                   error))
+    return FALSE;
+
+  cache_dir = flatpak_ensure_oci_summary_cache_dir_location (error);
+  if (cache_dir == NULL)
+    return FALSE;
+
+  self_name = flatpak_dir_get_name (self);
+
+  summary_name = g_strconcat (self_name, "-", remote, NULL);
+  summary_cache = g_file_get_child (cache_dir, summary_name);
+
+  mfile = g_mapped_file_new (flatpak_file_get_path_cached (summary_cache), FALSE, NULL);
+  if (mfile)
+    {
+      cache_bytes = g_mapped_file_get_bytes (mfile);
+      g_autoptr(GVariant) cached_summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT, cache_bytes, TRUE));
+      g_autoptr(GVariant) extensions = g_variant_get_child_value (cached_summary, 1);
+      g_variant_lookup (extensions, "xa.oci-etag", "s", &cache_etag);
+    }
+
+  ensure_soup_session (self);
+
+  summary = flatpak_oci_index_fetch_summary (self->soup_session, oci_uri, cache_etag, cancellable, &local_error);
+  if (summary == NULL)
+    {
+      if (g_error_matches (local_error, FLATPAK_OCI_ERROR, FLATPAK_OCI_ERROR_NOT_CHANGED))
+        {
+          g_debug ("Using cached summary for oci remote %s", remote);
+          *out_summary = g_steal_pointer (&cache_bytes);
+          return TRUE;
+        }
+
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }
+
+  *out_summary = g_variant_get_data_as_bytes (summary);
+
+  if (!g_file_replace_contents (summary_cache,
+                                g_bytes_get_data (*out_summary, NULL),
+                                g_bytes_get_size (*out_summary),
+                                NULL, FALSE, 0, NULL, cancellable, NULL))
+    g_warning ("Failed to write summary cache");
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_dir_remote_fetch_summary (FlatpakDir   *self,
+                                  const char   *name,
+                                  GBytes      **out_summary,
+                                  GBytes      **out_summary_sig,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  g_autofree char *url = NULL;
+  gboolean is_local;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GBytes) summary = NULL;
+  g_autoptr(GBytes) summary_sig = NULL;
+
+  if (!ostree_repo_remote_get_url (self->repo, name, &url, error))
+    return FALSE;
+
+  if (*url == '\0')
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+                   "Can't fetch summary from disabled remote ‘%s’", name);
+      return FALSE;
+    }
+
+  is_local = g_str_has_prefix (url, "file:");
+
+  /* No caching for local files */
+  if (!is_local)
+    {
+      if (flatpak_dir_lookup_cached_summary (self, out_summary, out_summary_sig, name, url))
+        return TRUE;
+    }
+
+  /* Seems ostree asserts if this is NULL */
+  if (error == NULL)
+    error = &local_error;
+
+  if (flatpak_dir_get_remote_oci (self, name))
+    {
+      if (!flatpak_dir_remote_make_oci_summary (self, name,
+                                                &summary,
+                                                cancellable,
+                                                error))
+        return FALSE;
+    }
+  else
+    {
+      g_debug ("Fetching summary file for remote ‘%s’", name);
+      if (!ostree_repo_remote_fetch_summary (self->repo, name,
+                                             &summary, &summary_sig,
+                                             cancellable,
+                                             error))
+        return FALSE;
+    }
+
+  if (summary == NULL)
+    return flatpak_fail (error, "Remote listing for %s not available; server has no summary file\n" \
+                         "Check the URL passed to remote-add was valid\n", name);
+
+  if (!is_local)
+    flatpak_dir_cache_summary (self, summary, summary_sig, name, url);
+
+  *out_summary = g_steal_pointer (&summary);
+  if (out_summary_sig)
+    *out_summary_sig = g_steal_pointer (&summary_sig);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_remote_has_ref (FlatpakDir   *self,
+                            const char   *remote,
+                            const char   *ref)
+{
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GError) local_error = NULL;
+  g_autofree char *collection_id = NULL;
+
+  summary = fetch_remote_summary_file (self, remote, NULL, NULL, &local_error);
+  if (summary == NULL)
+    {
+      g_debug ("Can't get summary for remote %s: %s", remote, local_error->message);
+      return FALSE;
+    }
+
+  /* Derive the collection ID from the remote we are querying. This will act as
+   * a sanity check on the summary ref lookup. */
+  if (!repo_get_remote_collection_id (self->repo, remote, &collection_id, &local_error))
+    {
+      g_debug ("Can’t get collection ID for remote %s: %s", remote, local_error->message);
+      return FALSE;
+    }
+
+  return flatpak_summary_lookup_ref (summary, collection_id, ref, NULL, NULL);
+}
+
+/* This duplicates ostree_repo_list_refs so it can use flatpak_dir_remote_fetch_summary
+   and get caching */
+/* FIXME: For command line completion support for collection–refs over P2P,
+ * we need a version of ostree_repo_list_collection_refs(). */
+static gboolean
+flatpak_dir_remote_list_refs (FlatpakDir       *self,
+                              const char       *remote_name,
+                              GHashTable      **out_all_refs,
+                              GCancellable     *cancellable,
+                              GError          **error)
+{
+  g_autoptr(GHashTable) ret_all_refs = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GVariant) ref_map = NULL;
+  GVariantIter iter;
+  GVariant *child;
+
+  ret_all_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+  summary = fetch_remote_summary_file (self, remote_name, NULL, cancellable, error);
+  if (summary == NULL)
+    return FALSE;
+
+  ref_map = g_variant_get_child_value (summary, 0);
+
+  g_variant_iter_init (&iter, ref_map);
+  while ((child = g_variant_iter_next_value (&iter)) != NULL)
+    {
+      const char *ref_name = NULL;
+      g_autoptr(GVariant) csum_v = NULL;
+      char tmp_checksum[65];
+
+      g_variant_get_child (child, 0, "&s", &ref_name);
+
+      if (ref_name != NULL)
+        {
+          const guchar *csum_bytes;
+
+          g_variant_get_child (child, 1, "(t@aya{sv})", NULL, &csum_v, NULL);
+          csum_bytes = ostree_checksum_bytes_peek_validate (csum_v, error);
+          if (csum_bytes == NULL)
+            return FALSE;
+
+          ostree_checksum_inplace_from_bytes (csum_bytes, tmp_checksum);
+
+          g_hash_table_insert (ret_all_refs,
+                               g_strdup (ref_name),
+                               g_strdup (tmp_checksum));
+        }
+
+      g_variant_unref (child);
+    }
+
+
+  *out_all_refs = g_steal_pointer (&ret_all_refs);
+
+  return TRUE;
+}
+
+typedef enum {
+  FIND_MATCHING_REFS_FLAGS_NONE = 0,
+  FIND_MATCHING_REFS_FLAGS_KEEP_REMOTE = (1 << 0),
+} FindMatchingRefsFlags;
+
+/* Guarantees to return refs which are decomposable. */
+static GPtrArray *
+find_matching_refs (GHashTable *refs,
+                    const char   *opt_name,
+                    const char   *opt_branch,
+                    const char   *opt_arch,
+                    FlatpakKinds  kinds,
+                    FindMatchingRefsFlags flags,
+                    GError      **error)
+{
+  g_autoptr(GPtrArray) matched_refs = NULL;
+  const char **arches = flatpak_get_arches ();
+  const char *opt_arches[] = {opt_arch, NULL};
+  GHashTableIter hash_iter;
+  gpointer key;
+  g_autoptr(GError) local_error = NULL;
+
+  if (opt_arch != NULL)
+    arches = opt_arches;
+
+  if (opt_name && !flatpak_is_valid_name (opt_name, &local_error))
+    {
+      flatpak_fail (error, "'%s' is not a valid name: %s", opt_name, local_error->message);
+      return NULL;
+    }
+
+  if (opt_branch && !flatpak_is_valid_branch (opt_branch, &local_error))
+    {
+      flatpak_fail (error, "'%s' is not a valid branch name: %s", opt_branch, local_error->message);
+      return NULL;
+    }
+
+  matched_refs = g_ptr_array_new_with_free_func (g_free);
+
+  g_hash_table_iter_init (&hash_iter, refs);
+  while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+    {
+      g_autofree char *ref = NULL;
+      g_auto(GStrv) parts = NULL;
+      gboolean is_app, is_runtime;
+
+      /* Unprefix any remote name if needed */
+      ostree_parse_refspec (key, NULL, &ref, NULL);
+      if (ref == NULL)
+        continue;
+
+      is_app = g_str_has_prefix (ref, "app/");
+      is_runtime = g_str_has_prefix (ref, "runtime/");
+
+      if ((!(kinds & FLATPAK_KINDS_APP) && is_app) ||
+          (!(kinds & FLATPAK_KINDS_RUNTIME) && is_runtime) ||
+          (!is_app && !is_runtime))
+        continue;
+
+      parts = flatpak_decompose_ref (ref, NULL);
+      if (parts == NULL)
+        continue;
+
+      if (opt_name != NULL && strcmp (opt_name, parts[1]) != 0)
+        continue;
+
+      if (!g_strv_contains (arches, parts[2]))
+        continue;
+
+      if (opt_branch != NULL && strcmp (opt_branch, parts[3]) != 0)
+        continue;
+
+      if (flags & FIND_MATCHING_REFS_FLAGS_KEEP_REMOTE)
+        g_ptr_array_add (matched_refs, g_strdup (key));
+      else
+        g_ptr_array_add (matched_refs, g_steal_pointer (&ref));
+    }
+
+  return g_steal_pointer (&matched_refs);
+}
+
+
+static char *
+find_matching_ref (GHashTable *refs,
+                   const char   *name,
+                   const char   *opt_branch,
+                   const char   *opt_default_branch,
+                   const char   *opt_arch,
+                   FlatpakKinds  kinds,
+                   GError      **error)
+{
+  const char **arches = flatpak_get_arches ();
+  const char *opt_arches[] = {opt_arch, NULL};
+  int i;
+
+  if (opt_arch != NULL)
+    arches = opt_arches;
+
+  /* We stop at the first arch (in prio order) that has a match */
+  for (i = 0; arches[i] != NULL; i++)
+    {
+      g_autoptr(GPtrArray) matched_refs = NULL;
+      int j;
+
+      matched_refs = find_matching_refs (refs,
+                                         name,
+                                         opt_branch,
+                                         arches[i],
+                                         kinds,
+                                         FIND_MATCHING_REFS_FLAGS_NONE,
+                                         error);
+      if (matched_refs == NULL)
+        return NULL;
+
+      if (matched_refs->len == 0)
+        continue;
+
+      if (matched_refs->len == 1)
+        return g_strdup (g_ptr_array_index (matched_refs, 0));
+
+      /* Multiple refs found, see if some belongs to the default branch, if passed */
+      if (opt_default_branch != NULL)
+        {
+          for (j = 0; j < matched_refs->len; j++)
+            {
+              char *current_ref = g_ptr_array_index (matched_refs, j);
+              g_auto(GStrv) parts = flatpak_decompose_ref (current_ref, NULL);
+              g_assert (parts != NULL);
+
+              if (g_strcmp0 (opt_default_branch, parts[3]) == 0)
+                return g_strdup (current_ref);
+            }
+        }
+
+      /* Nothing to do other than reporting the different choices */
+      g_autoptr(GString) err = g_string_new ("");
+      g_string_printf (err, _("Multiple branches available for %s, you must specify one of: "), name);
+      g_ptr_array_sort (matched_refs, flatpak_strcmp0_ptr);
+      for (j = 0; j < matched_refs->len; j++)
+        {
+          g_auto(GStrv) parts = flatpak_decompose_ref (g_ptr_array_index (matched_refs, j), NULL);
+          g_assert (parts != NULL);
+          if (j != 0)
+            g_string_append (err, ", ");
+
+          g_string_append (err,
+                           g_strdup_printf ("%s/%s/%s",
+                                            name,
+                                            opt_arch ? opt_arch : "",
+                                            parts[3]));
+        }
+
+      flatpak_fail (error, "%s", err->str);
+      return NULL;
+    }
+
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+               _("Nothing matches %s"), name);
+  return NULL;
+}
+
+/* FIXME: For command line completion support for collection–refs over P2P,
+ * we need a version which works with collections. */
+char **
+flatpak_dir_find_remote_refs (FlatpakDir   *self,
+                             const char   *remote,
+                             const char   *name,
+                             const char   *opt_branch,
+                             const char   *opt_arch,
+                             FlatpakKinds  kinds,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(GHashTable) remote_refs = NULL;
+  GPtrArray *matched_refs;
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  if (!flatpak_dir_remote_list_refs (self, remote,
+                                     &remote_refs, cancellable, error))
+    return NULL;
+
+  matched_refs = find_matching_refs (remote_refs,
+                                     name,
+                                     opt_branch,
+                                     opt_arch,
+                                     kinds,
+                                     FIND_MATCHING_REFS_FLAGS_NONE,
+                                     error);
+  if (matched_refs == NULL)
+    return NULL;
+
+  g_ptr_array_add (matched_refs, NULL);
+  return (char **)g_ptr_array_free (matched_refs, FALSE);
+}
+
+static char *
+find_ref_for_refs_set (GHashTable *refs,
+                       const char   *name,
+                       const char   *opt_branch,
+                       const char   *opt_default_branch,
+                       const char   *opt_arch,
+                       FlatpakKinds  kinds,
+                       FlatpakKinds *out_kind,
+                       GError      **error)
+{
+  g_autoptr(GError) my_error = NULL;
+  g_autofree gchar *ref = find_matching_ref (refs,
+                                             name,
+                                             opt_branch,
+                                             opt_default_branch,
+                                             opt_arch,
+                                             kinds,
+                                             &my_error);
+  if (ref == NULL)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        g_clear_error (&my_error);
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+  else
+    {
+      if (out_kind != NULL)
+        {
+          if (g_str_has_prefix (ref, "app/"))
+            *out_kind = FLATPAK_KINDS_APP;
+          else
+            *out_kind = FLATPAK_KINDS_RUNTIME;
+        }
+
+      return g_steal_pointer (&ref);
+    }
+
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+               _("Can't find ref %s%s%s%s%s"), name,
+               (opt_arch != NULL || opt_branch != NULL) ? "/" : "",
+               opt_arch ? opt_arch : "",
+               opt_branch ? "/" : "",
+               opt_branch ? opt_branch : "");
+
+  return NULL;
+}
+
+/* FIXME: For command line completion support for collection–refs over P2P,
+ * we need a version which works with collections. */
+char *
+flatpak_dir_find_remote_ref (FlatpakDir   *self,
+                             const char   *remote,
+                             const char   *name,
+                             const char   *opt_branch,
+                             const char   *opt_default_branch,
+                             const char   *opt_arch,
+                             FlatpakKinds  kinds,
+                             FlatpakKinds *out_kind,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autofree char *remote_ref = NULL;
+  g_autoptr(GHashTable) remote_refs = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  if (!flatpak_dir_remote_list_refs (self, remote,
+                                     &remote_refs, cancellable, error))
+    return NULL;
+
+  remote_ref = find_ref_for_refs_set (remote_refs, name, opt_branch,
+                                      opt_default_branch, opt_arch, kinds,
+                                      out_kind, &my_error);
+  if (!remote_ref)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                       _("Error searching remote %s: %s"),
+                       remote,
+                       my_error->message);
+          return NULL;
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+
+  return g_steal_pointer (&remote_ref);
+}
+
+char *
+flatpak_dir_find_local_ref (FlatpakDir   *self,
+                            const char   *remote,
+                            const char   *name,
+                            const char   *opt_branch,
+                            const char   *opt_default_branch,
+                            const char   *opt_arch,
+                            FlatpakKinds  kinds,
+                            FlatpakKinds *out_kind,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  g_autofree char *local_ref = NULL;
+  g_autoptr(GHashTable) local_refs = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  if (!ostree_repo_list_refs (self->repo, NULL, &local_refs, cancellable, error))
+    return NULL;
+
+  local_ref = find_ref_for_refs_set (local_refs, name, opt_branch,
+                                     opt_default_branch, opt_arch, kinds,
+                                     out_kind, &my_error);
+  if (!local_ref)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                       _("Error searching local repository: %s"),
+                       my_error->message);
+          return NULL;
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+
+  return g_steal_pointer (&local_ref);
+}
+
+
+static GHashTable *
+flatpak_dir_get_all_installed_refs (FlatpakDir  *self,
+                                    FlatpakKinds kinds,
+                                    GError     **error)
+{
+  g_autoptr(GHashTable) local_refs = NULL;
+  int i;
+
+  if (!flatpak_dir_ensure_repo (self, NULL, error))
+    return NULL;
+
+  local_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  if (kinds & FLATPAK_KINDS_APP)
+    {
+      g_auto(GStrv) app_refs = NULL;
+
+      if (!flatpak_dir_list_refs (self, "app", &app_refs, NULL, error))
+        return NULL;
+
+      for (i = 0; app_refs[i] != NULL; i++)
+        g_hash_table_insert (local_refs, g_strdup (app_refs[i]),
+                             GINT_TO_POINTER (1));
+    }
+  if (kinds & FLATPAK_KINDS_RUNTIME)
+    {
+      g_auto(GStrv) runtime_refs = NULL;
+
+      if (!flatpak_dir_list_refs (self, "runtime", &runtime_refs, NULL, error))
+        return NULL;
+
+      for (i = 0; runtime_refs[i] != NULL; i++)
+        g_hash_table_insert (local_refs, g_strdup (runtime_refs[i]),
+                             GINT_TO_POINTER (1));
+    }
+
+  return g_steal_pointer (&local_refs);
+}
+
+char **
+flatpak_dir_find_installed_refs (FlatpakDir *self,
+                                 const char *opt_name,
+                                 const char *opt_branch,
+                                 const char *opt_arch,
+                                 FlatpakKinds kinds,
+                                 GError    **error)
+{
+  g_autoptr(GHashTable) local_refs = NULL;
+  GPtrArray *matched_refs;
+
+  local_refs = flatpak_dir_get_all_installed_refs (self, kinds, error);
+  if (local_refs == NULL)
+    return NULL;
+
+  matched_refs = find_matching_refs (local_refs,
+                                     opt_name,
+                                     opt_branch,
+                                     opt_arch,
+                                     kinds,
+                                     FIND_MATCHING_REFS_FLAGS_NONE,
+                                     error);
+  if (matched_refs == NULL)
+    return NULL;
+
+  g_ptr_array_add (matched_refs, NULL);
+  return (char **)g_ptr_array_free (matched_refs, FALSE);
+
+}
+
+char *
+flatpak_dir_find_installed_ref (FlatpakDir   *self,
+                                const char   *opt_name,
+                                const char   *opt_branch,
+                                const char   *opt_arch,
+                                FlatpakKinds  kinds,
+                                FlatpakKinds *out_kind,
+                                GError      **error)
+{
+  g_autofree char *local_ref = NULL;
+  g_autoptr(GHashTable) local_refs = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  local_refs = flatpak_dir_get_all_installed_refs (self, kinds, error);
+  if (local_refs == NULL)
+    return NULL;
+
+  local_ref = find_matching_ref (local_refs, opt_name, opt_branch, NULL,
+                                  opt_arch, kinds, &my_error);
+  if (local_ref == NULL)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        g_clear_error (&my_error);
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return NULL;
+        }
+    }
+  else
+    {
+      if (out_kind != NULL)
+        {
+          if (g_str_has_prefix (local_ref, "app/"))
+            *out_kind = FLATPAK_KINDS_APP;
+          else
+            *out_kind = FLATPAK_KINDS_RUNTIME;
+        }
+
+      return g_steal_pointer (&local_ref);
+    }
+
+  g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+               _("%s %s not installed"), opt_name ? opt_name : "*unspecified*", opt_branch ? opt_branch : "master");
+  return NULL;
+}
+
+/* Given a list of refs in local_refspecs, remove any refs that have already
+ * been deployed and return a new GPtrArray containing only the undeployed
+ * refs. This is used by flatpak_dir_cleanup_undeployed_refs to determine
+ * which undeployed refs need to be removed from the local repository.
+ *
+ * Returns: (transfer-full): A #GPtrArray
+ */
+static GPtrArray *
+filter_out_deployed_refs (FlatpakDir *self,
+                          GPtrArray  *local_refspecs,
+                          GError    **error)
+{
+  g_autoptr(GPtrArray) undeployed_refs = g_ptr_array_new_full (local_refspecs->len, g_free);
+  gsize i;
+
+  for (i = 0; i < local_refspecs->len; ++i)
+    {
+      const gchar *refspec = g_ptr_array_index (local_refspecs, i);
+      g_autofree gchar *ref = NULL;
+      g_autoptr(GVariant) deploy_data = NULL;
+
+      if (!ostree_parse_refspec (refspec, NULL, &ref, error))
+        return FALSE;
+
+      deploy_data = flatpak_dir_get_deploy_data (self, ref, NULL, NULL);
+
+      if (!deploy_data)
+        g_ptr_array_add (undeployed_refs, g_strdup (refspec));
+    }
+
+  return g_steal_pointer (&undeployed_refs);
+}
+
+/**
+ * flatpak_dir_cleanup_undeployed_refs:
+ *
+ * @self: a #FlatpakDir
+ * @cancellable: (nullable) (optional): a #GCancellable
+ * @error: a #GError
+ *
+ * Find all flatpak refs in the local repository which have not been deployed
+ * in the dir and remove them from the repository. You might want to call this
+ * function if you pulled refs into the dir but then decided that you did
+ * not want to deploy them for some reason. Note that this does not prune
+ * objects bound to the cleaned up refs from the underlying OSTree repository,
+ * you should consider using flatpak_dir_prune() to do that.
+ *
+ * Since: 0.10.0
+ * Returns: %TRUE if cleaning up the refs suceeded, %FALSE otherwise
+ */
+gboolean
+flatpak_dir_cleanup_undeployed_refs (FlatpakDir   *self,
+                                     GCancellable *cancellable,
+                                     GError       **error)
+{
+  g_autoptr(GHashTable) local_refspecs = NULL;
+  g_autoptr(GPtrArray)  local_flatpak_refspecs = NULL;
+  g_autoptr(GPtrArray) undeployed_refs = NULL;
+  gsize i = 0;
+
+  if (!ostree_repo_list_refs (self->repo, NULL, &local_refspecs, cancellable, error))
+    return FALSE;
+
+  local_flatpak_refspecs = find_matching_refs (local_refspecs,
+                                               NULL, NULL, NULL,
+                                               FLATPAK_KINDS_APP |
+                                               FLATPAK_KINDS_RUNTIME,
+                                               FIND_MATCHING_REFS_FLAGS_KEEP_REMOTE,
+                                               error);
+
+  if (!local_flatpak_refspecs)
+    return FALSE;
+
+  undeployed_refs = filter_out_deployed_refs (self, local_flatpak_refspecs, error);
+
+  if (!undeployed_refs)
+    return FALSE;
+
+  for (; i < undeployed_refs->len; ++i)
+    {
+      const char *refspec = g_ptr_array_index (undeployed_refs, i);
+      g_autofree gchar *remote = NULL;
+      g_autofree gchar *ref = NULL;
+
+      if (!ostree_parse_refspec (refspec, &remote, &ref, error))
+        return FALSE;
+
+      if (!flatpak_dir_remove_ref (self, remote, ref, cancellable, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static FlatpakDir *
+flatpak_dir_new_full (GFile *path, gboolean user, DirExtraData *extra_data)
+{
+  FlatpakDir *dir = g_object_new (FLATPAK_TYPE_DIR, "path", path, "user", user, NULL);
+
+  if (extra_data != NULL)
+    dir->extra_data = dir_extra_data_clone (extra_data);
+
+  return dir;
+}
+
+FlatpakDir *
+flatpak_dir_new (GFile *path, gboolean user)
+{
+  /* We are only interested on extra data for system-wide installations, in which
+     case we use _new_full() directly, so here we just call it passing NULL */
+  return flatpak_dir_new_full (path, user, NULL);
+}
+
+FlatpakDir *
+flatpak_dir_clone (FlatpakDir *self)
+{
+  return flatpak_dir_new_full (self->basedir, self->user, self->extra_data);
+}
+
+FlatpakDir *
+flatpak_dir_get_system_default (void)
+{
+  g_autoptr(GFile) path = flatpak_get_system_default_base_dir_location ();
+  return flatpak_dir_new_full (path, FALSE, NULL);
+}
+
+FlatpakDir *
+flatpak_dir_get_system_by_id (const char   *id,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  g_autoptr(GError) local_error = NULL;
+  GPtrArray *locations = NULL;
+  FlatpakDir *ret = NULL;
+  int i;
+
+  if (id == NULL)
+    return flatpak_dir_get_system_default ();
+
+  /* An error in flatpak_get_system_base_dir_locations() will still return
+   * return an empty array with the GError set, but we want to return NULL.
+   */
+  locations = flatpak_get_system_base_dir_locations (cancellable, &local_error);
+  if (local_error != NULL)
+    {
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return NULL;
+    }
+
+  for (i = 0; i < locations->len; i++)
+    {
+      GFile *path = g_ptr_array_index (locations, i);
+      DirExtraData *extra_data = g_object_get_data (G_OBJECT (path), "extra-data");
+      if (extra_data != NULL && g_strcmp0 (extra_data->id, id) == 0)
+        {
+          ret = flatpak_dir_new_full (path, FALSE, extra_data);
+          break;
+        }
+    }
+
+  if (ret == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   _("Could not find installation %s"), id);
+    }
+
+  return ret;
+}
+
+GPtrArray *
+flatpak_dir_get_system_list (GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(GPtrArray) result = NULL;
+  g_autoptr(GError) local_error = NULL;
+  GPtrArray *locations = NULL;
+  int i;
+
+  /* An error in flatpak_get_system_base_dir_locations() will still return
+   * return an empty array with the GError set, but we want to return NULL.
+   */
+  locations = flatpak_get_system_base_dir_locations (cancellable, &local_error);
+  if (local_error != NULL)
+    {
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return NULL;
+    }
+
+  result = g_ptr_array_new_with_free_func (g_object_unref);
+  for (i = 0; i < locations->len; i++)
+    {
+      GFile *path = g_ptr_array_index (locations, i);
+      DirExtraData *extra_data = g_object_get_data (G_OBJECT (path), "extra-data");
+      g_ptr_array_add (result, flatpak_dir_new_full (path, FALSE, extra_data));
+    }
+
+  return g_steal_pointer (&result);
+}
+
+FlatpakDir *
+flatpak_dir_get_user (void)
+{
+  g_autoptr(GFile) path = flatpak_get_user_base_dir_location ();
+  return flatpak_dir_new (path, TRUE);
+}
+
+static char *
+get_group (const char *remote_name)
+{
+  return g_strdup_printf ("remote \"%s\"", remote_name);
+}
+
+char *
+flatpak_dir_get_remote_collection_id (FlatpakDir *self,
+                                      const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_string (config, group, "collection-id", NULL);
+
+  return NULL;
+}
+
+char *
+flatpak_dir_get_remote_title (FlatpakDir *self,
+                              const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_string (config, group, "xa.title", NULL);
+
+  return NULL;
+}
+
+gboolean
+flatpak_dir_get_remote_oci (FlatpakDir *self,
+                            const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_boolean (config, group, "xa.oci", NULL);
+
+  return FALSE;
+}
+
+char *
+flatpak_dir_get_remote_main_ref (FlatpakDir *self,
+                                const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_string (config, group, "xa.main-ref", NULL);
+
+  return NULL;
+}
+
+char *
+flatpak_dir_get_remote_default_branch (FlatpakDir *self,
+                                       const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_string (config, group, "xa.default-branch", NULL);
+
+  return NULL;
+}
+
+int
+flatpak_dir_get_remote_prio (FlatpakDir *self,
+                             const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config && g_key_file_has_key (config, group, "xa.prio", NULL))
+    return g_key_file_get_integer (config, group, "xa.prio", NULL);
+
+  return 1;
+}
+
+gboolean
+flatpak_dir_get_remote_noenumerate (FlatpakDir *self,
+                                    const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_boolean (config, group, "xa.noenumerate", NULL);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_get_remote_nodeps (FlatpakDir *self,
+                               const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+
+  if (config)
+    return g_key_file_get_boolean (config, group, "xa.nodeps", NULL);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_get_remote_disabled (FlatpakDir *self,
+                                 const char *remote_name)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+  g_autofree char *group = get_group (remote_name);
+  g_autofree char *url = NULL;
+
+  if (config &&
+      g_key_file_get_boolean (config, group, "xa.disable", NULL))
+    return TRUE;
+
+  if (ostree_repo_remote_get_url (self->repo, remote_name, &url, NULL) && *url == 0)
+    return TRUE; /* Empty URL => disabled */
+
+  return FALSE;
+}
+
+gboolean
+flatpak_dir_remote_has_deploys (FlatpakDir   *self,
+                                const char   *remote)
+{
+  g_autoptr(GHashTable) refs = NULL;
+  GHashTableIter hash_iter;
+  gpointer key;
+
+  refs = flatpak_dir_get_all_installed_refs (self, FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME, NULL);
+  if (refs == NULL)
+    return FALSE;
+
+  g_hash_table_iter_init (&hash_iter, refs);
+  while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+    {
+      const char *ref = (const char *)key;
+      g_autofree char *origin = flatpak_dir_get_origin (self, ref, NULL, NULL);
+
+      if (strcmp (remote, origin) == 0)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gint
+cmp_remote (gconstpointer a,
+            gconstpointer b,
+            gpointer      user_data)
+{
+  FlatpakDir *self = user_data;
+  const char *a_name = *(const char **) a;
+  const char *b_name = *(const char **) b;
+  int prio_a, prio_b;
+
+  prio_a = flatpak_dir_get_remote_prio (self, a_name);
+  prio_b = flatpak_dir_get_remote_prio (self, b_name);
+
+  return prio_b - prio_a;
+}
+
+static gboolean
+origin_remote_matches (OstreeRepo   *repo,
+                       const char   *remote_name,
+                       const char   *url,
+                       const char   *main_ref,
+                       gboolean      gpg_verify,
+                       const char   *collection_id)
+{
+  g_autofree char *real_url = NULL;
+  g_autofree char *real_main_ref = NULL;
+  g_autofree char *real_collection_id = NULL;
+  gboolean noenumerate;
+  gboolean real_gpg_verify;
+
+  /* Must match url */
+  if (!ostree_repo_remote_get_url (repo, remote_name, &real_url, NULL))
+    return FALSE;
+  if (strcmp (url, real_url) != 0)
+    return FALSE;
+
+  /* Must be noenumerate */
+  if (!ostree_repo_get_remote_boolean_option (repo, remote_name,
+                                              "xa.noenumerate",
+                                              FALSE, &noenumerate,
+                                              NULL) ||
+      !noenumerate)
+    return FALSE;
+
+  /* Must be match gpg-verify.
+   * NOTE: We assume if all else matches the actual gpg key matches too. */
+  if (!ostree_repo_get_remote_boolean_option (repo, remote_name,
+                                              "gpg-verify",
+                                              FALSE, &real_gpg_verify,
+                                              NULL) ||
+      real_gpg_verify != gpg_verify)
+    return FALSE;
+
+  /* Must match main-ref */
+  if (ostree_repo_get_remote_option (repo, remote_name,
+                                     "xa.main-ref",
+                                     NULL, &real_main_ref,
+                                     NULL) &&
+      g_strcmp0 (main_ref, real_main_ref) != 0)
+    return FALSE;
+
+  /* Must match main-ref */
+  if (ostree_repo_get_remote_option (repo, remote_name,
+                                     "collection-id",
+                                     NULL, &real_collection_id,
+                                     NULL) &&
+      g_strcmp0 (main_ref, real_main_ref) != 0)
+    return FALSE;
+
+  return TRUE;
+}
+
+static char *
+create_origin_remote_config (OstreeRepo   *repo,
+                             const char   *url,
+                             const char   *id,
+                             const char   *title,
+                             const char   *main_ref,
+                             gboolean      gpg_verify,
+                             const char   *collection_id,
+                             GKeyFile    **new_config)
+{
+  g_autofree char *remote = NULL;
+  g_auto(GStrv) remotes = NULL;
+  int version = 0;
+  g_autofree char *group = NULL;
+
+  remotes = ostree_repo_remote_list (repo, NULL);
+
+  do
+    {
+      g_autofree char *name = NULL;
+      if (version == 0)
+        name = g_strdup_printf ("%s-origin", id);
+      else
+        name = g_strdup_printf ("%s-%d-origin", id, version);
+      version++;
+
+      if (origin_remote_matches (repo, name, url, main_ref, gpg_verify, collection_id))
+        return g_steal_pointer (&name);
+
+      if (remotes == NULL ||
+          !g_strv_contains ((const char * const *) remotes, name))
+        remote = g_steal_pointer (&name);
+    }
+  while (remote == NULL);
+
+  group = g_strdup_printf ("remote \"%s\"", remote);
+
+  *new_config = g_key_file_new ();
+
+  g_key_file_set_string (*new_config, group, "url", url ? url : "");
+  if (title)
+    g_key_file_set_string (*new_config, group, "xa.title", title);
+  g_key_file_set_string (*new_config, group, "xa.noenumerate", "true");
+  g_key_file_set_string (*new_config, group, "xa.prio", "0");
+  /* Don’t enable summary verification if a collection ID is set, as collection
+   * IDs enable the verification of refs from commit metadata instead. */
+  g_key_file_set_string (*new_config, group, "gpg-verify-summary", (gpg_verify && collection_id == NULL) ? "true" : "false");
+  g_key_file_set_string (*new_config, group, "gpg-verify", gpg_verify ? "true" : "false");
+  if (main_ref)
+    g_key_file_set_string (*new_config, group, "xa.main-ref", main_ref);
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (collection_id)
+    g_key_file_set_string (*new_config, group, "collection-id", collection_id);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  return g_steal_pointer (&remote);
+}
+
+char *
+flatpak_dir_create_origin_remote (FlatpakDir   *self,
+                                  const char   *url,
+                                  const char   *id,
+                                  const char   *title,
+                                  const char   *main_ref,
+                                  GBytes       *gpg_data,
+                                  const char   *collection_id,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  g_autoptr(GKeyFile) new_config = NULL;
+  g_autofree char *remote = NULL;
+
+  remote = create_origin_remote_config (self->repo, url, id, title, main_ref, gpg_data != NULL, collection_id, &new_config);
+
+  if (new_config &&
+      !flatpak_dir_modify_remote (self, remote, new_config,
+                                  gpg_data, cancellable, error))
+    return NULL;
+
+  if (!ostree_repo_reload_config (self->repo, cancellable, error))
+    return FALSE;
+
+  return g_steal_pointer (&remote);
+}
+
+GKeyFile *
+flatpak_dir_parse_repofile (FlatpakDir   *self,
+                            const char   *remote_name,
+                            gboolean      from_ref,
+                            GBytes       *data,
+                            GBytes      **gpg_data_out,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GBytes) gpg_data = NULL;
+  g_autofree char *uri = NULL;
+  g_autofree char *title = NULL;
+  g_autofree char *gpg_key = NULL;
+  g_autofree char *collection_id = NULL;
+  g_autofree char *default_branch = NULL;
+  gboolean nodeps;
+  const char *source_group;
+
+  if (from_ref)
+    source_group = FLATPAK_REF_GROUP;
+  else
+    source_group = FLATPAK_REPO_GROUP;
+
+  GKeyFile *config = g_key_file_new ();
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote_name);
+
+  if (!g_key_file_load_from_data (keyfile,
+                                  g_bytes_get_data (data, NULL),
+                                  g_bytes_get_size (data),
+                                  0, &local_error))
+    {
+      flatpak_fail (error, "Invalid .flatpakref: %s\n", local_error->message);
+      return NULL;
+    }
+
+  if (!g_key_file_has_group (keyfile, source_group))
+    {
+      flatpak_fail (error, "Invalid .flatpakref\n");
+      return NULL;
+    }
+
+  uri = g_key_file_get_string (keyfile, source_group,
+                               FLATPAK_REPO_URL_KEY, NULL);
+  if (uri == NULL)
+    {
+      flatpak_fail (error, "Invalid .flatpakref\n");
+      return NULL;
+    }
+
+  g_key_file_set_string (config, group, "url", uri);
+
+  title = g_key_file_get_locale_string (keyfile, source_group,
+                                        FLATPAK_REPO_TITLE_KEY, NULL, NULL);
+  if (title != NULL)
+    g_key_file_set_string (config, group, "xa.title", title);
+
+  default_branch = g_key_file_get_locale_string (keyfile, source_group,
+                                                 FLATPAK_REPO_DEFAULT_BRANCH_KEY, NULL, NULL);
+  if (default_branch != NULL)
+    g_key_file_set_string (config, group, "xa.default-branch", default_branch);
+
+  nodeps = g_key_file_get_boolean (keyfile, source_group,
+                                   FLATPAK_REPO_NODEPS_KEY, NULL);
+  if (nodeps)
+    g_key_file_set_boolean (config, group, "xa.nodeps", TRUE);
+
+  gpg_key = g_key_file_get_string (keyfile, source_group,
+                                   FLATPAK_REPO_GPGKEY_KEY, NULL);
+  if (gpg_key != NULL)
+    {
+      guchar *decoded;
+      gsize decoded_len;
+
+      gpg_key = g_strstrip (gpg_key);
+      decoded = g_base64_decode (gpg_key, &decoded_len);
+      if (decoded_len < 10) /* Check some minimal size so we don't get crap */
+        {
+          flatpak_fail (error, "Invalid gpg key\n");
+          return NULL;
+        }
+
+      gpg_data = g_bytes_new_take (decoded, decoded_len);
+      g_key_file_set_boolean (config, group, "gpg-verify", TRUE);
+    }
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = g_key_file_get_string (keyfile, source_group,
+                                         FLATPAK_REPO_COLLECTION_ID_KEY, NULL);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+  if (collection_id != NULL)
+    {
+      if (gpg_key == NULL)
+        {
+          flatpak_fail (error, "Collection ID requires GPG key to be provided");
+          return NULL;
+        }
+
+      g_key_file_set_string (config, group, "collection-id", collection_id);
+    }
+
+  /* If a collection ID is set, refs are verified from commit metadata rather
+   * than the summary file. */
+  g_key_file_set_boolean (config, group, "gpg-verify-summary",
+                          (gpg_key != NULL && collection_id == NULL));
+
+  *gpg_data_out = g_steal_pointer (&gpg_data);
+
+  return g_steal_pointer (&config);
+}
+
+static gboolean
+parse_ref_file (GBytes *data,
+                char **name_out,
+                char **branch_out,
+                char **url_out,
+                char **title_out,
+                GBytes **gpg_data_out,
+                gboolean *is_runtime_out,
+                char **collection_id_out,
+                GError **error)
+{
+  g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+  g_autofree char *url = NULL;
+  g_autofree char *title = NULL;
+  g_autofree char *name = NULL;
+  g_autofree char *branch = NULL;
+  g_autofree char *version = NULL;
+  g_autoptr(GBytes) gpg_data = NULL;
+  gboolean is_runtime = FALSE;
+  g_autofree char *collection_id = NULL;
+  char *str;
+
+  *name_out = NULL;
+  *branch_out = NULL;
+  *url_out = NULL;
+  *title_out = NULL;
+  *gpg_data_out = NULL;
+  *is_runtime_out = FALSE;
+
+  if (!g_key_file_load_from_data (keyfile, g_bytes_get_data (data, NULL), g_bytes_get_size (data),
+                                  0, error))
+    return FALSE;
+
+  if (!g_key_file_has_group (keyfile, FLATPAK_REF_GROUP))
+    return flatpak_fail (error, "Invalid file format, no %s group", FLATPAK_REF_GROUP);
+
+  version = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                   FLATPAK_REF_VERSION_KEY, NULL);
+  if (version != NULL && strcmp (version, "1") != 0)
+    return flatpak_fail (error, "Invalid version %s, only 1 supported", version);
+
+  url = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                               FLATPAK_REF_URL_KEY, NULL);
+  if (url == NULL)
+    return flatpak_fail (error, "Invalid file format, no Url specified");
+
+  name = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                FLATPAK_REF_NAME_KEY, NULL);
+  if (name == NULL)
+    return flatpak_fail (error, "Invalid file format, no Name specified");
+
+  branch = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                  FLATPAK_REF_BRANCH_KEY, NULL);
+  if (branch == NULL)
+    branch = g_strdup ("master");
+
+  title = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                 FLATPAK_REF_TITLE_KEY, NULL);
+
+  is_runtime = g_key_file_get_boolean (keyfile, FLATPAK_REF_GROUP,
+                                       FLATPAK_REF_IS_RUNTIME_KEY, NULL);
+
+  str = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                               FLATPAK_REF_GPGKEY_KEY, NULL);
+  if (str != NULL)
+    {
+      guchar *decoded;
+      gsize decoded_len;
+
+      str = g_strstrip (str);
+      decoded = g_base64_decode (str, &decoded_len);
+      if (decoded_len < 10) /* Check some minimal size so we don't get crap */
+        return flatpak_fail (error, "Invalid file format, gpg key invalid");
+
+      gpg_data = g_bytes_new_take (decoded, decoded_len);
+    }
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
+                                         FLATPAK_REF_COLLECTION_ID_KEY, NULL);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+  if (collection_id != NULL && gpg_data == NULL)
+    return flatpak_fail (error, "Collection ID requires GPG key to be provided");
+
+  *name_out = g_steal_pointer (&name);
+  *branch_out = g_steal_pointer (&branch);
+  *url_out = g_steal_pointer (&url);
+  *title_out = g_steal_pointer (&title);
+  *gpg_data_out = g_steal_pointer (&gpg_data);
+  *is_runtime_out = is_runtime;
+  *collection_id_out = g_steal_pointer (&collection_id);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_create_remote_for_ref_file (FlatpakDir *self,
+                                        GBytes     *data,
+                                        const char *default_arch,
+                                        char      **remote_name_out,
+                                        char      **ref_out,
+                                        GError    **error)
+{
+  g_autoptr(GBytes) gpg_data = NULL;
+  g_autofree char *name = NULL;
+  g_autofree char *branch = NULL;
+  g_autofree char *url = NULL;
+  g_autofree char *title = NULL;
+  g_autofree char *ref = NULL;
+  g_autofree char *remote = NULL;
+  gboolean is_runtime = FALSE;
+  g_autofree char *collection_id = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+
+  if (!parse_ref_file (data, &name, &branch, &url, &title, &gpg_data, &is_runtime, &collection_id, error))
+    return FALSE;
+
+  ref = flatpak_compose_ref (!is_runtime, name, branch, default_arch, error);
+  if (ref == NULL)
+    return FALSE;
+
+  deploy_dir = flatpak_dir_get_if_deployed (self, ref, NULL, NULL);
+  if (deploy_dir != NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                   is_runtime ? _("Runtime %s, branch %s is already installed")
+                   : _("App %s, branch %s is already installed"),
+                   name, branch);
+      return FALSE;
+    }
+
+  /* First try to reuse existing remote */
+  remote = flatpak_dir_find_remote_by_uri (self, url, collection_id);
+
+  if (remote == NULL)
+    {
+      remote = flatpak_dir_create_origin_remote (self, url, name, title, ref,
+                                                 gpg_data, collection_id, NULL, error);
+      if (remote == NULL)
+        return FALSE;
+    }
+
+  *remote_name_out = g_steal_pointer (&remote);
+  *ref_out = (char *)g_steal_pointer (&ref);
+  return TRUE;
+}
+
+char *
+flatpak_dir_find_remote_by_uri (FlatpakDir   *self,
+                                const char   *uri,
+                                const char   *collection_id)
+{
+  g_auto(GStrv) remotes = NULL;
+
+  if (!flatpak_dir_ensure_repo (self, NULL, NULL))
+    return NULL;
+
+#ifndef FLATPAK_ENABLE_P2P
+  /* If we don’t have P2P support enabled, we always want to ignore collection IDs
+   * in comparisons. */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+  remotes = flatpak_dir_list_enumerated_remotes (self, NULL, NULL);
+  if (remotes)
+    {
+      int i;
+
+      for (i = 0; remotes != NULL && remotes[i] != NULL; i++)
+        {
+          const char *remote = remotes[i];
+          g_autofree char *remote_uri = NULL;
+          g_autofree char *remote_collection_id = NULL;
+
+          if (!ostree_repo_remote_get_url (self->repo,
+                                           remote,
+                                           &remote_uri,
+                                           NULL))
+            continue;
+          if (!repo_get_remote_collection_id (self->repo, remote, &remote_collection_id, NULL))
+            continue;
+
+          if (strcmp (uri, remote_uri) == 0 &&
+              g_strcmp0 (collection_id, remote_collection_id) == 0)
+            return g_strdup (remote);
+        }
+    }
+
+  return NULL;
+}
+
+gboolean
+flatpak_dir_has_remote (FlatpakDir   *self,
+                        const char   *remote_name)
+{
+  GKeyFile *config = NULL;
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote_name);
+
+  if (!flatpak_dir_maybe_ensure_repo (self, NULL, NULL))
+    return FALSE;
+
+  if (self->repo == NULL)
+    return FALSE;
+
+  config = ostree_repo_get_config (self->repo);
+
+  return g_key_file_has_group (config, group);
+}
+
+
+char **
+flatpak_dir_list_remotes (FlatpakDir   *self,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  char **res = NULL;
+
+  if (!flatpak_dir_maybe_ensure_repo (self, cancellable, error))
+    return NULL;
+
+  if (self->repo)
+    res = ostree_repo_remote_list (self->repo, NULL);
+
+  if (res == NULL)
+    res = g_new0 (char *, 1); /* Return empty array, not error */
+
+  g_qsort_with_data (res, g_strv_length (res), sizeof (char *),
+                     cmp_remote, self);
+
+  return res;
+}
+
+char **
+flatpak_dir_list_enumerated_remotes (FlatpakDir   *self,
+                                     GCancellable *cancellable,
+                                     GError      **error)
+{
+  g_autoptr(GPtrArray) res = g_ptr_array_new_with_free_func (g_free);
+  g_auto(GStrv) remotes = NULL;
+  int i;
+
+  remotes = flatpak_dir_list_remotes (self, cancellable, error);
+  if (remotes == NULL)
+    return NULL;
+
+  for (i = 0; remotes != NULL && remotes[i] != NULL; i++)
+    {
+      const char *remote = remotes[i];
+
+      if (flatpak_dir_get_remote_disabled (self, remote))
+        continue;
+
+      if (flatpak_dir_get_remote_noenumerate (self, remote))
+        continue;
+
+      g_ptr_array_add (res, g_strdup (remote));
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **)g_ptr_array_free (g_steal_pointer (&res), FALSE);
+}
+
+char **
+flatpak_dir_search_for_dependency (FlatpakDir   *self,
+                                   const char   *runtime_ref,
+                                   GCancellable *cancellable,
+                                   GError      **error)
+{
+  g_autoptr(GPtrArray) found = g_ptr_array_new_with_free_func (g_free);
+  g_auto(GStrv) remotes = NULL;
+  int i;
+
+  remotes = flatpak_dir_list_enumerated_remotes (self, cancellable, error);
+  if (remotes == NULL)
+    return NULL;
+
+  for (i = 0; remotes != NULL && remotes[i] != NULL; i++)
+    {
+      const char *remote = remotes[i];
+
+      if (flatpak_dir_get_remote_nodeps (self, remote))
+        continue;
+
+      if (flatpak_dir_remote_has_ref (self, remote, runtime_ref))
+        g_ptr_array_add (found, g_strdup (remote));
+    }
+
+  g_ptr_array_add (found, NULL);
+
+  return (char **)g_ptr_array_free (g_steal_pointer (&found), FALSE);
+}
+
+gboolean
+flatpak_dir_remove_remote (FlatpakDir   *self,
+                           gboolean      force_remove,
+                           const char   *remote_name,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autofree char *prefix = NULL;
+  g_autoptr(GHashTable) refs = NULL;
+  GHashTableIter hash_iter;
+  gpointer key;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      FlatpakSystemHelper *system_helper;
+      g_autoptr(GVariant) gpg_data_v = NULL;
+      FlatpakHelperConfigureRemoteFlags flags = 0;
+      const char *installation = flatpak_dir_get_id (self);
+
+      gpg_data_v = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL));
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      if (force_remove)
+        flags |= FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE;
+
+      g_debug ("Calling system helper: ConfigureRemote");
+      if (!flatpak_system_helper_call_configure_remote_sync (system_helper,
+                                                             flags, remote_name,
+                                                             "",
+                                                             gpg_data_v,
+                                                             installation ? installation : "",
+                                                             cancellable, error))
+        return FALSE;
+
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  if (!ostree_repo_list_refs (self->repo,
+                              NULL,
+                              &refs,
+                              cancellable, error))
+    return FALSE;
+
+  prefix = g_strdup_printf ("%s:", remote_name);
+
+  if (!force_remove)
+    {
+      g_hash_table_iter_init (&hash_iter, refs);
+      while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+        {
+          const char *refspec = key;
+
+          if (g_str_has_prefix (refspec, prefix))
+            {
+              const char *unprefixed_refspec = refspec + strlen (prefix);
+              g_autofree char *origin = flatpak_dir_get_origin (self, unprefixed_refspec,
+                                                                cancellable, NULL);
+
+              if (g_strcmp0 (origin, remote_name) == 0)
+                return flatpak_fail (error, "Can't remove remote '%s' with installed ref %s (at least)",
+                                     remote_name, unprefixed_refspec);
+            }
+        }
+    }
+
+  /* Remove all refs */
+  g_hash_table_iter_init (&hash_iter, refs);
+  while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+    {
+      const char *refspec = key;
+
+      if (g_str_has_prefix (refspec, prefix) &&
+          !flatpak_dir_remove_ref (self, remote_name, refspec + strlen (prefix), cancellable, error))
+        return FALSE;
+    }
+
+  if (!flatpak_dir_remove_appstream (self, remote_name,
+                                     cancellable, error))
+    return FALSE;
+
+  if (!ostree_repo_remote_change (self->repo, NULL,
+                                  OSTREE_REPO_REMOTE_CHANGE_DELETE,
+                                  remote_name, NULL,
+                                  NULL,
+                                  cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_mark_changed (self, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_modify_remote (FlatpakDir   *self,
+                           const char   *remote_name,
+                           GKeyFile     *config,
+                           GBytes       *gpg_data,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote_name);
+  g_autofree char *url = NULL;
+  g_autofree char *metalink = NULL;
+  g_autoptr(GKeyFile) new_config = NULL;
+  g_auto(GStrv) keys = NULL;
+  int i;
+
+  if (strchr (remote_name, '/') != NULL)
+    return flatpak_fail (error, "Invalid character '/' in remote name: %s",
+                         remote_name);
+
+
+  if (!g_key_file_has_group (config, group))
+    return flatpak_fail (error, "No configuration for remote %s specified",
+                         remote_name);
+
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      FlatpakSystemHelper *system_helper;
+      g_autofree char *config_data = g_key_file_to_data (config, NULL, NULL);
+      g_autoptr(GVariant) gpg_data_v = NULL;
+      const char *installation = flatpak_dir_get_id (self);
+
+      if (gpg_data != NULL)
+        gpg_data_v = variant_new_ay_bytes (gpg_data);
+      else
+        gpg_data_v = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL));
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      g_debug ("Calling system helper: ConfigureRemote");
+      if (!flatpak_system_helper_call_configure_remote_sync (system_helper,
+                                                             0, remote_name,
+                                                             config_data,
+                                                             gpg_data_v,
+                                                             installation ? installation : "",
+                                                             cancellable, error))
+        return FALSE;
+
+      return TRUE;
+    }
+
+  metalink = g_key_file_get_string (config, group, "metalink", NULL);
+  if (metalink != NULL && *metalink != 0)
+    url = g_strconcat ("metalink=", metalink, NULL);
+  else
+    url = g_key_file_get_string (config, group, "url", NULL);
+
+  /* No url => disabled */
+  if (url == NULL)
+    url = g_strdup ("");
+
+  /* Add it if its not there yet */
+  if (!ostree_repo_remote_change (self->repo, NULL,
+                                  OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
+                                  remote_name,
+                                  url, NULL, cancellable, error))
+    return FALSE;
+
+  new_config = ostree_repo_copy_config (self->repo);
+
+  g_key_file_remove_group (new_config, group, NULL);
+
+  keys = g_key_file_get_keys (config,
+                              group,
+                              NULL, error);
+  if (keys == NULL)
+    return FALSE;
+
+  for (i = 0; keys[i] != NULL; i++)
+    {
+      g_autofree gchar *value = g_key_file_get_value (config, group, keys[i], NULL);
+      if (value)
+        g_key_file_set_value (new_config, group, keys[i], value);
+    }
+
+  if (!ostree_repo_write_config (self->repo, new_config, error))
+    return FALSE;
+
+  if (gpg_data != NULL)
+    {
+      g_autoptr(GInputStream) input_stream = g_memory_input_stream_new_from_bytes (gpg_data);
+      guint imported = 0;
+
+      if (!ostree_repo_remote_gpg_import (self->repo, remote_name, input_stream,
+                                          NULL, &imported, cancellable, error))
+        return FALSE;
+
+      /* XXX If we ever add internationalization, use ngettext() here. */
+      g_debug ("Imported %u GPG key%s to remote \"%s\"",
+               imported, (imported == 1) ? "" : "s", remote_name);
+    }
+
+  if (!flatpak_dir_mark_changed (self, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+remove_unless_in_hash (gpointer key,
+                       gpointer value,
+                       gpointer user_data)
+{
+  GHashTable *table = user_data;
+
+  return !g_hash_table_contains (table, key);
+}
+
+gboolean
+flatpak_dir_list_remote_refs (FlatpakDir   *self,
+                              const char   *remote,
+                              GHashTable  **refs,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  g_autoptr(GError) my_error = NULL;
+
+  if (error == NULL)
+    error = &my_error;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_remote_list_refs (self, remote, refs,
+                                     cancellable, error))
+    return FALSE;
+
+  if (flatpak_dir_get_remote_noenumerate (self, remote))
+    {
+      g_autoptr(GHashTable) unprefixed_local_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+      g_autoptr(GHashTable) local_refs = NULL;
+      GHashTableIter hash_iter;
+      gpointer key;
+      g_autofree char *refspec_prefix = g_strconcat (remote, ":.", NULL);
+
+      /* For noenumerate remotes, only return data for already locally
+       * available refs */
+
+      if (!ostree_repo_list_refs (self->repo, refspec_prefix, &local_refs,
+                                  cancellable, error))
+        return FALSE;
+
+      /* First we need to unprefix the remote name from the local refs */
+      g_hash_table_iter_init (&hash_iter, local_refs);
+      while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+        {
+          char *ref = NULL;
+          ostree_parse_refspec (key, NULL, &ref, NULL);
+
+          if (ref)
+            g_hash_table_insert (unprefixed_local_refs, ref, NULL);
+        }
+
+      /* Then we remove all remote refs not in the local refs set */
+      g_hash_table_foreach_remove (*refs,
+                                   remove_unless_in_hash,
+                                   unprefixed_local_refs);
+    }
+
+  return TRUE;
+}
+
+static GVariant *
+fetch_remote_summary_file (FlatpakDir   *self,
+                           const char   *remote,
+                           GBytes     **summary_sig_bytes_out,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autoptr(GError) my_error = NULL;
+  g_autoptr(GBytes) summary_bytes = NULL;
+  g_autoptr(GBytes) summary_sig_bytes = NULL;
+
+  if (error == NULL)
+    error = &my_error;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return NULL;
+
+  if (!flatpak_dir_remote_fetch_summary (self, remote,
+                                         &summary_bytes, &summary_sig_bytes,
+                                         cancellable, error))
+    return NULL;
+
+
+  if (summary_sig_bytes_out != NULL)
+    *summary_sig_bytes_out = g_steal_pointer (&summary_sig_bytes);
+  return g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
+                                                       summary_bytes, FALSE));
+}
+
+char *
+flatpak_dir_fetch_remote_title (FlatpakDir   *self,
+                                const char   *remote,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  g_autofree char *title = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  if (!flatpak_dir_lookup_repo_metadata (self, remote, cancellable, &local_error,
+                                         "xa.title", "s", &title))
+    {
+      if (local_error == NULL)
+        g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                             _("Remote title not set"));
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }
+
+  return g_steal_pointer (&title);
+}
+
+char *
+flatpak_dir_fetch_remote_default_branch (FlatpakDir   *self,
+                                         const char   *remote,
+                                         GCancellable *cancellable,
+                                         GError      **error)
+{
+  g_autofree char *default_branch = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  if (!flatpak_dir_lookup_repo_metadata (self, remote, cancellable, &local_error,
+                                         "xa.default-branch", "s", &default_branch))
+    {
+      if (local_error == NULL)
+        g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                             _("Remote default-branch not set"));
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }
+
+  return g_steal_pointer (&default_branch);
+}
+
+gboolean
+flatpak_dir_fetch_remote_repo_metadata (FlatpakDir    *self,
+                                        const char    *remote_name,
+                                        GCancellable  *cancellable,
+                                        GError       **error)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  FlatpakPullFlags flatpak_flags;
+  gboolean gpg_verify;
+  g_autofree char *checksum_from_summary = NULL;
+  g_autofree char *checksum_from_repo = NULL;
+  g_autofree char *refspec = NULL;
+
+  /* We can only fetch metadata if we’re going to verify it with GPG. */
+  if (!ostree_repo_remote_get_gpg_verify (self->repo, remote_name,
+                                          &gpg_verify, error))
+    return FALSE;
+
+  if (!gpg_verify)
+    return flatpak_fail (error, "Can't pull from untrusted non-gpg verified remote");
+
+  /* Look up the checksum as advertised by the summary file. If it differs from
+   * what we currently have on disk, try and pull the updated ostree-metadata ref.
+   * This is how we implement caching. Ignore failure and pull the ref anyway. */
+  checksum_from_summary = flatpak_dir_lookup_ref_from_summary (self, remote_name,
+                                                               OSTREE_REPO_METADATA_REF,
+                                                               NULL, NULL, NULL, NULL);
+  refspec = g_strdup_printf ("%s:%s", remote_name, OSTREE_REPO_METADATA_REF);
+  if (!ostree_repo_resolve_rev (self->repo, refspec, TRUE, &checksum_from_repo, error))
+    return FALSE;
+
+  g_debug ("%s: Comparing %s from summary and %s from repo",
+           G_STRFUNC, checksum_from_summary, checksum_from_repo);
+
+  if (checksum_from_summary != NULL && checksum_from_repo != NULL &&
+      g_str_equal (checksum_from_summary, checksum_from_repo))
+    return TRUE;
+
+  /* Do the pull into the local repository. */
+  flatpak_flags = FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA;
+  flatpak_flags |= FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      g_autoptr(OstreeRepo) child_repo = NULL;
+      g_auto(GLnxLockFile) child_repo_lock = { 0, };
+      const char *installation = flatpak_dir_get_id (self);
+      const char *subpaths[] = {NULL};
+      g_autofree char *child_repo_path = NULL;
+      FlatpakSystemHelper *system_helper;
+      FlatpakHelperDeployFlags helper_flags = 0;
+      g_autofree char *url = NULL;
+      gboolean gpg_verify_summary;
+      gboolean gpg_verify;
+      g_autofree char *collection_id = NULL;
+      gboolean is_oci;
+
+      system_helper = flatpak_dir_get_system_helper (self);
+      g_assert (system_helper != NULL);
+
+      if (!flatpak_dir_ensure_repo (self, cancellable, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_url (self->repo,
+                                       remote_name,
+                                       &url,
+                                       error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, remote_name,
+                                                      &gpg_verify_summary, error))
+        return FALSE;
+
+      if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify (self->repo, remote_name,
+                                              &gpg_verify, error))
+        return FALSE;
+
+      is_oci = flatpak_dir_get_remote_oci (self, remote_name);
+
+      if ((!gpg_verify_summary && collection_id == NULL) || !gpg_verify)
+        {
+          /* The remote is not gpg verified, so we don't want to allow installation via
+             a download in the home directory, as there is no way to verify you're not
+             injecting anything into the remote. However, in the case of a remote
+             configured to a local filesystem we can just let the system helper do
+             the installation, as it can then avoid network i/o and be certain the
+             data comes from the right place.
+
+             If a collection ID is available, we can verify the refs in commit
+             metadata. */
+          if (g_str_has_prefix (url, "file:"))
+            helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL;
+          else
+            return flatpak_fail (error, "Can't pull from untrusted non-gpg verified remote");
+        }
+      else if (is_oci)
+        {
+          g_autoptr(FlatpakOciRegistry) registry = NULL;
+          g_autoptr(GFile) registry_file = NULL;
+
+          registry = flatpak_dir_create_system_child_oci_registry (self, &child_repo_lock, error);
+          if (registry == NULL)
+            return FALSE;
+
+          registry_file = g_file_new_for_uri (flatpak_oci_registry_get_uri (registry));
+
+          child_repo_path = g_file_get_path (registry_file);
+
+          if (!flatpak_dir_mirror_oci (self, registry, remote_name, OSTREE_REPO_METADATA_REF, NULL, NULL, cancellable, error))
+            return FALSE;
+        }
+      else
+        {
+          /* We're pulling from a remote source, we do the network mirroring pull as a
+             user and hand back the resulting data to the system-helper, that trusts us
+             due to the GPG signatures in the repo */
+          child_repo = flatpak_dir_create_system_child_repo (self, &child_repo_lock, NULL, error);
+          if (child_repo == NULL)
+            return FALSE;
+
+          if (!flatpak_dir_pull (self, remote_name, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL,
+                                 child_repo,
+                                 flatpak_flags,
+                                 OSTREE_REPO_PULL_FLAGS_MIRROR,
+                                 NULL, cancellable, error))
+            return FALSE;
+
+          child_repo_path = g_file_get_path (ostree_repo_get_path (child_repo));
+        }
+
+      helper_flags |= FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY;
+
+      g_debug ("Calling system helper: Deploy");
+      if (!flatpak_system_helper_call_deploy_sync (system_helper,
+                                                   child_repo_path ? child_repo_path : "",
+                                                   helper_flags, OSTREE_REPO_METADATA_REF, remote_name,
+                                                   (const char * const *) subpaths,
+                                                   installation ? installation : "",
+                                                   cancellable,
+                                                   error))
+        return FALSE;
+
+      if (child_repo_path)
+        (void) glnx_shutil_rm_rf_at (AT_FDCWD, child_repo_path, NULL, NULL);
+
+      return TRUE;
+    }
+
+  if (!flatpak_dir_pull (self, remote_name, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL, NULL,
+                         flatpak_flags, OSTREE_REPO_PULL_FLAGS_NONE,
+                         NULL, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+#else  /* if !FLATPAK_ENABLE_P2P */
+  g_assert_not_reached ();
+#endif  /* FLATPAK_ENABLE_P2P */
+}
+
+static gboolean
+flatpak_dir_update_remote_configuration_for_dict (FlatpakDir    *self,
+                                                  const char    *remote,
+                                                  GVariant      *metadata,
+                                                  gboolean       dry_run,
+                                                  gboolean      *has_changed_out,
+                                                  GCancellable  *cancellable,
+                                                  GError       **error)
+{
+  /* We only support those configuration parameters that can
+     be set in the server when building the repo (see the
+     flatpak_repo_set_* () family of functions) */
+  static const char *const supported_params[] = {
+    "xa.title",
+    "xa.default-branch",
+    "xa.gpg-keys",
+    "xa.redirect-url",
+    "xa.collection-id",
+    NULL
+  };
+
+  g_autoptr(GPtrArray) updated_params = NULL;
+  GVariantIter iter;
+  g_autoptr(GBytes) gpg_keys = NULL;
+
+  updated_params = g_ptr_array_new_with_free_func (g_free);
+
+  g_variant_iter_init (&iter, metadata);
+  if (g_variant_iter_n_children (&iter) > 0)
+    {
+      GVariant *value_var = NULL;
+      char *key = NULL;
+
+      while (g_variant_iter_next (&iter, "{sv}", &key, &value_var))
+        {
+          if (g_strv_contains (supported_params, key))
+            {
+              if (strcmp (key, "xa.gpg-keys") == 0)
+                {
+                  if (g_variant_is_of_type (value_var, G_VARIANT_TYPE_BYTESTRING))
+                    {
+                      const guchar *gpg_data = g_variant_get_data (value_var);
+                      gsize gpg_size = g_variant_get_size (value_var);
+                      g_autofree gchar *gpg_data_checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA256, gpg_data, gpg_size);
+
+                      gpg_keys = g_bytes_new (gpg_data, gpg_size);
+
+                      /* We store the hash so that we can detect when things changed or not
+                         instead of re-importing the key over-and-over */
+                      g_ptr_array_add (updated_params, g_strdup ("xa.gpg-keys-hash"));
+                      g_ptr_array_add (updated_params, g_steal_pointer (&gpg_data_checksum));
+                    }
+                }
+              else if (g_variant_is_of_type (value_var, G_VARIANT_TYPE_STRING))
+                {
+                  const char *value = g_variant_get_string(value_var, NULL);
+                  if (value != NULL && *value != 0)
+                    {
+                      if (strcmp (key, "xa.redirect-url") == 0)
+                        g_ptr_array_add (updated_params, g_strdup ("url"));
+                      else if (strcmp (key, "xa.collection-id") == 0)
+                        g_ptr_array_add (updated_params, g_strdup ("collection-id"));
+                      else
+                        g_ptr_array_add (updated_params, g_strdup (key));
+                      g_ptr_array_add (updated_params, g_strdup (value));
+                    }
+                }
+            }
+
+          g_variant_unref (value_var);
+          g_free (key);
+        }
+    }
+
+  if (updated_params->len > 0)
+  {
+    g_autoptr(GKeyFile) config = NULL;
+    g_autofree char *group = NULL;
+    gboolean has_changed = FALSE;
+    int i;
+
+    config = ostree_repo_copy_config (flatpak_dir_get_repo (self));
+    group = g_strdup_printf ("remote \"%s\"", remote);
+
+    i = 0;
+    while (i < (updated_params->len - 1))
+      {
+        /* This array should have an even number of elements with
+           keys in the odd positions and values on even ones. */
+        const char *key = g_ptr_array_index (updated_params, i);
+        const char *new_val = g_ptr_array_index (updated_params, i+1);
+        g_autofree char *current_val = NULL;
+        g_autofree char *is_set_key = g_strconcat (key, "-is-set", NULL);
+        gboolean is_set = FALSE;
+
+        is_set = g_key_file_get_boolean (config, group, is_set_key, NULL);
+        if (!is_set)
+          {
+            current_val = g_key_file_get_string (config, group, key, NULL);
+            if ((!g_str_equal (key, "collection-id") &&
+                 g_strcmp0 (current_val, new_val) != 0) ||
+                (g_str_equal (key, "collection-id") &&
+                 (current_val == NULL || *current_val == '\0') &&
+                 new_val != NULL && *new_val != '\0'))
+              {
+                has_changed = TRUE;
+                g_key_file_set_string (config, group, key, new_val);
+
+                /* Special case for collection-id: if it’s set, gpg-verify-summary
+                 * must be set to false. The logic above ensures that the
+                 * collection-id is only set if we’re transitioning from an
+                 * unset to a set collection-ID. We *must not* allow the
+                 * collection ID to be changed from one set value to another
+                 * without the user manually verifying it; or a malicious
+                 * repository could assume the collection ID of another without
+                 * the user’s consent. */
+                if (g_str_equal (key, "collection-id") &&
+                    new_val != NULL && *new_val != '\0')
+                  g_key_file_set_boolean (config, group, "gpg-verify-summary", FALSE);
+              }
+          }
+
+        i += 2;
+      }
+
+    if (has_changed_out)
+      *has_changed_out = has_changed;
+
+    if (dry_run || !has_changed)
+      return TRUE;
+
+    /* Update the local remote configuration with the updated info. */
+    if (!flatpak_dir_modify_remote (self, remote, config, gpg_keys, cancellable, error))
+      return FALSE;
+  }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_dir_update_remote_configuration_for_summary (FlatpakDir    *self,
+                                                     const char    *remote,
+                                                     GVariant      *summary,
+                                                     gboolean       dry_run,
+                                                     gboolean      *has_changed_out,
+                                                     GCancellable  *cancellable,
+                                                     GError       **error)
+{
+  g_autoptr(GVariant) extensions = NULL;
+
+  extensions = g_variant_get_child_value (summary, 1);
+
+  return flatpak_dir_update_remote_configuration_for_dict (self, remote, extensions,
+                                                           dry_run, has_changed_out,
+                                                           cancellable, error);
+}
+
+gboolean
+flatpak_dir_update_remote_configuration_for_repo_metadata (FlatpakDir    *self,
+                                                           const char    *remote,
+                                                           GVariant      *summary,
+                                                           gboolean       dry_run,
+                                                           gboolean      *has_changed_out,
+                                                           GCancellable  *cancellable,
+                                                           GError       **error)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  g_autofree char *latest_rev = NULL;
+  g_autoptr(GVariant) commit_v = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *collection_id = NULL;
+
+  /* Derive the collection ID from the remote we are querying. This will act as
+   * a sanity check on the summary ref lookup. */
+  if (!repo_get_remote_collection_id (self->repo, remote, &collection_id, error))
+    return FALSE;
+
+  if (!flatpak_summary_lookup_ref (summary, collection_id, OSTREE_REPO_METADATA_REF, &latest_rev, NULL))
+    return flatpak_fail (error, "No such ref '%s' in remote %s", OSTREE_REPO_METADATA_REF, remote);
+
+  if (!ostree_repo_load_commit (self->repo, latest_rev, &commit_v, NULL, error))
+    return FALSE;
+
+  metadata = g_variant_get_child_value (commit_v, 0);
+
+  return flatpak_dir_update_remote_configuration_for_dict (self, remote, metadata,
+                                                           dry_run, has_changed_out,
+                                                           cancellable, error);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  g_assert_not_reached ();
+#endif  /* FLATPAK_ENABLE_P2P */
+}
+
+gboolean
+flatpak_dir_update_remote_configuration (FlatpakDir   *self,
+                                         const char   *remote,
+                                         GCancellable *cancellable,
+                                         GError      **error)
+{
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GBytes) summary_sig_bytes = NULL;
+  gboolean is_oci;
+  g_autofree char *collection_id = NULL;
+
+  if (flatpak_dir_get_remote_disabled (self, remote))
+    return TRUE;
+
+  is_oci = flatpak_dir_get_remote_oci (self, remote);
+  if (is_oci)
+    return TRUE;
+
+  if (!repo_get_remote_collection_id (self->repo, remote, &collection_id, error))
+    return FALSE;
+
+  summary = fetch_remote_summary_file (self, remote, &summary_sig_bytes, cancellable, error);
+  if (summary == NULL)
+    return FALSE;
+
+  if (collection_id != NULL &&
+      !flatpak_dir_fetch_remote_repo_metadata (self, remote, cancellable, error))
+    return FALSE;
+
+  if (flatpak_dir_use_system_helper (self, NULL))
+    {
+      gboolean has_changed = FALSE;
+      gboolean gpg_verify_summary;
+      gboolean gpg_verify;
+
+      if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, remote, &gpg_verify_summary, error))
+        return FALSE;
+
+      if (!ostree_repo_remote_get_gpg_verify (self->repo, remote, &gpg_verify, error))
+        return FALSE;
+
+      if ((!gpg_verify_summary && collection_id == NULL) || !gpg_verify)
+        {
+          g_debug ("Ignoring automatic updates for system-helper remotes without gpg signatures");
+          return TRUE;
+        }
+
+      if ((collection_id == NULL &&
+           !flatpak_dir_update_remote_configuration_for_summary (self, remote, summary, TRUE, &has_changed, cancellable, error)) ||
+          (collection_id != NULL &&
+           !flatpak_dir_update_remote_configuration_for_repo_metadata (self, remote, summary, TRUE, &has_changed, cancellable, error)))
+        return FALSE;
+
+      if (collection_id == NULL && summary_sig_bytes == NULL)
+        {
+          g_debug ("Can't update remote configuration as user, no GPG signature)");
+          return TRUE;
+        }
+
+      if (has_changed)
+        {
+          g_autoptr(GBytes) bytes = g_variant_get_data_as_bytes (summary);
+          glnx_autofd int summary_fd = -1;
+          g_autofree char *summary_path = NULL;
+          glnx_autofd int summary_sig_fd = -1;
+          g_autofree char *summary_sig_path = NULL;
+          FlatpakSystemHelper *system_helper;
+          const char *installation;
+
+          system_helper = flatpak_dir_get_system_helper (self);
+          g_assert (system_helper != NULL);
+
+          summary_fd = g_file_open_tmp ("remote-summary.XXXXXX", &summary_path, error);
+          if (summary_fd == -1)
+            return FALSE;
+          if (glnx_loop_write (summary_fd, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes)) < 0)
+            return glnx_throw_errno (error);
+
+          if (summary_sig_bytes != NULL)
+            {
+              summary_sig_fd = g_file_open_tmp ("remote-summary-sig.XXXXXX", &summary_sig_path, error);
+              if (summary_sig_fd == -1)
+                return FALSE;
+              if (glnx_loop_write (summary_sig_fd, g_bytes_get_data (summary_sig_bytes, NULL), g_bytes_get_size (summary_sig_bytes)) < 0)
+                return glnx_throw_errno (error);
+            }
+
+          installation = flatpak_dir_get_id (self);
+
+          g_debug ("Calling system helper: UpdateRemote");
+          if (!flatpak_system_helper_call_update_remote_sync (system_helper, 0, remote,
+                                                              installation ? installation : "",
+                                                              summary_path, summary_sig_path,
+                                                              cancellable, error))
+            return FALSE;
+
+          unlink (summary_path);
+          unlink (summary_sig_path);
+        }
+
+      return TRUE;
+    }
+
+  if (collection_id == NULL)
+    return flatpak_dir_update_remote_configuration_for_summary (self, remote, summary, FALSE, NULL, cancellable, error);
+  else
+    return flatpak_dir_update_remote_configuration_for_repo_metadata (self, remote, summary, FALSE, NULL, cancellable, error);
+}
+
+
+static GBytes *
+flatpak_dir_fetch_remote_object (FlatpakDir   *self,
+                                 const char   *remote_name,
+                                 const char   *checksum,
+                                 const char   *type,
+                                 GCancellable *cancellable,
+                                 GError      **error)
+{
+  g_autofree char *base_url = NULL;
+  g_autofree char *object_url = NULL;
+  g_autofree char *part1 = NULL;
+  g_autofree char *part2 = NULL;
+  g_autoptr(GBytes) bytes = NULL;
+
+  if (!ostree_repo_remote_get_url (self->repo, remote_name, &base_url, error))
+    return NULL;
+
+  ensure_soup_session (self);
+
+  part1 = g_strndup (checksum, 2);
+  part2 = g_strdup_printf ("%s.%s", checksum + 2, type);
+
+  object_url = g_build_filename (base_url, "objects", part1, part2, NULL);
+
+  bytes = flatpak_load_http_uri (self->soup_session, object_url, 0,
+                                 NULL, NULL, NULL, NULL,
+                                 cancellable, error);
+  if (bytes == NULL)
+    return NULL;
+
+  return g_steal_pointer (&bytes);
+}
+
+GVariant *
+flatpak_dir_fetch_remote_commit (FlatpakDir   *self,
+                                 const char   *remote_name,
+                                 const char   *ref,
+                                 const char   *opt_commit,
+                                 char        **out_commit,
+                                 GCancellable *cancellable,
+                                 GError      **error)
+{
+  g_autoptr(GBytes) commit_bytes = NULL;
+  g_autoptr(GVariant) commit_variant = NULL;
+  g_autofree char *latest_commit = NULL;
+  g_autoptr(GVariant) commit_metadata = NULL;
+
+  if (opt_commit == NULL)
+    {
+      latest_commit = flatpak_dir_lookup_ref_from_summary (self, remote_name,
+                                                           ref, NULL, NULL,
+                                                           cancellable, error);
+      if (latest_commit == NULL)
+        return NULL;
+      opt_commit = latest_commit;
+    }
+
+  commit_bytes = flatpak_dir_fetch_remote_object (self, remote_name,
+                                                  opt_commit, "commit",
+                                                  cancellable, error);
+  if (commit_bytes == NULL)
+    return NULL;
+
+  commit_variant = g_variant_new_from_bytes (OSTREE_COMMIT_GVARIANT_FORMAT,
+                                             commit_bytes, FALSE);
+  g_variant_ref_sink (commit_variant);
+
+  if (!ostree_validate_structureof_commit (commit_variant, error))
+    return NULL;
+
+  commit_metadata = g_variant_get_child_value (commit_variant, 0);
+  if (ref != NULL)
+    {
+      const char *xa_ref = NULL;
+      g_autofree const char **commit_refs = NULL;
+
+      if ((g_variant_lookup (commit_metadata, "xa.ref", "&s", &xa_ref) &&
+           g_strcmp0 (xa_ref, ref) != 0) ||
+          (g_variant_lookup (commit_metadata, OSTREE_COMMIT_META_KEY_REF_BINDING, "^a&s", &commit_refs) &&
+           !g_strv_contains ((const char *const *) commit_refs, ref)))
+        {
+          flatpak_fail (error, "commit has no requested ref ‘%s’ in ref binding metadata",  ref);
+          return NULL;
+        }
+    }
+
+  if (out_commit)
+    *out_commit = g_strdup (opt_commit);
+
+  return g_steal_pointer (&commit_variant);
+}
+
+
+gboolean
+flatpak_dir_fetch_ref_cache (FlatpakDir   *self,
+                             const char   *remote_name,
+                             const char   *ref,
+                             guint64      *download_size,
+                             guint64      *installed_size,
+                             char        **metadata,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(GVariant) cache_v = NULL;
+  g_autoptr(GVariant) cache = NULL;
+  g_autoptr(GVariant) res = NULL;
+  g_autoptr(GVariant) refdata = NULL;
+  int pos;
+  g_autoptr(GError) local_error = NULL;
+
+  if (!flatpak_dir_lookup_repo_metadata (self, remote_name, cancellable, &local_error,
+                                         "xa.cache", "@*", &cache_v))
+    {
+      if (local_error == NULL)
+        g_set_error_literal (&local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                             _("No flatpak cache in remote summary"));
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }
+
+  cache = g_variant_get_child_value (cache_v, 0);
+
+  if (!flatpak_variant_bsearch_str (cache, ref, &pos))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   _("No entry for %s in remote summary flatpak cache "), ref);
+      return FALSE;
+    }
+
+  refdata = g_variant_get_child_value (cache, pos);
+  res = g_variant_get_child_value (refdata, 1);
+
+  if (installed_size)
+    {
+      guint64 v;
+      g_variant_get_child (res, 0, "t", &v);
+      *installed_size = GUINT64_FROM_BE (v);
+    }
+
+  if (download_size)
+    {
+      guint64 v;
+      g_variant_get_child (res, 1, "t", &v);
+      *download_size = GUINT64_FROM_BE (v);
+    }
+
+  if (metadata)
+    g_variant_get_child (res, 2, "s", metadata);
+
+  return TRUE;
+}
+
+void
+flatpak_related_free (FlatpakRelated *self)
+{
+  g_free (self->collection_id);
+  g_free (self->ref);
+  g_free (self->commit);
+  g_strfreev (self->subpaths);
+  g_free (self);
+}
+
+static void
+add_related (FlatpakDir *self,
+             GPtrArray *related,
+             const char *extension,
+             const char *extension_collection_id,
+             const char *extension_ref,
+             const char *checksum,
+             gboolean no_autodownload,
+             const char *download_if,
+             gboolean autodelete,
+             gboolean locale_subset)
+{
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autofree const char **old_subpaths = NULL;
+  g_auto(GStrv) extra_subpaths = NULL;
+  g_auto(GStrv) subpaths = NULL;
+  FlatpakRelated *rel;
+  gboolean download;
+  gboolean delete = autodelete;
+  g_auto(GStrv) ref_parts = g_strsplit (extension_ref, "/", -1);
+  g_autoptr(GFile) unmaintained_path = NULL;
+
+  deploy_data = flatpak_dir_get_deploy_data (self, extension_ref, NULL, NULL);
+
+  if (deploy_data)
+    old_subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+
+  /* Only respect no-autodownload/download-if for uninstalled refs, we
+     always want to update if you manually installed something */
+  download =
+    flatpak_extension_matches_reason (ref_parts[1], download_if, !no_autodownload) ||
+    deploy_data != NULL;
+
+  /* Don't download if there is an unmaintained extension already installed */
+  unmaintained_path =
+    flatpak_find_unmaintained_extension_dir_if_exists (ref_parts[1],
+                                                       ref_parts[2],
+                                                       ref_parts[3], NULL);
+  if (unmaintained_path != NULL && deploy_data == NULL)
+    {
+      g_debug ("Skipping related extension ‘%s’ because it is already "
+               "installed as an unmaintained extension in ‘%s’.",
+               ref_parts[1], g_file_get_path (unmaintained_path));
+      download = FALSE;
+    }
+
+  if (g_str_has_suffix (extension, ".Debug"))
+    {
+      /* debug files only updated if already installed */
+      if (deploy_data == NULL)
+        download = FALSE;
+
+      /* Always remove debug */
+      delete = TRUE;
+    }
+
+  if (g_str_has_suffix (extension, ".Locale"))
+    locale_subset = TRUE;
+
+  if (locale_subset)
+    {
+      extra_subpaths = flatpak_dir_get_locale_subpaths (self);
+
+      /* Always remove locale */
+      delete = TRUE;
+    }
+
+  subpaths = flatpak_subpaths_merge ((char **)old_subpaths, extra_subpaths);
+
+  rel = g_new0 (FlatpakRelated, 1);
+  rel->collection_id = g_strdup (extension_collection_id);
+  rel->ref = g_strdup (extension_ref);
+  rel->commit = g_strdup (checksum);
+  rel->subpaths = g_steal_pointer (&subpaths);
+  rel->download = download;
+  rel->delete = delete;
+
+  g_ptr_array_add (related, rel);
+}
+
+GPtrArray *
+flatpak_dir_find_remote_related (FlatpakDir *self,
+                                 const char *ref,
+                                 const char *remote_name,
+                                 GCancellable *cancellable,
+                                 GError **error)
+{
+  g_autoptr(GVariant) summary = NULL;
+  g_autofree char *metadata = NULL;
+  g_autoptr(GKeyFile) metakey = g_key_file_new ();
+  int i;
+  g_auto(GStrv) parts = NULL;
+  g_autoptr(GPtrArray) related = g_ptr_array_new_with_free_func ((GDestroyNotify)flatpak_related_free);
+  g_autofree char *url = NULL;
+  g_autofree char *collection_id = NULL;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return NULL;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return NULL;
+
+  if (!ostree_repo_remote_get_url (self->repo,
+                                   remote_name,
+                                   &url,
+                                   error))
+    return FALSE;
+
+  if (*url == 0)
+    return g_steal_pointer (&related);  /* Empty url, silently disables updates */
+
+  /* Derive the collection ID from the remote we are querying. This will act as
+   * a sanity check on the summary ref lookup. */
+  if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+    return NULL;
+
+  summary = fetch_remote_summary_file (self, remote_name, NULL, cancellable, error);
+  if (summary == NULL)
+    return NULL;
+
+  if (flatpak_dir_fetch_ref_cache (self, remote_name, ref,
+                                   NULL, NULL, &metadata,
+                                   NULL, NULL) &&
+      g_key_file_load_from_data (metakey, metadata, -1, 0, NULL))
+    {
+      g_auto(GStrv) groups = NULL;
+
+      groups = g_key_file_get_groups (metakey, NULL);
+      for (i = 0; groups[i] != NULL; i++)
+        {
+          char *extension;
+
+          if (g_str_has_prefix (groups[i], FLATPAK_METADATA_GROUP_PREFIX_EXTENSION) &&
+              *(extension = (groups[i] + strlen (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION))) != 0)
+            {
+              g_autofree char *version = g_key_file_get_string (metakey, groups[i],
+                                                                FLATPAK_METADATA_KEY_VERSION, NULL);
+              gboolean subdirectories = g_key_file_get_boolean (metakey, groups[i],
+                                                                FLATPAK_METADATA_KEY_SUBDIRECTORIES, NULL);
+              gboolean no_autodownload = g_key_file_get_boolean (metakey, groups[i],
+                                                                 FLATPAK_METADATA_KEY_NO_AUTODOWNLOAD, NULL);
+              g_autofree char *download_if = g_key_file_get_string (metakey, groups[i],
+                                                                    FLATPAK_METADATA_KEY_DOWNLOAD_IF, NULL);
+              gboolean autodelete = g_key_file_get_boolean (metakey, groups[i],
+                                                            FLATPAK_METADATA_KEY_AUTODELETE, NULL);
+              gboolean locale_subset = g_key_file_get_boolean (metakey, groups[i],
+                                                               FLATPAK_METADATA_KEY_LOCALE_SUBSET, NULL);
+              g_autofree char *extension_collection_id = NULL;
+              const char *branch;
+              g_autofree char *extension_ref = NULL;
+              g_autofree char *checksum = NULL;
+
+              if (version)
+                branch = version;
+              else
+                branch = parts[3];
+
+#ifdef FLATPAK_ENABLE_P2P
+              extension_collection_id = g_key_file_get_string (metakey, groups[i],
+                                                               FLATPAK_METADATA_KEY_COLLECTION_ID, NULL);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+              /* For the moment, none of the related ref machinery handles
+               * collection IDs which don’t match the original ref. */
+              if (extension_collection_id != NULL && *extension_collection_id != '\0' &&
+                  g_strcmp0 (extension_collection_id, collection_id) != 0)
+                {
+                  g_debug ("Skipping related extension ‘%s’ because it’s in collection "
+                           "‘%s’ which does not match the current remote ‘%s’.",
+                           extension, extension_collection_id, collection_id);
+                  continue;
+                }
+
+              g_clear_pointer (&extension_collection_id, g_free);
+              extension_collection_id = g_strdup (collection_id);
+
+              extension_ref = g_build_filename ("runtime", extension, parts[2], branch, NULL);
+
+              if (flatpak_summary_lookup_ref (summary, extension_collection_id, extension_ref, &checksum, NULL))
+                {
+                  add_related (self, related, extension, extension_collection_id, extension_ref, checksum, no_autodownload, download_if, autodelete, locale_subset);
+                }
+              else if (subdirectories)
+                {
+                  g_auto(GStrv) refs = flatpak_summary_match_subrefs (summary, extension_collection_id, extension_ref);
+                  int j;
+                  for (j = 0; refs[j] != NULL; j++)
+                    {
+                      if (flatpak_summary_lookup_ref (summary, extension_collection_id, refs[j], &checksum, NULL))
+                        add_related (self, related, extension, extension_collection_id, refs[j], checksum, no_autodownload, download_if, autodelete, locale_subset);
+                    }
+                }
+            }
+        }
+    }
+
+  return g_steal_pointer (&related);
+}
+
+static GPtrArray *
+local_match_prefix (FlatpakDir *self,
+                    const char *extension_ref,
+                    const char *remote)
+{
+  GPtrArray *matches = g_ptr_array_new_with_free_func (g_free);
+  g_auto(GStrv) parts = NULL;
+  g_autofree char *parts_prefix = NULL;
+  g_autoptr(GHashTable) refs = NULL;
+  g_autofree char *list_prefix = NULL;
+
+  parts = g_strsplit (extension_ref, "/", -1);
+  parts_prefix = g_strconcat (parts[1], ".", NULL);
+
+  list_prefix = g_strdup_printf ("%s:%s", remote, parts[0]);
+  if (ostree_repo_list_refs (self->repo, list_prefix, &refs, NULL, NULL))
+    {
+      GHashTableIter hash_iter;
+      gpointer key;
+
+      g_hash_table_iter_init (&hash_iter, refs);
+      while (g_hash_table_iter_next (&hash_iter, &key, NULL))
+        {
+          char *ref = key;
+          g_auto(GStrv) cur_parts = g_strsplit (ref, "/", -1);
+
+          /* Must match type, arch, branch */
+          if (strcmp (parts[0], cur_parts[0]) != 0 ||
+              strcmp (parts[2], cur_parts[2]) != 0 ||
+              strcmp (parts[3], cur_parts[3]) != 0)
+            continue;
+
+          /* But only prefix of id */
+          if (!g_str_has_prefix (cur_parts[1], parts_prefix))
+            continue;
+
+          g_ptr_array_add (matches, g_strdup (ref));
+        }
+    }
+
+  return matches;
+}
+
+GPtrArray *
+flatpak_dir_find_local_related (FlatpakDir *self,
+                                const char *ref,
+                                const char *remote_name,
+                                GCancellable *cancellable,
+                                GError **error)
+{
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_autofree char *metadata_contents = NULL;
+  gsize metadata_size;
+  g_autoptr(GKeyFile) metakey = g_key_file_new ();
+  int i;
+  g_auto(GStrv) parts = NULL;
+  g_autoptr(GPtrArray) related = g_ptr_array_new_with_free_func ((GDestroyNotify)flatpak_related_free);
+  g_autofree char *collection_id = NULL;
+
+  /* Derive the collection ID from the remote we are querying. This will act as
+   * a sanity check on the summary ref lookup. */
+  if (!repo_get_remote_collection_id (self->repo, remote_name, &collection_id, error))
+    return NULL;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return NULL;
+
+  if (!flatpak_dir_ensure_repo (self, cancellable, error))
+    return NULL;
+
+  deploy_dir = flatpak_dir_get_if_deployed (self, ref, NULL, cancellable);
+  if (deploy_dir == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   _("%s not installed"), ref);
+      return NULL;
+    }
+
+  metadata = g_file_get_child (deploy_dir, "metadata");
+  if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, NULL))
+    return g_steal_pointer (&related); /* No metadata => no related, but no error */
+
+  if (g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, NULL))
+    {
+      g_auto(GStrv) groups = NULL;
+
+      groups = g_key_file_get_groups (metakey, NULL);
+      for (i = 0; groups[i] != NULL; i++)
+        {
+          char *extension;
+
+          if (g_str_has_prefix (groups[i], FLATPAK_METADATA_GROUP_PREFIX_EXTENSION) &&
+              *(extension = (groups[i] + strlen (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION))) != 0)
+            {
+              g_autofree char *version = g_key_file_get_string (metakey, groups[i],
+                                                                FLATPAK_METADATA_KEY_VERSION, NULL);
+              gboolean subdirectories = g_key_file_get_boolean (metakey, groups[i],
+                                                                FLATPAK_METADATA_KEY_SUBDIRECTORIES, NULL);
+              gboolean no_autodownload = g_key_file_get_boolean (metakey, groups[i],
+                                                                 FLATPAK_METADATA_KEY_NO_AUTODOWNLOAD, NULL);
+              g_autofree char *download_if = g_key_file_get_string (metakey, groups[i],
+                                                                    FLATPAK_METADATA_KEY_DOWNLOAD_IF, NULL);
+              gboolean autodelete = g_key_file_get_boolean (metakey, groups[i],
+                                                            FLATPAK_METADATA_KEY_AUTODELETE, NULL);
+              gboolean locale_subset = g_key_file_get_boolean (metakey, groups[i],
+                                                               FLATPAK_METADATA_KEY_LOCALE_SUBSET, NULL);
+              const char *branch;
+              g_autofree char *extension_ref = NULL;
+              g_autofree char *prefixed_extension_ref = NULL;
+              g_autofree char *checksum = NULL;
+              g_autofree char *extension_collection_id = NULL;
+
+              if (version)
+                branch = version;
+              else
+                branch = parts[3];
+
+#ifdef FLATPAK_ENABLE_P2P
+              extension_collection_id = g_key_file_get_string (metakey, groups[i],
+                                                               FLATPAK_METADATA_KEY_COLLECTION_ID, NULL);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+              /* As we’re looking locally, we can’t support extension
+               * collection IDs which don’t match the current remote (since the
+               * associated refs could be anywhere). */
+              if (extension_collection_id != NULL && *extension_collection_id != '\0' &&
+                  g_strcmp0 (extension_collection_id, collection_id) != 0)
+                {
+                  g_debug ("Skipping related extension ‘%s’ because it’s in collection "
+                           "‘%s’ which does not match the current remote ‘%s’.",
+                           extension, extension_collection_id, collection_id);
+                  continue;
+                }
+
+              g_clear_pointer (&extension_collection_id, g_free);
+              extension_collection_id = g_strdup (collection_id);
+
+              extension_ref = g_build_filename ("runtime", extension, parts[2], branch, NULL);
+              prefixed_extension_ref = g_strdup_printf ("%s:%s", remote_name, extension_ref);
+              if (ostree_repo_resolve_rev (self->repo,
+                                           prefixed_extension_ref,
+                                           FALSE,
+                                           &checksum,
+                                           NULL))
+                {
+                  add_related (self, related, extension, extension_collection_id, extension_ref,
+                               checksum, no_autodownload, download_if, autodelete, locale_subset);
+                }
+              else if (subdirectories)
+                {
+                  g_autoptr(GPtrArray) matches = local_match_prefix (self, extension_ref, remote_name);
+                  int j;
+                  for (j = 0; j < matches->len; j++)
+                    {
+                      const char *match = g_ptr_array_index (matches, j);
+                      g_autofree char *prefixed_match = NULL;
+                      g_autofree char *match_checksum = NULL;
+
+                      prefixed_match = g_strdup_printf ("%s:%s", remote_name, match);
+
+                      if (ostree_repo_resolve_rev (self->repo,
+                                                   prefixed_match,
+                                                   FALSE,
+                                                   &match_checksum,
+                                                   NULL))
+                        {
+                          add_related (self, related, extension,
+                                       extension_collection_id, match, match_checksum,
+                                       no_autodownload, download_if, autodelete, locale_subset);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+  return g_steal_pointer (&related);
+}
+
+static GDBusProxy *
+get_accounts_dbus_proxy (void)
+{
+  g_autoptr(GDBusConnection) conn = NULL;
+
+  const char *accounts_bus_name = "org.freedesktop.Accounts";
+  const char *accounts_object_path = "/org/freedesktop/Accounts";
+  const char *accounts_interface_name = accounts_bus_name;
+
+  conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+  return g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+                                        G_DBUS_PROXY_FLAGS_NONE,
+                                        NULL,
+                                        accounts_bus_name,
+                                        accounts_object_path,
+                                        accounts_interface_name,
+                                        NULL,
+                                        NULL);
+}
+
+static char **
+get_locale_langs_from_accounts_dbus (GDBusProxy *proxy)
+{
+  const char *accounts_bus_name = "org.freedesktop.Accounts";
+  const char *accounts_interface_name = "org.freedesktop.Accounts.User";
+  char **object_paths = NULL;
+  g_autoptr(GPtrArray) langs = g_ptr_array_new ();
+  int i;
+  g_autoptr(GVariant) ret = NULL;
+
+  ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
+                                "ListCachedUsers",
+                                g_variant_new ("()"),
+                                G_DBUS_CALL_FLAGS_NONE,
+                                -1,
+                                NULL,
+                                NULL);
+  if (ret != NULL)
+    g_variant_get (ret,
+                   "(^ao)",
+                   &object_paths);
+
+  if (object_paths != NULL)
+    {
+      for (i = 0; object_paths[i] != NULL; i++)
+        {
+          g_autoptr(GDBusProxy) accounts_proxy = NULL;
+          g_autoptr(GVariant) value = NULL;
+
+          accounts_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+                                                          G_DBUS_PROXY_FLAGS_NONE,
+                                                          NULL,
+                                                          accounts_bus_name,
+                                                          object_paths[i],
+                                                          accounts_interface_name,
+                                                          NULL,
+                                                          NULL);
+
+          if (accounts_proxy)
+            {
+              value = g_dbus_proxy_get_cached_property (accounts_proxy, "Language");
+              if (value != NULL)
+                {
+                  const char *locale = g_variant_get_string (value, NULL);
+                  g_autofree char *lang = NULL;
+
+                  if (strcmp (locale, "") == 0)
+                    return NULL; /* At least one user with no defined language, fall back to all languages */
+
+                  lang = flatpak_get_lang_from_locale (locale);
+                  if (lang != NULL && !flatpak_g_ptr_array_contains_string (langs, lang))
+                    g_ptr_array_add (langs, g_steal_pointer (&lang));
+                }
+            }
+        }
+  }
+
+  if (langs->len == 0)
+    return NULL; /* No defined languages, fall back to all languages */
+
+  g_ptr_array_sort (langs, flatpak_strcmp0_ptr);
+  g_ptr_array_add (langs, NULL);
+
+  return (char **)g_ptr_array_free (g_steal_pointer (&langs), FALSE);
+}
+
+static int
+cmpstringp (const void *p1, const void *p2)
+{
+  return strcmp (*(char * const *) p1, *(char * const *) p2);
+}
+
+static char **
+sort_strv (char **strv)
+{
+  qsort (strv, g_strv_length (strv), sizeof (const char *), cmpstringp);
+  return strv;
+}
+
+char **
+flatpak_dir_get_default_locale_languages (FlatpakDir *self)
+{
+  char **langs = NULL;
+
+  if (flatpak_dir_is_user (self))
+    return flatpak_get_current_locale_langs ();
+
+  /* If proxy is not NULL, it means that AccountService exists
+   * and gets the list of languages from AccountService. */
+  g_autoptr(GDBusProxy) proxy = get_accounts_dbus_proxy ();
+  if (proxy != NULL)
+    langs = get_locale_langs_from_accounts_dbus (proxy);
+
+  /* Iif langs is NULL, it means using all languages */
+  if (langs == NULL)
+    langs = g_new0 (char *, 1);
+
+  return langs;
+}
+
+char **
+flatpak_dir_get_locale_languages (FlatpakDir *self)
+{
+  GKeyFile *config = ostree_repo_get_config (self->repo);
+
+  if (config)
+    {
+      char **langs = g_key_file_get_string_list (config, "core", "xa.languages", NULL, NULL);
+      if (langs)
+        return sort_strv (langs);
+    }
+
+  return flatpak_dir_get_default_locale_languages (self);
+}
+
+char **
+flatpak_dir_get_locale_subpaths (FlatpakDir *self)
+{
+  char **subpaths = flatpak_dir_get_locale_languages (self);
+  int i;
+
+  /* Convert languages to paths */
+  for (i = 0; subpaths[i] != NULL; i++)
+    {
+      char *lang = subpaths[i];
+      /* For backwards compat with old xa.languages we support the configuration having slashes already */
+      if (*lang != '/')
+        {
+          subpaths[i] = g_strconcat ("/", lang, NULL);
+          g_free (lang);
+        }
+    }
+  return subpaths;
+}
diff --git a/common/flatpak-dir.h b/common/flatpak-dir.h
new file mode 100644 (file)
index 0000000..a029f93
--- /dev/null
@@ -0,0 +1,684 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_DIR_H__
+#define __FLATPAK_DIR_H__
+
+#include <ostree.h>
+
+#include "libglnx/libglnx.h"
+#include <flatpak-common-types.h>
+
+#define FLATPAK_TYPE_DIR flatpak_dir_get_type ()
+#define FLATPAK_DIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DIR, FlatpakDir))
+#define FLATPAK_IS_DIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DIR))
+
+#define FLATPAK_TYPE_DEPLOY flatpak_deploy_get_type ()
+#define FLATPAK_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DEPLOY, FlatpakDeploy))
+#define FLATPAK_IS_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DEPLOY))
+
+GType flatpak_dir_get_type (void);
+GType flatpak_deploy_get_type (void);
+
+#define FLATPAK_REF_GROUP "Flatpak Ref"
+#define FLATPAK_REF_VERSION_KEY "Version"
+#define FLATPAK_REF_URL_KEY "Url"
+#define FLATPAK_REF_RUNTIME_REPO_KEY "RuntimeRepo"
+#define FLATPAK_REF_SUGGEST_REMOTE_NAME_KEY "SuggestRemoteName"
+#define FLATPAK_REF_TITLE_KEY "Title"
+#define FLATPAK_REF_GPGKEY_KEY "GPGKey"
+#define FLATPAK_REF_IS_RUNTIME_KEY "IsRuntime"
+#define FLATPAK_REF_NAME_KEY "Name"
+#define FLATPAK_REF_BRANCH_KEY "Branch"
+
+#ifdef FLATPAK_ENABLE_P2P
+#define FLATPAK_REF_COLLECTION_ID_KEY "CollectionID"
+#endif  /* FLATPAK_ENABLE_P2P */
+
+#define FLATPAK_REPO_GROUP "Flatpak Repo"
+#define FLATPAK_REPO_VERSION_KEY "Version"
+#define FLATPAK_REPO_URL_KEY "Url"
+#define FLATPAK_REPO_TITLE_KEY "Title"
+#define FLATPAK_REPO_DEFAULT_BRANCH_KEY "DefaultBranch"
+#define FLATPAK_REPO_GPGKEY_KEY "GPGKey"
+#define FLATPAK_REPO_NODEPS_KEY "NoDeps"
+
+#ifdef FLATPAK_ENABLE_P2P
+#define FLATPAK_REPO_COLLECTION_ID_KEY "CollectionID"
+#endif  /* FLATPAK_ENABLE_P2P */
+
+#define FLATPAK_DEFAULT_UPDATE_FREQUENCY 100
+#define FLATPAK_CLI_UPDATE_FREQUENCY 300
+
+typedef struct
+{
+  char           *collection_id;  /* (nullable) */
+  char           *ref;
+  char           *commit;
+  char          **subpaths;
+  gboolean        download;
+  gboolean        delete;
+} FlatpakRelated;
+
+void         flatpak_related_free (FlatpakRelated *related);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDir, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDeploy, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRelated, flatpak_related_free)
+
+typedef enum {
+  FLATPAK_HELPER_DEPLOY_FLAGS_NONE = 0,
+  FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE = 1 << 0,
+  FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY = 1 << 1,
+  FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL = 1 << 2,
+  FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL = 1 << 3,
+} FlatpakHelperDeployFlags;
+
+#define FLATPAK_HELPER_DEPLOY_FLAGS_ALL (FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE|FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY|FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL|FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL)
+
+typedef enum {
+  FLATPAK_HELPER_UNINSTALL_FLAGS_NONE = 0,
+  FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF = 1 << 0,
+  FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE = 1 << 1,
+} FlatpakHelperUninstallFlags;
+
+#define FLATPAK_HELPER_UNINSTALL_FLAGS_ALL (FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF | FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE)
+
+typedef enum {
+  FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_NONE = 0,
+  FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE = 1 << 0,
+} FlatpakHelperConfigureRemoteFlags;
+
+#define FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE)
+
+typedef enum {
+  FLATPAK_HELPER_CONFIGURE_FLAGS_NONE = 0,
+  FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET = 1 << 0,
+} FlatpakHelperConfigureFlags;
+
+#define FLATPAK_HELPER_CONFIGURE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET)
+
+typedef enum {
+  FLATPAK_HELPER_UPDATE_REMOTE_FLAGS_NONE = 0,
+} FlatpakHelperUpdateRemoteFlags;
+
+#define FLATPAK_HELPER_UPDATE_REMOTE_FLAGS_ALL (0)
+
+typedef enum {
+  FLATPAK_PULL_FLAGS_NONE = 0,
+  FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA = 1 << 0,
+  FLATPAK_PULL_FLAGS_SIDELOAD_EXTRA_DATA = 1 << 1,
+  FLATPAK_PULL_FLAGS_ALLOW_DOWNGRADE = 1 << 2,
+  FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS = 1 << 3,
+} FlatpakPullFlags;
+
+typedef enum {
+  FLATPAK_DIR_STORAGE_TYPE_DEFAULT = 0,
+  FLATPAK_DIR_STORAGE_TYPE_HARD_DISK,
+  FLATPAK_DIR_STORAGE_TYPE_SDCARD,
+  FLATPAK_DIR_STORAGE_TYPE_MMC,
+} FlatpakDirStorageType;
+
+GQuark       flatpak_dir_error_quark (void);
+
+#ifndef FLATPAK_ENABLE_P2P
+/* Rather than putting #ifdefs around all the function arguments for result sets,
+ * define away OstreeRepoFinderResult if we’re compiling without P2P support.
+ * The surrounding code should always pass in NULL if P2P support is disabled. */
+typedef void OstreeRepoFinderResult;
+typedef void** OstreeRepoFinderResultv;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, void)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, void, NULL)
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+/**
+ * FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT:
+ *
+ * s - origin
+ * s - commit
+ * as - subpaths
+ * t - installed size
+ * a{sv} - Metadata
+ */
+#define FLATPAK_DEPLOY_DATA_GVARIANT_STRING "(ssasta{sv})"
+#define FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT G_VARIANT_TYPE (FLATPAK_DEPLOY_DATA_GVARIANT_STRING)
+
+GPtrArray * flatpak_get_system_base_dir_locations (GCancellable *cancellable,
+                                                   GError      **error);
+GFile *     flatpak_get_system_default_base_dir_location (void);
+GFile *     flatpak_get_user_base_dir_location (void);
+
+GKeyFile *     flatpak_load_override_keyfile (const char *app_id,
+                                              gboolean    user,
+                                              GError    **error);
+FlatpakContext *flatpak_load_override_file (const char *app_id,
+                                            gboolean    user,
+                                            GError    **error);
+gboolean       flatpak_save_override_keyfile (GKeyFile   *metakey,
+                                              const char *app_id,
+                                              gboolean    user,
+                                              GError    **error);
+
+const char *        flatpak_deploy_data_get_origin (GVariant *deploy_data);
+const char *        flatpak_deploy_data_get_commit (GVariant *deploy_data);
+const char **       flatpak_deploy_data_get_subpaths (GVariant *deploy_data);
+guint64             flatpak_deploy_data_get_installed_size (GVariant *deploy_data);
+const char *        flatpak_deploy_data_get_alt_id (GVariant *deploy_data);
+
+GFile *        flatpak_deploy_get_dir (FlatpakDeploy *deploy);
+GVariant *     flatpak_load_deploy_data (GFile *deploy_dir,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+GVariant *     flatpak_deploy_get_deploy_data (FlatpakDeploy *deploy,
+                                               GCancellable *cancellable,
+                                               GError      **error);
+GFile *        flatpak_deploy_get_files (FlatpakDeploy *deploy);
+FlatpakContext *flatpak_deploy_get_overrides (FlatpakDeploy *deploy);
+GKeyFile *     flatpak_deploy_get_metadata (FlatpakDeploy *deploy);
+
+FlatpakDir *  flatpak_dir_new (GFile   *basedir,
+                               gboolean user);
+FlatpakDir *  flatpak_dir_clone (FlatpakDir *self);
+FlatpakDir  *flatpak_dir_get_user (void);
+FlatpakDir  *flatpak_dir_get_system_default (void);
+GPtrArray   *flatpak_dir_get_system_list (GCancellable *cancellable,
+                                          GError      **error);
+FlatpakDir  *flatpak_dir_get_system_by_id (const char   *id,
+                                           GCancellable *cancellable,
+                                           GError      **error);
+gboolean    flatpak_dir_is_user (FlatpakDir *self);
+void        flatpak_dir_set_no_system_helper (FlatpakDir *self,
+                                              gboolean    no_system_helper);
+GFile *     flatpak_dir_get_path (FlatpakDir *self);
+GFile *     flatpak_dir_get_changed_path (FlatpakDir *self);
+const char *flatpak_dir_get_id (FlatpakDir *self);
+const char *flatpak_dir_get_display_name (FlatpakDir *self);
+char *      flatpak_dir_get_name (FlatpakDir *self);
+gint        flatpak_dir_get_priority (FlatpakDir *self);
+FlatpakDirStorageType flatpak_dir_get_storage_type (FlatpakDir *self);
+GFile *     flatpak_dir_get_deploy_dir (FlatpakDir *self,
+                                        const char *ref);
+char *      flatpak_dir_get_deploy_subdir (FlatpakDir *self,
+                                           const char *checksum,
+                                           const char * const * subpaths);
+GFile *     flatpak_dir_get_unmaintained_extension_dir (FlatpakDir *self,
+                                                        const char *name,
+                                                        const char *arch,
+                                                        const char *branch);
+GVariant *  flatpak_dir_get_deploy_data (FlatpakDir   *dir,
+                                         const char   *ref,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+char *      flatpak_dir_get_origin (FlatpakDir   *self,
+                                    const char   *ref,
+                                    GCancellable *cancellable,
+                                    GError      **error);
+char **     flatpak_dir_get_subpaths (FlatpakDir   *self,
+                                      const char   *ref,
+                                      GCancellable *cancellable,
+                                      GError      **error);
+GFile *     flatpak_dir_get_exports_dir (FlatpakDir *self);
+GFile *     flatpak_dir_get_removed_dir (FlatpakDir *self);
+GFile *     flatpak_dir_get_if_deployed (FlatpakDir   *self,
+                                         const char   *ref,
+                                         const char   *checksum,
+                                         GCancellable *cancellable);
+GFile *     flatpak_dir_get_unmaintained_extension_dir_if_exists (FlatpakDir *self,
+                                                                  const char *name,
+                                                                  const char *arch,
+                                                                  const char *branch,
+                                                                  GCancellable *cancellable);
+
+gboolean    flatpak_dir_remote_has_ref (FlatpakDir   *self,
+                                        const char   *remote,
+                                        const char   *ref);
+char **     flatpak_dir_search_for_dependency (FlatpakDir   *self,
+                                               const char   *runtime_ref,
+                                               GCancellable *cancellable,
+                                               GError      **error);
+char *      flatpak_dir_find_remote_ref (FlatpakDir   *self,
+                                         const char   *remote,
+                                         const char   *name,
+                                         const char   *opt_branch,
+                                         const char   *opt_default_branch,
+                                         const char   *opt_arch,
+                                         FlatpakKinds  kinds,
+                                         FlatpakKinds *out_kind,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+char **     flatpak_dir_find_remote_refs (FlatpakDir   *self,
+                                          const char   *remote,
+                                          const char   *name,
+                                          const char   *opt_branch,
+                                          const char   *opt_arch,
+                                          FlatpakKinds  kinds,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+char *      flatpak_dir_find_local_ref (FlatpakDir   *self,
+                                        const char   *remote,
+                                        const char   *name,
+                                        const char   *opt_branch,
+                                        const char   *opt_default_branch,
+                                        const char   *opt_arch,
+                                        FlatpakKinds  kinds,
+                                        FlatpakKinds *out_kind,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+char *      flatpak_dir_find_installed_ref (FlatpakDir  *self,
+                                            const char  *opt_name,
+                                            const char  *opt_branch,
+                                            const char  *opt_arch,
+                                            FlatpakKinds kinds,
+                                            FlatpakKinds *out_kind,
+                                            GError     **error);
+char **     flatpak_dir_find_installed_refs (FlatpakDir  *self,
+                                             const char  *opt_name,
+                                             const char  *opt_branch,
+                                             const char  *opt_arch,
+                                             FlatpakKinds kinds,
+                                             GError     **error);
+FlatpakDeploy *flatpak_dir_load_deployed (FlatpakDir   *self,
+                                          const char   *ref,
+                                          const char   *checksum,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+char *    flatpak_dir_load_override (FlatpakDir *dir,
+                                     const char *app_id,
+                                     gsize      *length,
+                                     GError    **error);
+OstreeRepo *flatpak_dir_get_repo (FlatpakDir *self);
+gboolean    flatpak_dir_ensure_path (FlatpakDir   *self,
+                                     GCancellable *cancellable,
+                                     GError      **error);
+gboolean    flatpak_dir_use_child_repo (FlatpakDir *self);
+gboolean    flatpak_dir_ensure_system_child_repo (FlatpakDir *self,
+                                                  GError    **error);
+gboolean    flatpak_dir_recreate_repo (FlatpakDir   *self,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+gboolean    flatpak_dir_ensure_repo (FlatpakDir   *self,
+                                     GCancellable *cancellable,
+                                     GError      **error);
+gboolean    flatpak_dir_maybe_ensure_repo (FlatpakDir   *self,
+                                           GCancellable *cancellable,
+                                           GError      **error);
+char *      flatpak_dir_get_config (FlatpakDir *self,
+                                   const char *key,
+                                   GError    **error);
+gboolean    flatpak_dir_set_config (FlatpakDir *self,
+                                    const char *key,
+                                    const char *value,
+                                    GError    **error);
+gboolean    flatpak_dir_mark_changed (FlatpakDir *self,
+                                      GError    **error);
+gboolean    flatpak_dir_remove_appstream (FlatpakDir   *self,
+                                          const char   *remote,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+gboolean    flatpak_dir_deploy_appstream (FlatpakDir          *self,
+                                          const char          *remote,
+                                          const char          *arch,
+                                          gboolean            *out_changed,
+                                          GCancellable        *cancellable,
+                                          GError             **error);
+gboolean    flatpak_dir_check_for_appstream_update (FlatpakDir          *self,
+                                                    const char          *remote,
+                                                    const char          *arch);
+gboolean    flatpak_dir_update_appstream (FlatpakDir          *self,
+                                          const char          *remote,
+                                          const char          *arch,
+                                          gboolean            *out_changed,
+                                          OstreeAsyncProgress *progress,
+                                          GCancellable        *cancellable,
+                                          GError             **error);
+gboolean    flatpak_dir_pull (FlatpakDir          *self,
+                              const char          *repository,
+                              const char          *ref,
+                              const char          *opt_rev,
+                              const OstreeRepoFinderResult * const *results,
+                              const char         **subpaths,
+                              OstreeRepo          *repo,
+                              FlatpakPullFlags     flatpak_flags,
+                              OstreeRepoPullFlags  flags,
+                              OstreeAsyncProgress *progress,
+                              GCancellable        *cancellable,
+                              GError             **error);
+gboolean    flatpak_dir_pull_untrusted_local (FlatpakDir          *self,
+                                              const char          *src_path,
+                                              const char          *remote_name,
+                                              const char          *ref,
+                                              const char        **subpaths,
+                                              OstreeAsyncProgress *progress,
+                                              GCancellable        *cancellable,
+                                              GError             **error);
+gboolean    flatpak_dir_list_refs_for_name (FlatpakDir   *self,
+                                            const char   *kind,
+                                            const char   *name,
+                                            char       ***refs,
+                                            GCancellable *cancellable,
+                                            GError      **error);
+gboolean    flatpak_dir_list_refs (FlatpakDir   *self,
+                                   const char   *kind,
+                                   char       ***refs,
+                                   GCancellable *cancellable,
+                                   GError      **error);
+char *      flatpak_dir_read_latest (FlatpakDir   *self,
+                                     const char   *remote,
+                                     const char   *ref,
+                                     char        **out_alt_id,
+                                     GCancellable *cancellable,
+                                     GError      **error);
+char *      flatpak_dir_read_active (FlatpakDir   *self,
+                                     const char   *ref,
+                                     GCancellable *cancellable);
+gboolean    flatpak_dir_set_active (FlatpakDir   *self,
+                                    const char   *ref,
+                                    const char   *checksum,
+                                    GCancellable *cancellable,
+                                    GError      **error);
+char *      flatpak_dir_current_ref (FlatpakDir   *self,
+                                     const char   *name,
+                                     GCancellable *cancellable);
+gboolean    flatpak_dir_drop_current_ref (FlatpakDir   *self,
+                                          const char   *name,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+gboolean    flatpak_dir_make_current_ref (FlatpakDir   *self,
+                                          const char   *ref,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+gboolean    flatpak_dir_list_deployed (FlatpakDir   *self,
+                                       const char   *ref,
+                                       char       ***deployed_checksums,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+gboolean    flatpak_dir_lock (FlatpakDir   *self,
+                              GLnxLockFile *lockfile,
+                              GCancellable *cancellable,
+                              GError      **error);
+gboolean    flatpak_dir_repo_lock (FlatpakDir   *self,
+                                   GLnxLockFile *lockfile,
+                                   gboolean      exclusive,
+                                   GCancellable *cancellable,
+                                   GError      **error);
+gboolean    flatpak_dir_deploy (FlatpakDir          *self,
+                                const char          *origin,
+                                const char          *ref,
+                                const char          *checksum_or_latest,
+                                const char * const * subpaths,
+                                GVariant            *old_deploy_data,
+                                GCancellable        *cancellable,
+                                GError             **error);
+gboolean    flatpak_dir_deploy_update (FlatpakDir   *self,
+                                       const char   *ref,
+                                       const char   *checksum,
+                                       const char **opt_subpaths,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+gboolean   flatpak_dir_deploy_install (FlatpakDir   *self,
+                                       const char   *ref,
+                                       const char   *origin,
+                                       const char  **subpaths,
+                                       gboolean      reinstall,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+gboolean   flatpak_dir_install (FlatpakDir          *self,
+                                gboolean             no_pull,
+                                gboolean             no_deploy,
+                                gboolean             no_static_deltas,
+                                gboolean             reinstall,
+                                const char          *ref,
+                                const char          *remote_name,
+                                const char         **subpaths,
+                                OstreeAsyncProgress *progress,
+                                GCancellable        *cancellable,
+                                GError             **error);
+char *flatpak_dir_ensure_bundle_remote (FlatpakDir          *self,
+                                        GFile               *file,
+                                        GBytes              *extra_gpg_data,
+                                        char               **out_ref,
+                                        char               **out_metadata,
+                                        gboolean            *out_created_remote,
+                                        GCancellable        *cancellable,
+                                        GError             **error);
+gboolean flatpak_dir_install_bundle (FlatpakDir          *self,
+                                     GFile               *file,
+                                     const char          *remote,
+                                     char               **out_ref,
+                                     GCancellable        *cancellable,
+                                     GError             **error);
+char * flatpak_dir_check_for_update (FlatpakDir          *self,
+                                     const char          *ref,
+                                     const char          *remote_name,
+                                     const char          *checksum_or_latest,
+                                     const char         **opt_subpaths,
+                                     gboolean             no_pull,
+                                     OstreeRepoFinderResult ***out_results,
+                                     GCancellable        *cancellable,
+                                     GError             **error);
+gboolean   flatpak_dir_update (FlatpakDir          *self,
+                               gboolean             no_pull,
+                               gboolean             no_deploy,
+                               gboolean             no_static_deltas,
+                               gboolean             allow_downgrade,
+                               const char          *ref,
+                               const char          *remote_name,
+                               const char          *checksum_or_latest,
+                               const OstreeRepoFinderResult * const *results,
+                               const char         **opt_subpaths,
+                               OstreeAsyncProgress *progress,
+                               GCancellable        *cancellable,
+                               GError             **error);
+gboolean flatpak_dir_uninstall (FlatpakDir          *self,
+                                const char          *ref,
+                                FlatpakHelperUninstallFlags flags,
+                                GCancellable        *cancellable,
+                                GError             **error);
+gboolean    flatpak_dir_undeploy (FlatpakDir   *self,
+                                  const char   *ref,
+                                  const char   *checksum,
+                                  gboolean      is_update,
+                                  gboolean      force_remove,
+                                  GCancellable *cancellable,
+                                  GError      **error);
+gboolean    flatpak_dir_undeploy_all (FlatpakDir   *self,
+                                      const char   *ref,
+                                      gboolean      force_remove,
+                                      gboolean     *was_deployed_out,
+                                      GCancellable *cancellable,
+                                      GError      **error);
+gboolean    flatpak_dir_remove_ref (FlatpakDir   *self,
+                                    const char   *remote_name,
+                                    const char   *ref,
+                                    GCancellable *cancellable,
+                                    GError      **error);
+gboolean    flatpak_dir_update_exports (FlatpakDir   *self,
+                                        const char   *app,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+gboolean    flatpak_dir_prune (FlatpakDir   *self,
+                               GCancellable *cancellable,
+                               GError      **error);
+gboolean    flatpak_dir_cleanup_removed (FlatpakDir   *self,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+gboolean    flatpak_dir_cleanup_undeployed_refs (FlatpakDir   *self,
+                                                 GCancellable *cancellable,
+                                                 GError      **error);
+gboolean    flatpak_dir_collect_deployed_refs (FlatpakDir   *self,
+                                               const char   *type,
+                                               const char   *name_prefix,
+                                               const char   *branch,
+                                               const char   *arch,
+                                               GHashTable   *hash,
+                                               GCancellable *cancellable,
+                                               GError      **error);
+gboolean    flatpak_dir_collect_unmaintained_refs (FlatpakDir   *self,
+                                                   const char   *name_prefix,
+                                                   const char   *arch,
+                                                   const char   *branch,
+                                                   GHashTable   *hash,
+                                                   GCancellable *cancellable,
+                                                   GError      **error);
+gboolean   flatpak_dir_remote_has_deploys (FlatpakDir   *self,
+                                           const char   *remote);
+char      *flatpak_dir_create_origin_remote (FlatpakDir   *self,
+                                             const char   *url,
+                                             const char   *id,
+                                             const char   *title,
+                                             const char   *main_ref,
+                                             GBytes       *gpg_data,
+                                             const char   *collection_id,
+                                             GCancellable *cancellable,
+                                             GError      **error);
+void       flatpak_dir_prune_origin_remote (FlatpakDir *self,
+                                            const char *remote);
+gboolean   flatpak_dir_create_remote_for_ref_file (FlatpakDir   *self,
+                                                   GBytes  *data,
+                                                   const char *default_arch,
+                                                   char   **remote_name_out,
+                                                   char   **ref_out,
+                                                   GError **error);
+gboolean   flatpak_dir_create_suggested_remote_for_ref_file (FlatpakDir   *self,
+                                                             GBytes  *data,
+                                                             GError **error);
+GKeyFile * flatpak_dir_parse_repofile (FlatpakDir   *self,
+                                       const char   *remote_name,
+                                       gboolean      from_ref,
+                                       GBytes       *data,
+                                       GBytes      **gpg_data_out,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+
+char      *flatpak_dir_find_remote_by_uri (FlatpakDir   *self,
+                                           const char   *uri,
+                                           const char   *collection_id);
+gboolean   flatpak_dir_has_remote (FlatpakDir   *self,
+                                   const char   *remote_name);
+char     **flatpak_dir_list_remotes (FlatpakDir   *self,
+                                     GCancellable *cancellable,
+                                     GError      **error);
+char     **flatpak_dir_list_enumerated_remotes (FlatpakDir   *self,
+                                                GCancellable *cancellable,
+                                                GError      **error);
+gboolean   flatpak_dir_modify_remote (FlatpakDir   *self,
+                                      const char   *remote_name,
+                                      GKeyFile     *config,
+                                      GBytes       *gpg_data,
+                                      GCancellable *cancellable,
+                                      GError      **error);
+gboolean   flatpak_dir_remove_remote (FlatpakDir   *self,
+                                      gboolean      force_remove,
+                                      const char   *remote_name,
+                                      GCancellable *cancellable,
+                                      GError      **error);
+char      *flatpak_dir_get_remote_title (FlatpakDir *self,
+                                         const char *remote_name);
+char      *flatpak_dir_get_remote_collection_id (FlatpakDir *self,
+                                                 const char *remote_name);
+char      *flatpak_dir_get_remote_main_ref (FlatpakDir *self,
+                                            const char *remote_name);
+gboolean   flatpak_dir_get_remote_oci (FlatpakDir *self,
+                                       const char *remote_name);
+char      *flatpak_dir_get_remote_default_branch (FlatpakDir *self,
+                                                  const char *remote_name);
+int        flatpak_dir_get_remote_prio (FlatpakDir *self,
+                                        const char *remote_name);
+gboolean   flatpak_dir_get_remote_noenumerate (FlatpakDir *self,
+                                               const char *remote_name);
+gboolean   flatpak_dir_get_remote_nodeps (FlatpakDir *self,
+                                          const char *remote_name);
+gboolean   flatpak_dir_get_remote_disabled (FlatpakDir *self,
+                                            const char *remote_name);
+gboolean   flatpak_dir_list_remote_refs (FlatpakDir   *self,
+                                         const char   *remote,
+                                         GHashTable  **refs,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+gboolean flatpak_dir_fetch_remote_repo_metadata (FlatpakDir    *self,
+                                                 const char    *remote_name,
+                                                 GCancellable  *cancellable,
+                                                 GError       **error);
+char *   flatpak_dir_fetch_remote_title (FlatpakDir   *self,
+                                         const char   *remote,
+                                         GCancellable *cancellable,
+                                         GError      **error);
+char *   flatpak_dir_fetch_remote_default_branch (FlatpakDir   *self,
+                                                  const char   *remote,
+                                                  GCancellable *cancellable,
+                                                  GError      **error);
+GVariant * flatpak_dir_fetch_remote_commit (FlatpakDir   *self,
+                                            const char   *remote_name,
+                                            const char   *ref,
+                                            const char   *opt_commit,
+                                            char        **out_commit,
+                                            GCancellable *cancellable,
+                                            GError      **error);
+gboolean flatpak_dir_update_remote_configuration (FlatpakDir   *self,
+                                                  const char   *remote,
+                                                  GCancellable *cancellable,
+                                                  GError      **error);
+gboolean flatpak_dir_update_remote_configuration_for_summary (FlatpakDir   *self,
+                                                              const char   *remote,
+                                                              GVariant     *summary,
+                                                              gboolean      dry_run,
+                                                              gboolean     *has_changed_out,
+                                                              GCancellable *cancellable,
+                                                              GError      **error);
+gboolean flatpak_dir_update_remote_configuration_for_repo_metadata (FlatpakDir    *self,
+                                                                    const char    *remote,
+                                                                    GVariant      *summary,
+                                                                    gboolean       dry_run,
+                                                                    gboolean      *has_changed_out,
+                                                                    GCancellable  *cancellable,
+                                                                    GError       **error);
+gboolean flatpak_dir_fetch_ref_cache (FlatpakDir   *self,
+                                      const char   *remote_name,
+                                      const char   *ref,
+                                      guint64      *download_size,
+                                      guint64      *installed_size,
+                                      char        **metadata,
+                                      GCancellable *cancellable,
+                                      GError      **error);
+GPtrArray * flatpak_dir_find_remote_related (FlatpakDir *dir,
+                                             const char *remote_name,
+                                             const char *ref,
+                                             GCancellable *cancellable,
+                                             GError **error);
+GPtrArray * flatpak_dir_find_local_related (FlatpakDir *self,
+                                            const char *remote_name,
+                                            const char *ref,
+                                            GCancellable *cancellable,
+                                            GError **error);
+
+gboolean flatpak_dir_lookup_repo_metadata (FlatpakDir    *self,
+                                           const char    *remote_name,
+                                           GCancellable  *cancellable,
+                                           GError       **error,
+                                           const char    *key,
+                                           const char    *format_string,
+                                           ...);
+
+char ** flatpak_dir_get_default_locale_languages (FlatpakDir *self);
+char ** flatpak_dir_get_locale_languages (FlatpakDir *self);
+char ** flatpak_dir_get_locale_subpaths (FlatpakDir *self);
+
+#endif /* __FLATPAK_DIR_H__ */
diff --git a/common/flatpak-json-oci.c b/common/flatpak-json-oci.c
new file mode 100644 (file)
index 0000000..308e1a2
--- /dev/null
@@ -0,0 +1,1049 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+#include "string.h"
+
+#include "flatpak-json-oci.h"
+#include "flatpak-utils.h"
+#include "libglnx.h"
+
+const char *
+flatpak_arch_to_oci_arch (const char *flatpak_arch)
+{
+  if (strcmp (flatpak_arch, "x86_64") == 0)
+    return "amd64";
+  if (strcmp (flatpak_arch, "aarch64") == 0)
+    return "arm64";
+  if (strcmp (flatpak_arch, "i386") == 0)
+    return "386";
+  return flatpak_arch;
+}
+
+FlatpakOciDescriptor *
+flatpak_oci_descriptor_new (const char *mediatype,
+                            const char *digest,
+                            gint64 size)
+{
+  FlatpakOciDescriptor *desc = g_new0 (FlatpakOciDescriptor, 1);
+
+  desc->mediatype = g_strdup (mediatype);
+  desc->digest = g_strdup (digest);
+  desc->size = size;
+  desc->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+  return desc;
+}
+
+void
+flatpak_oci_descriptor_copy (FlatpakOciDescriptor *source,
+                             FlatpakOciDescriptor *dest)
+{
+  flatpak_oci_descriptor_destroy (dest);
+
+  dest->mediatype = g_strdup (source->mediatype);
+  dest->digest = g_strdup (source->digest);
+  dest->size = source->size;
+  dest->urls = g_strdupv ((char **)source->urls);
+  dest->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  if (source->annotations)
+    flatpak_oci_copy_annotations (source->annotations, dest->annotations);
+}
+
+void
+flatpak_oci_descriptor_destroy (FlatpakOciDescriptor *self)
+{
+  g_free (self->mediatype);
+  g_free (self->digest);
+  g_strfreev (self->urls);
+  if (self->annotations)
+    g_hash_table_destroy (self->annotations);
+}
+
+void
+flatpak_oci_descriptor_free (FlatpakOciDescriptor *self)
+{
+  flatpak_oci_descriptor_destroy (self);
+  g_free (self);
+}
+
+static FlatpakJsonProp flatpak_oci_descriptor_props[] = {
+  FLATPAK_JSON_STRING_PROP (FlatpakOciDescriptor, mediatype, "mediaType"),
+  FLATPAK_JSON_STRING_PROP (FlatpakOciDescriptor, digest, "digest"),
+  FLATPAK_JSON_INT64_PROP (FlatpakOciDescriptor, size, "size"),
+  FLATPAK_JSON_STRV_PROP (FlatpakOciDescriptor, urls, "urls"),
+  FLATPAK_JSON_STRMAP_PROP(FlatpakOciDescriptor, annotations, "annotations"),
+  FLATPAK_JSON_LAST_PROP
+};
+
+static void
+flatpak_oci_manifest_platform_destroy (FlatpakOciManifestPlatform *self)
+{
+  g_free (self->architecture);
+  g_free (self->os);
+  g_free (self->os_version);
+  g_strfreev (self->os_features);
+  g_free (self->variant);
+  g_strfreev (self->features);
+}
+
+FlatpakOciManifestDescriptor *
+flatpak_oci_manifest_descriptor_new (void)
+{
+  return g_new0 (FlatpakOciManifestDescriptor, 1);
+}
+
+void
+flatpak_oci_manifest_descriptor_destroy (FlatpakOciManifestDescriptor *self)
+{
+  flatpak_oci_manifest_platform_destroy (&self->platform);
+  flatpak_oci_descriptor_destroy (&self->parent);
+}
+
+void
+flatpak_oci_manifest_descriptor_free (FlatpakOciManifestDescriptor *self)
+{
+  flatpak_oci_manifest_descriptor_destroy (self);
+  g_free (self);
+}
+
+static FlatpakJsonProp flatpak_oci_manifest_platform_props[] = {
+  FLATPAK_JSON_STRING_PROP (FlatpakOciManifestPlatform, architecture, "architecture"),
+  FLATPAK_JSON_STRING_PROP (FlatpakOciManifestPlatform, os, "os"),
+  FLATPAK_JSON_STRING_PROP (FlatpakOciManifestPlatform, os_version, "os.version"),
+  FLATPAK_JSON_STRING_PROP (FlatpakOciManifestPlatform, variant, "variant"),
+  FLATPAK_JSON_STRV_PROP (FlatpakOciManifestPlatform, os_features, "os.features"),
+  FLATPAK_JSON_STRV_PROP (FlatpakOciManifestPlatform, features, "features"),
+  FLATPAK_JSON_LAST_PROP
+};
+static FlatpakJsonProp flatpak_oci_manifest_descriptor_props[] = {
+  FLATPAK_JSON_PARENT_PROP (FlatpakOciManifestDescriptor, parent, flatpak_oci_descriptor_props),
+  FLATPAK_JSON_OPT_STRUCT_PROP (FlatpakOciManifestDescriptor, platform, "platform", flatpak_oci_manifest_platform_props),
+  FLATPAK_JSON_LAST_PROP
+};
+
+
+G_DEFINE_TYPE (FlatpakOciVersioned, flatpak_oci_versioned, FLATPAK_TYPE_JSON);
+
+static void
+flatpak_oci_versioned_finalize (GObject *object)
+{
+  FlatpakOciVersioned *self = FLATPAK_OCI_VERSIONED (object);
+
+  g_free (self->mediatype);
+
+  G_OBJECT_CLASS (flatpak_oci_versioned_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_versioned_class_init (FlatpakOciVersionedClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_INT64_PROP (FlatpakOciVersioned, version, "schemaVersion"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciVersioned, mediatype, "mediaType"),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_versioned_finalize;
+  json_class->props = props;
+}
+
+static void
+flatpak_oci_versioned_init (FlatpakOciVersioned *self)
+{
+}
+
+FlatpakOciVersioned *
+flatpak_oci_versioned_from_json (GBytes *bytes, GError **error)
+{
+  g_autoptr(JsonParser) parser = NULL;
+  JsonNode *root = NULL;
+  const gchar *mediatype;
+  JsonObject *object;
+
+  parser = json_parser_new ();
+  if (!json_parser_load_from_data (parser,
+                                   g_bytes_get_data (bytes, NULL),
+                                   g_bytes_get_size (bytes),
+                                   error))
+    return NULL;
+
+  root = json_parser_get_root (parser);
+  object = json_node_get_object (root);
+
+  mediatype = json_object_get_string_member (object, "mediaType");
+  if (mediatype == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                   "Versioned object lacks mediatype");
+      return NULL;
+    }
+
+  if (strcmp (mediatype, FLATPAK_OCI_MEDIA_TYPE_IMAGE_MANIFEST) == 0)
+    return (FlatpakOciVersioned *) flatpak_json_from_node (root, FLATPAK_TYPE_OCI_MANIFEST, error);
+
+  if (strcmp (mediatype, FLATPAK_OCI_MEDIA_TYPE_IMAGE_INDEX) == 0)
+    return (FlatpakOciVersioned *) flatpak_json_from_node (root, FLATPAK_TYPE_OCI_INDEX, error);
+
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+               "Unsupported media type %s", mediatype);
+  return NULL;
+}
+
+const char *
+flatpak_oci_versioned_get_mediatype (FlatpakOciVersioned *self)
+{
+  return self->mediatype;
+}
+
+gint64
+flatpak_oci_versioned_get_version (FlatpakOciVersioned *self)
+{
+  return self->version;
+}
+
+G_DEFINE_TYPE (FlatpakOciManifest, flatpak_oci_manifest, FLATPAK_TYPE_OCI_VERSIONED);
+
+static void
+flatpak_oci_manifest_finalize (GObject *object)
+{
+  FlatpakOciManifest *self = (FlatpakOciManifest *) object;
+  int i;
+
+  for (i = 0; self->layers != NULL && self->layers[i] != NULL; i++)
+    flatpak_oci_descriptor_free (self->layers[i]);
+  g_free (self->layers);
+  flatpak_oci_descriptor_destroy (&self->config);
+  if (self->annotations)
+    g_hash_table_destroy (self->annotations);
+
+  G_OBJECT_CLASS (flatpak_oci_manifest_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_manifest_class_init (FlatpakOciManifestClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_STRUCT_PROP(FlatpakOciManifest, config, "config", flatpak_oci_descriptor_props),
+    FLATPAK_JSON_STRUCTV_PROP(FlatpakOciManifest, layers, "layers", flatpak_oci_descriptor_props),
+    FLATPAK_JSON_STRMAP_PROP(FlatpakOciManifest, annotations, "annotations"),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_manifest_finalize;
+  json_class->props = props;
+  json_class->mediatype = FLATPAK_OCI_MEDIA_TYPE_IMAGE_MANIFEST;
+}
+
+static void
+flatpak_oci_manifest_init (FlatpakOciManifest *self)
+{
+}
+
+FlatpakOciManifest *
+flatpak_oci_manifest_new (void)
+{
+  FlatpakOciManifest *manifest;
+
+  manifest = g_object_new (FLATPAK_TYPE_OCI_MANIFEST, NULL);
+  manifest->parent.version = 2;
+  manifest->parent.mediatype = g_strdup (FLATPAK_OCI_MEDIA_TYPE_IMAGE_MANIFEST);
+
+  manifest->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+  return manifest;
+}
+
+void
+flatpak_oci_manifest_set_config (FlatpakOciManifest *self,
+                                 FlatpakOciDescriptor *desc)
+{
+  g_free (self->config.mediatype);
+  self->config.mediatype = g_strdup (desc->mediatype);
+  g_free (self->config.digest);
+  self->config.digest = g_strdup (desc->digest);
+  self->config.size = desc->size;
+}
+
+static int
+ptrv_count (gpointer *ptrs)
+{
+  int count;
+
+  for (count = 0; ptrs != NULL && ptrs[count] != NULL; count++)
+    ;
+
+  return count;
+}
+
+void
+flatpak_oci_manifest_set_layer (FlatpakOciManifest  *self,
+                                FlatpakOciDescriptor *desc)
+{
+  FlatpakOciDescriptor *descs[2] = { desc, NULL };
+  flatpak_oci_manifest_set_layers (self, descs);
+}
+
+void
+flatpak_oci_manifest_set_layers (FlatpakOciManifest *self,
+                                 FlatpakOciDescriptor **descs)
+{
+  int i, count;
+
+  for (i = 0; self->layers != NULL && self->layers[i] != NULL; i++)
+    flatpak_oci_descriptor_free (self->layers[i]);
+  g_free (self->layers);
+
+  count = ptrv_count ((gpointer *)descs);
+
+  self->layers = g_new0 (FlatpakOciDescriptor *, count + 1);
+  for (i = 0; i < count; i++)
+    {
+      self->layers[i] = g_new0 (FlatpakOciDescriptor, 1);
+      self->layers[i]->mediatype = g_strdup (descs[i]->mediatype);
+      self->layers[i]->digest = g_strdup (descs[i]->digest);
+      self->layers[i]->size = descs[i]->size;
+    }
+}
+
+int
+flatpak_oci_manifest_get_n_layers (FlatpakOciManifest *self)
+{
+  return ptrv_count ((gpointer *)self->layers);
+}
+
+const char *
+flatpak_oci_manifest_get_layer_digest (FlatpakOciManifest *self,
+                                      int i)
+{
+  return self->layers[i]->digest;
+}
+
+GHashTable *
+flatpak_oci_manifest_get_annotations (FlatpakOciManifest *self)
+{
+  return self->annotations;
+}
+
+G_DEFINE_TYPE (FlatpakOciIndex, flatpak_oci_index, FLATPAK_TYPE_OCI_VERSIONED);
+
+static void
+flatpak_oci_index_finalize (GObject *object)
+{
+  FlatpakOciIndex *self = (FlatpakOciIndex *) object;
+  int i;
+
+  for (i = 0; self->manifests != NULL && self->manifests[i] != NULL; i++)
+    flatpak_oci_manifest_descriptor_free (self->manifests[i]);
+  g_free (self->manifests);
+
+  if (self->annotations)
+    g_hash_table_destroy (self->annotations);
+
+  G_OBJECT_CLASS (flatpak_oci_index_parent_class)->finalize (object);
+}
+
+
+static void
+flatpak_oci_index_class_init (FlatpakOciIndexClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_STRUCTV_PROP(FlatpakOciIndex, manifests, "manifests", flatpak_oci_manifest_descriptor_props),
+    FLATPAK_JSON_STRMAP_PROP(FlatpakOciIndex, annotations, "annotations"),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_index_finalize;
+  json_class->props = props;
+  json_class->mediatype = FLATPAK_OCI_MEDIA_TYPE_IMAGE_INDEX;
+}
+
+static void
+flatpak_oci_index_init (FlatpakOciIndex *self)
+{
+}
+
+FlatpakOciIndex *
+flatpak_oci_index_new (void)
+{
+  FlatpakOciIndex *index;
+
+  index = g_object_new (FLATPAK_TYPE_OCI_INDEX, NULL);
+
+  index->parent.version = 2;
+  index->parent.mediatype = g_strdup (FLATPAK_OCI_MEDIA_TYPE_IMAGE_INDEX);
+  index->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+  return index;
+}
+
+static FlatpakOciManifestDescriptor *
+manifest_desc_for_desc (FlatpakOciDescriptor *src_descriptor, const char *ref)
+{
+  FlatpakOciManifestDescriptor *desc;
+
+  desc = flatpak_oci_manifest_descriptor_new ();
+  flatpak_oci_descriptor_copy (src_descriptor, &desc->parent);
+
+  g_hash_table_replace (desc->parent.annotations,
+                       g_strdup ("org.opencontainers.image.ref.name"),
+                       g_strdup (ref));
+  return desc;
+}
+
+int
+flatpak_oci_index_get_n_manifests (FlatpakOciIndex *self)
+{
+  return ptrv_count ((gpointer *)self->manifests);
+}
+
+void
+flatpak_oci_index_add_manifest (FlatpakOciIndex *self,
+                                FlatpakOciDescriptor *desc)
+{
+  FlatpakOciManifestDescriptor *m;
+  const char *m_ref = NULL;
+  int count;
+
+  if (desc->annotations != NULL)
+    m_ref = g_hash_table_lookup (desc->annotations, "org.flatpak.ref");
+
+  if (m_ref != NULL)
+    flatpak_oci_index_remove_manifest (self, m_ref);
+
+  count = flatpak_oci_index_get_n_manifests (self);
+
+  m = manifest_desc_for_desc (desc, m_ref);
+  self->manifests = g_renew (FlatpakOciManifestDescriptor *, self->manifests, count + 2);
+  self->manifests[count] = m;
+  self->manifests[count+1] = NULL;
+}
+
+const char *
+flatpak_oci_manifest_descriptor_get_ref (FlatpakOciManifestDescriptor *m)
+{
+  if (m->parent.mediatype == NULL ||
+      strcmp (m->parent.mediatype, FLATPAK_OCI_MEDIA_TYPE_IMAGE_MANIFEST) != 0)
+    return NULL;
+
+  if (m->parent.annotations == NULL)
+    return NULL;
+
+  return g_hash_table_lookup (m->parent.annotations, "org.opencontainers.image.ref.name");
+}
+
+static int
+index_find_ref (FlatpakOciIndex *self,
+                const char *ref)
+{
+  int i;
+
+  if (self->manifests == NULL)
+    return -1;
+
+  for (i = 0; self->manifests[i] != NULL; i++)
+    {
+      const char *m_ref = flatpak_oci_manifest_descriptor_get_ref (self->manifests[i]);
+
+      if (m_ref == NULL)
+        continue;
+
+      if (strcmp (ref, m_ref) == 0)
+        return i;
+    }
+
+  return -1;
+}
+
+FlatpakOciManifestDescriptor *
+flatpak_oci_index_get_manifest (FlatpakOciIndex *self,
+                                const char *ref)
+{
+  int i = index_find_ref (self, ref);
+
+  if (i >= 0)
+    return self->manifests[i];
+
+  return NULL;
+}
+
+FlatpakOciManifestDescriptor *
+flatpak_oci_index_get_only_manifest (FlatpakOciIndex *self)
+{
+  int i, found = -1;
+
+  if (self->manifests == NULL)
+    return NULL;
+
+  for (i = 0; self->manifests[i] != NULL; i++)
+    {
+      const char *m_ref = flatpak_oci_manifest_descriptor_get_ref (self->manifests[i]);
+
+      if (m_ref == NULL)
+        continue;
+
+      if (found == -1)
+        found = i;
+      else
+        return NULL;
+    }
+
+  if (found >= 0)
+    return self->manifests[found];
+
+  return NULL;
+}
+
+gboolean
+flatpak_oci_index_remove_manifest (FlatpakOciIndex *self,
+                                   const char      *ref)
+{
+  int i = index_find_ref (self, ref);
+
+  if (i < 0)
+    return FALSE;
+
+  for (; self->manifests[i] != NULL; i++)
+    self->manifests[i] = self->manifests[i+1];
+
+  return TRUE;
+}
+
+G_DEFINE_TYPE (FlatpakOciImage, flatpak_oci_image, FLATPAK_TYPE_JSON);
+
+static void
+flatpak_oci_image_rootfs_destroy (FlatpakOciImageRootfs *self)
+{
+  g_free (self->type);
+  g_strfreev (self->diff_ids);
+}
+
+static void
+flatpak_oci_image_config_destroy (FlatpakOciImageConfig *self)
+{
+  g_free (self->user);
+  g_free (self->working_dir);
+  g_strfreev (self->env);
+  g_strfreev (self->cmd);
+  g_strfreev (self->entrypoint);
+  g_strfreev (self->exposed_ports);
+  g_strfreev (self->volumes);
+  if (self->labels)
+    g_hash_table_destroy (self->labels);
+}
+
+static void
+flatpak_oci_image_history_free (FlatpakOciImageHistory *self)
+{
+  g_free (self->created);
+  g_free (self->created_by);
+  g_free (self->author);
+  g_free (self->comment);
+  g_free (self);
+}
+
+static void
+flatpak_oci_image_finalize (GObject *object)
+{
+  FlatpakOciImage *self = (FlatpakOciImage *) object;
+  int i;
+
+  g_free (self->created);
+  g_free (self->author);
+  g_free (self->architecture);
+  g_free (self->os);
+  flatpak_oci_image_rootfs_destroy (&self->rootfs);
+  flatpak_oci_image_config_destroy (&self->config);
+
+  for (i = 0; self->history != NULL && self->history[i] != NULL; i++)
+    flatpak_oci_image_history_free (self->history[i]);
+  g_free (self->history);
+
+  G_OBJECT_CLASS (flatpak_oci_image_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_image_class_init (FlatpakOciImageClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp config_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageConfig, user, "User"),
+    FLATPAK_JSON_INT64_PROP (FlatpakOciImageConfig, memory, "Memory"),
+    FLATPAK_JSON_INT64_PROP (FlatpakOciImageConfig, memory_swap, "MemorySwap"),
+    FLATPAK_JSON_INT64_PROP (FlatpakOciImageConfig, cpu_shares, "CpuShares"),
+    FLATPAK_JSON_BOOLMAP_PROP (FlatpakOciImageConfig, exposed_ports, "ExposedPorts"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciImageConfig, env, "Env"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciImageConfig, entrypoint, "Entrypoint"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciImageConfig, cmd, "Cmd"),
+    FLATPAK_JSON_BOOLMAP_PROP (FlatpakOciImageConfig, volumes, "Volumes"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageConfig, working_dir, "WorkingDir"),
+    FLATPAK_JSON_STRMAP_PROP(FlatpakOciImageConfig, labels, "Labels"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp rootfs_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageRootfs, type, "type"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciImageRootfs, diff_ids, "diff_ids"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp history_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageHistory, created, "created"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageHistory, created_by, "created_by"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageHistory, author, "author"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImageHistory, comment, "comment"),
+    FLATPAK_JSON_BOOL_PROP (FlatpakOciImageHistory, empty_layer, "empty_layer"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImage, created, "created"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImage, author, "author"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImage, architecture, "architecture"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciImage, os, "os"),
+    FLATPAK_JSON_STRUCT_PROP (FlatpakOciImage, config, "config", config_props),
+    FLATPAK_JSON_STRUCT_PROP (FlatpakOciImage, rootfs, "rootfs", rootfs_props),
+    FLATPAK_JSON_STRUCTV_PROP (FlatpakOciImage, history, "history", history_props),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_image_finalize;
+  json_class->props = props;
+  json_class->mediatype = FLATPAK_OCI_MEDIA_TYPE_IMAGE_CONFIG;
+}
+
+static void
+flatpak_oci_image_init (FlatpakOciImage *self)
+{
+}
+
+FlatpakOciImage *
+flatpak_oci_image_new (void)
+{
+  FlatpakOciImage *image;
+  GTimeVal stamp;
+
+  stamp.tv_sec = time (NULL);
+  stamp.tv_usec = 0;
+
+  image = g_object_new (FLATPAK_TYPE_OCI_IMAGE, NULL);
+
+  /* Some default values */
+  image->created = g_time_val_to_iso8601 (&stamp);
+  image->architecture = g_strdup ("arm64");
+  image->os = g_strdup ("linux");
+
+  image->rootfs.type = g_strdup ("layers");
+  image->rootfs.diff_ids = g_new0 (char *, 1);
+
+  return image;
+}
+
+void
+flatpak_oci_image_set_created (FlatpakOciImage *image,
+                              const char *created)
+{
+  g_free (image->created);
+  image->created = g_strdup (created);
+}
+
+void
+flatpak_oci_image_set_architecture (FlatpakOciImage *image,
+                                   const char *arch)
+{
+  g_free (image->architecture);
+  image->architecture = g_strdup (arch);
+}
+
+void
+flatpak_oci_image_set_os (FlatpakOciImage *image,
+                         const char *os)
+{
+  g_free (image->os);
+  image->os = g_strdup (os);
+}
+
+void
+flatpak_oci_image_set_layers (FlatpakOciImage *image,
+                             const char **layers)
+{
+  g_strfreev (image->rootfs.diff_ids);
+  image->rootfs.diff_ids = g_strdupv ((char **)layers);
+}
+
+void
+flatpak_oci_image_set_layer (FlatpakOciImage *image,
+                             const char *layer)
+{
+  const char *layers[] = {layer, NULL};
+
+  flatpak_oci_image_set_layers (image, layers);
+}
+
+void
+flatpak_oci_export_annotations (GHashTable *source,
+                                GHashTable *dest)
+{
+  const char *keys[] = {
+    "org.flatpak.ref",
+    "org.flatpak.installed-size",
+    "org.flatpak.download-size",
+    "org.flatpak.metadata",
+  };
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS (keys); i++)
+    {
+      const char *key = keys[i];
+      const char *value = g_hash_table_lookup (source, key);
+      if (value)
+        g_hash_table_replace (dest,
+                              g_strdup (key),
+                              g_strdup (value));
+    }
+}
+
+void
+flatpak_oci_copy_annotations (GHashTable *source,
+                              GHashTable *dest)
+{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init (&iter, source);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+   g_hash_table_replace (dest,
+                         g_strdup ((char *)key),
+                         g_strdup ((char *)value));
+}
+
+static void
+add_annotation (GHashTable *annotations, const char *key, const char *value)
+{
+    g_hash_table_replace (annotations,
+                          g_strdup (key),
+                          g_strdup (value));
+}
+
+void
+flatpak_oci_add_annotations_for_commit (GHashTable *annotations,
+                                       const char *ref,
+                                       const char *commit,
+                                       GVariant *commit_data)
+{
+  if (ref)
+    add_annotation (annotations,"org.flatpak.ref", ref);
+
+  if (commit)
+    add_annotation (annotations,"org.flatpak.commit", commit);
+
+  if (commit_data)
+    {
+      g_autofree char *parent = NULL;
+      g_autofree char *subject = NULL;
+      g_autofree char *body = NULL;
+      g_autofree char *timestamp = NULL;
+      g_autoptr(GVariant) metadata = NULL;
+      int i;
+
+      parent = ostree_commit_get_parent (commit_data);
+      if (parent)
+        add_annotation (annotations, "org.flatpak.parent-commit", parent);
+
+      metadata = g_variant_get_child_value (commit_data, 0);
+      for (i = 0; i < g_variant_n_children (metadata); i++)
+        {
+          g_autoptr(GVariant) elm = g_variant_get_child_value (metadata, i);
+          g_autoptr(GVariant) value = g_variant_get_child_value (elm, 1);
+          g_autofree char *key = NULL;
+          g_autofree char *full_key = NULL;
+          g_autofree char *value_base64 = NULL;
+
+          g_variant_get_child (elm, 0, "s", &key);
+          full_key = g_strdup_printf ("org.flatpak.commit-metadata.%s", key);
+
+          value_base64 = g_base64_encode (g_variant_get_data (value), g_variant_get_size (value));
+          add_annotation (annotations, full_key, value_base64);
+        }
+
+      timestamp = g_strdup_printf ("%"G_GUINT64_FORMAT, ostree_commit_get_timestamp (commit_data));
+      add_annotation (annotations, "org.flatpak.timestamp", timestamp);
+
+      g_variant_get_child (commit_data, 3, "s", &subject);
+      add_annotation (annotations, "org.flatpak.subject", subject);
+
+      g_variant_get_child (commit_data, 4, "s", &body);
+      add_annotation (annotations, "org.flatpak.body", body);
+   }
+}
+
+void
+flatpak_oci_parse_commit_annotations (GHashTable *annotations,
+                                      guint64 *out_timestamp,
+                                      char **out_subject,
+                                      char **out_body,
+                                      char **out_ref,
+                                      char **out_commit,
+                                      char **out_parent_commit,
+                                      GVariantBuilder *metadata_builder)
+{
+  const char *oci_timestamp, *oci_subject, *oci_body, *oci_parent_commit, *oci_commit, *oci_ref;
+  GHashTableIter iter;
+  gpointer _key, _value;
+
+  oci_ref = g_hash_table_lookup (annotations, "org.flatpak.ref");
+  if (oci_ref != NULL && out_ref != NULL && *out_ref == NULL)
+    *out_ref = g_strdup (oci_ref);
+
+  oci_commit = g_hash_table_lookup (annotations, "org.flatpak.commit");
+  if (oci_commit != NULL && out_commit != NULL && *out_commit == NULL)
+    *out_commit = g_strdup (oci_commit);
+
+  oci_parent_commit = g_hash_table_lookup (annotations, "org.flatpak.parent-commit");
+  if (oci_parent_commit != NULL && out_parent_commit != NULL && *out_parent_commit == NULL)
+    *out_parent_commit = g_strdup (oci_parent_commit);
+
+  oci_timestamp = g_hash_table_lookup (annotations, "org.flatpak.timestamp");
+  if (oci_timestamp != NULL && out_timestamp != NULL && *out_timestamp == 0)
+    *out_timestamp = g_ascii_strtoull (oci_timestamp, NULL, 10);
+
+  oci_subject = g_hash_table_lookup (annotations, "org.flatpak.subject");
+  if (oci_subject != NULL && out_subject != NULL && *out_subject == NULL)
+    *out_subject = g_strdup (oci_subject);
+
+  oci_body = g_hash_table_lookup (annotations, "org.flatpak.body");
+  if (oci_body != NULL && out_body != NULL && *out_body == NULL)
+    *out_body = g_strdup (oci_body);
+
+  if (metadata_builder)
+    {
+      g_hash_table_iter_init (&iter, annotations);
+      while (g_hash_table_iter_next (&iter, &_key, &_value))
+        {
+          const char *key = _key;
+          const char *value = _value;
+          guchar *bin;
+          gsize bin_len;
+          g_autoptr(GVariant) data = NULL;
+
+          if (!g_str_has_prefix (key, "org.flatpak.commit-metadata."))
+            continue;
+          key += strlen ("org.flatpak.commit-metadata.");
+
+          bin = g_base64_decode (value, &bin_len);
+          data = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE("v"), bin, bin_len, FALSE,
+                                                              g_free, bin));
+          g_variant_builder_add (metadata_builder, "{s@v}", key, data);
+        }
+    }
+}
+
+
+G_DEFINE_TYPE (FlatpakOciSignature, flatpak_oci_signature, FLATPAK_TYPE_JSON);
+
+static void
+flatpak_oci_signature_critical_destroy (FlatpakOciSignatureCritical *self)
+{
+  g_free (self->type);
+  g_free (self->image.digest);
+  g_free (self->identity.ref);
+}
+
+static void
+flatpak_oci_signature_optional_destroy (FlatpakOciSignatureOptional *self)
+{
+  g_free (self->creator);
+}
+
+static void
+flatpak_oci_signature_finalize (GObject *object)
+{
+  FlatpakOciSignature *self = (FlatpakOciSignature *) object;
+
+  flatpak_oci_signature_critical_destroy (&self->critical);
+  flatpak_oci_signature_optional_destroy (&self->optional);
+
+  G_OBJECT_CLASS (flatpak_oci_signature_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_signature_class_init (FlatpakOciSignatureClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp image_props[] = {
+    FLATPAK_JSON_MANDATORY_STRING_PROP (FlatpakOciSignatureCriticalImage, digest, "oci-image-manifest-digest"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp identity_props[] = {
+    FLATPAK_JSON_MANDATORY_STRING_PROP (FlatpakOciSignatureCriticalIdentity, ref, "oci-image-ref"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp critical_props[] = {
+    FLATPAK_JSON_MANDATORY_STRING_PROP (FlatpakOciSignatureCritical, type, "type"),
+    FLATPAK_JSON_MANDATORY_STRICT_STRUCT_PROP(FlatpakOciSignatureCritical, image, "image", image_props),
+    FLATPAK_JSON_MANDATORY_STRICT_STRUCT_PROP(FlatpakOciSignatureCritical, identity, "identity", identity_props),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp optional_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciSignatureOptional, creator, "creator"),
+    FLATPAK_JSON_INT64_PROP (FlatpakOciSignatureOptional, timestamp, "timestamp"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_MANDATORY_STRICT_STRUCT_PROP (FlatpakOciSignature, critical, "critical", critical_props),
+    FLATPAK_JSON_STRUCT_PROP (FlatpakOciSignature, optional, "optional", optional_props),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_signature_finalize;
+  json_class->props = props;
+}
+
+static void
+flatpak_oci_signature_init (FlatpakOciSignature *self)
+{
+}
+
+FlatpakOciSignature *
+flatpak_oci_signature_new (const char *digest, const char *ref)
+{
+  FlatpakOciSignature *signature;
+
+  signature = g_object_new (FLATPAK_TYPE_OCI_SIGNATURE, NULL);
+
+  /* Some default values */
+  signature->critical.type = g_strdup (FLATPAK_OCI_SIGNATURE_TYPE_FLATPAK);
+  signature->critical.image.digest = g_strdup (digest);
+  signature->critical.identity.ref = g_strdup (ref);
+  signature->optional.creator = g_strdup ("flatpak " PACKAGE_VERSION);
+  signature->optional.timestamp = time (NULL);
+
+  return signature;
+}
+
+G_DEFINE_TYPE (FlatpakOciIndexResponse, flatpak_oci_index_response, FLATPAK_TYPE_JSON);
+
+static void
+flatpak_oci_index_image_free (FlatpakOciIndexImage *self)
+{
+  g_free (self->digest);
+  g_free (self->mediatype);
+  g_free (self->os);
+  g_free (self->architecture);
+  g_strfreev (self->tags);
+  if (self->annotations)
+    g_hash_table_destroy (self->annotations);
+  if (self->labels)
+    g_hash_table_destroy (self->labels);
+  g_free (self);
+}
+
+static void
+flatpak_oci_index_image_list_free (FlatpakOciIndexImageList *self)
+{
+  int i;
+
+  g_free (self->digest);
+  g_free (self->mediatype);
+  g_strfreev (self->tags);
+  for (i = 0; self->images != NULL && self->images[i] != NULL; i++)
+    flatpak_oci_index_image_free (self->images[i]);
+  g_free (self->images);
+  g_free (self);
+}
+
+static void
+flatpak_oci_index_repository_free (FlatpakOciIndexRepository *self)
+{
+  int i;
+
+  g_free (self->name);
+  for (i = 0; self->images != NULL && self->images[i] != NULL; i++)
+    flatpak_oci_index_image_free (self->images[i]);
+  g_free (self->images);
+
+  for (i = 0; self->lists != NULL && self->lists[i] != NULL; i++)
+    flatpak_oci_index_image_list_free (self->lists[i]);
+  g_free (self->lists);
+
+  g_free (self);
+}
+
+static void
+flatpak_oci_index_response_finalize (GObject *object)
+{
+  FlatpakOciIndexResponse *self = (FlatpakOciIndexResponse *) object;
+  int i;
+
+  g_free (self->registry);
+  for (i = 0; self->results != NULL && self->results[i] != NULL; i++)
+    flatpak_oci_index_repository_free (self->results[i]);
+  g_free (self->results);
+
+  G_OBJECT_CLASS (flatpak_oci_index_response_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_index_response_class_init (FlatpakOciIndexResponseClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  FlatpakJsonClass *json_class = FLATPAK_JSON_CLASS (klass);
+  static FlatpakJsonProp image_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImage, digest, "Digest"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImage, mediatype, "MediaType"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImage, os, "OS"),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImage, architecture, "Architecture"),
+    FLATPAK_JSON_STRMAP_PROP(FlatpakOciIndexImage, annotations, "Annotations"),
+    FLATPAK_JSON_STRMAP_PROP(FlatpakOciIndexImage, labels, "Labels"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciIndexImage, tags, "Tags"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp lists_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImageList, digest, "Digest"),
+    FLATPAK_JSON_STRUCTV_PROP (FlatpakOciIndexImageList, images, "Images", image_props),
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexImageList, mediatype, "MediaType"),
+    FLATPAK_JSON_STRV_PROP (FlatpakOciIndexImageList, tags, "Tags"),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp results_props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexRepository, name, "Name"),
+    FLATPAK_JSON_STRUCTV_PROP (FlatpakOciIndexRepository, images, "Images", image_props),
+    FLATPAK_JSON_STRUCTV_PROP (FlatpakOciIndexRepository, lists, "Lists", lists_props),
+    FLATPAK_JSON_LAST_PROP
+  };
+  static FlatpakJsonProp props[] = {
+    FLATPAK_JSON_STRING_PROP (FlatpakOciIndexResponse, registry, "Registry"),
+    FLATPAK_JSON_STRUCTV_PROP (FlatpakOciIndexResponse, results, "Results", results_props),
+    FLATPAK_JSON_LAST_PROP
+  };
+
+  object_class->finalize = flatpak_oci_index_response_finalize;
+  json_class->props = props;
+}
+
+static void
+flatpak_oci_index_response_init (FlatpakOciIndexResponse *self)
+{
+}
diff --git a/common/flatpak-json-oci.h b/common/flatpak-json-oci.h
new file mode 100644 (file)
index 0000000..873de0c
--- /dev/null
@@ -0,0 +1,318 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_JSON_OCI_H__
+#define __FLATPAK_JSON_OCI_H__
+
+#include "flatpak-json.h"
+
+G_BEGIN_DECLS
+
+#define FLATPAK_OCI_MEDIA_TYPE_DESCRIPTOR "application/vnd.oci.descriptor.v1+json"
+#define FLATPAK_OCI_MEDIA_TYPE_IMAGE_MANIFEST "application/vnd.oci.image.manifest.v1+json"
+#define FLATPAK_OCI_MEDIA_TYPE_IMAGE_INDEX "application/vnd.oci.image.index.v1+json"
+#define FLATPAK_OCI_MEDIA_TYPE_IMAGE_LAYER "application/vnd.oci.image.layer.v1.tar+gzip"
+#define FLATPAK_OCI_MEDIA_TYPE_IMAGE_LAYER_NONDISTRIBUTABLE "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip"
+#define FLATPAK_OCI_MEDIA_TYPE_IMAGE_CONFIG "application/vnd.oci.image.config.v1+json"
+
+#define FLATPAK_OCI_SIGNATURE_TYPE_FLATPAK "flatpak oci image signature"
+
+const char * flatpak_arch_to_oci_arch (const char *flatpak_arch);
+void flatpak_oci_export_annotations (GHashTable *source,
+                                     GHashTable *dest);
+void flatpak_oci_copy_annotations (GHashTable *source,
+                                   GHashTable *dest);
+
+typedef struct {
+  char *mediatype;
+  char *digest;
+  gint64 size;
+  char **urls;
+  GHashTable *annotations;
+} FlatpakOciDescriptor;
+
+FlatpakOciDescriptor *flatpak_oci_descriptor_new (const char *mediatype,
+                                                  const char *digest,
+                                                  gint64 size);
+void flatpak_oci_descriptor_copy (FlatpakOciDescriptor *source,
+                                  FlatpakOciDescriptor *dest);
+void flatpak_oci_descriptor_destroy (FlatpakOciDescriptor *self);
+void flatpak_oci_descriptor_free (FlatpakOciDescriptor *self);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakOciDescriptor, flatpak_oci_descriptor_free)
+
+typedef struct
+{
+  char *architecture;
+  char *os;
+  char *os_version;
+  char **os_features;
+  char *variant;
+  char **features;
+} FlatpakOciManifestPlatform;
+
+typedef struct
+{
+  FlatpakOciDescriptor parent;
+  FlatpakOciManifestPlatform platform;
+} FlatpakOciManifestDescriptor;
+
+FlatpakOciManifestDescriptor * flatpak_oci_manifest_descriptor_new (void);
+const char * flatpak_oci_manifest_descriptor_get_ref (FlatpakOciManifestDescriptor *m);
+void flatpak_oci_manifest_descriptor_destroy (FlatpakOciManifestDescriptor *self);
+void flatpak_oci_manifest_descriptor_free (FlatpakOciManifestDescriptor *self);
+
+
+#define FLATPAK_TYPE_OCI_VERSIONED flatpak_oci_versioned_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciVersioned, flatpak_oci_versioned, FLATPAK_OCI, VERSIONED, FlatpakJson)
+
+struct _FlatpakOciVersioned {
+  FlatpakJson parent;
+
+  int version;
+  char *mediatype;
+};
+
+struct _FlatpakOciVersionedClass {
+  FlatpakJsonClass parent_class;
+};
+
+FlatpakOciVersioned *flatpak_oci_versioned_from_json     (GBytes               *bytes,
+                                                          GError              **error);
+const char *         flatpak_oci_versioned_get_mediatype (FlatpakOciVersioned  *self);
+gint64               flatpak_oci_versioned_get_version   (FlatpakOciVersioned  *self);
+
+#define FLATPAK_TYPE_OCI_MANIFEST flatpak_oci_manifest_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciManifest, flatpak_oci_manifest, FLATPAK, OCI_MANIFEST, FlatpakOciVersioned)
+
+struct _FlatpakOciManifest
+{
+  FlatpakOciVersioned parent;
+
+  FlatpakOciDescriptor config;
+  FlatpakOciDescriptor **layers;
+  GHashTable     *annotations;
+};
+
+struct _FlatpakOciManifestClass
+{
+  FlatpakOciVersionedClass parent_class;
+};
+
+
+FlatpakOciManifest *flatpak_oci_manifest_new              (void);
+void                flatpak_oci_manifest_set_config       (FlatpakOciManifest  *self,
+                                                           FlatpakOciDescriptor *desc);
+void                flatpak_oci_manifest_set_layers       (FlatpakOciManifest  *self,
+                                                           FlatpakOciDescriptor **descs);
+void                flatpak_oci_manifest_set_layer        (FlatpakOciManifest  *self,
+                                                           FlatpakOciDescriptor *desc);
+int                 flatpak_oci_manifest_get_n_layers     (FlatpakOciManifest  *self);
+const char *        flatpak_oci_manifest_get_layer_digest (FlatpakOciManifest  *self,
+                                                           int                  i);
+GHashTable *        flatpak_oci_manifest_get_annotations  (FlatpakOciManifest  *self);
+
+#define FLATPAK_TYPE_OCI_INDEX flatpak_oci_index_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciIndex, flatpak_oci_index, FLATPAK, OCI_INDEX, FlatpakOciVersioned)
+
+struct _FlatpakOciIndex
+{
+  FlatpakOciVersioned parent;
+
+  FlatpakOciManifestDescriptor **manifests;
+  GHashTable     *annotations;
+};
+
+struct _FlatpakOciIndexClass
+{
+  FlatpakOciVersionedClass parent_class;
+};
+
+FlatpakOciIndex *             flatpak_oci_index_new             (void);
+void                          flatpak_oci_index_add_manifest    (FlatpakOciIndex *self,
+                                                                 FlatpakOciDescriptor *desc);
+gboolean                      flatpak_oci_index_remove_manifest (FlatpakOciIndex *self,
+                                                                 const char      *ref);
+FlatpakOciManifestDescriptor *flatpak_oci_index_get_manifest    (FlatpakOciIndex *self,
+                                                                 const char      *ref);
+FlatpakOciManifestDescriptor *flatpak_oci_index_get_only_manifest (FlatpakOciIndex *self);
+int                           flatpak_oci_index_get_n_manifests (FlatpakOciIndex *self);
+
+#define FLATPAK_TYPE_OCI_IMAGE flatpak_oci_image_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciImage, flatpak_oci_image, FLATPAK, OCI_IMAGE, FlatpakJson)
+
+typedef struct
+{
+  char *type;
+  char **diff_ids;
+} FlatpakOciImageRootfs;
+
+typedef struct
+{
+  char *user;
+  char *working_dir;
+  gint64 memory;
+  gint64 memory_swap;
+  gint64 cpu_shares;
+  char **env;
+  char **cmd;
+  char **entrypoint;
+  char **exposed_ports;
+  char **volumes;
+  GHashTable *labels;
+} FlatpakOciImageConfig;
+
+typedef struct
+{
+  char *created;
+  char *created_by;
+  char *author;
+  char *comment;
+  gboolean empty_layer;
+} FlatpakOciImageHistory;
+
+struct _FlatpakOciImage
+{
+  FlatpakJson parent;
+
+  char *created;
+  char *author;
+  char *architecture;
+  char *os;
+  FlatpakOciImageRootfs rootfs;
+  FlatpakOciImageConfig config;
+  FlatpakOciImageHistory **history;
+};
+
+struct _FlatpakOciImageClass
+{
+  FlatpakJsonClass parent_class;
+};
+
+FlatpakOciImage *flatpak_oci_image_new              (void);
+void             flatpak_oci_image_set_created      (FlatpakOciImage  *image,
+                                                     const char       *created);
+void             flatpak_oci_image_set_architecture (FlatpakOciImage  *image,
+                                                     const char       *arch);
+void             flatpak_oci_image_set_os           (FlatpakOciImage  *image,
+                                                     const char       *os);
+void             flatpak_oci_image_set_layers       (FlatpakOciImage  *image,
+                                                     const char      **layers);
+void             flatpak_oci_image_set_layer        (FlatpakOciImage  *image,
+                                                     const char       *layer);
+
+void flatpak_oci_add_annotations_for_commit (GHashTable       *annotations,
+                                             const char       *ref,
+                                             const char       *commit,
+                                             GVariant         *commit_data);
+void flatpak_oci_parse_commit_annotations  (GHashTable       *annotations,
+                                            guint64          *out_timestamp,
+                                            char            **out_subject,
+                                            char            **out_body,
+                                            char            **out_ref,
+                                            char            **out_commit,
+                                            char            **out_parent_commit,
+                                            GVariantBuilder  *metadata_builder);
+
+#define FLATPAK_TYPE_OCI_SIGNATURE flatpak_oci_signature_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciSignature, flatpak_oci_signature, FLATPAK, OCI_SIGNATURE, FlatpakJson)
+
+typedef struct
+{
+  char *digest;
+} FlatpakOciSignatureCriticalImage;
+
+typedef struct
+{
+  char *ref;
+} FlatpakOciSignatureCriticalIdentity;
+
+typedef struct
+{
+  char *type;
+  FlatpakOciSignatureCriticalImage image;
+  FlatpakOciSignatureCriticalIdentity identity;
+} FlatpakOciSignatureCritical;
+
+typedef struct
+{
+  char *creator;
+  gint64 timestamp;
+} FlatpakOciSignatureOptional;
+
+struct _FlatpakOciSignature
+{
+  FlatpakJson parent;
+
+  FlatpakOciSignatureCritical critical;
+  FlatpakOciSignatureOptional optional;
+};
+
+struct _FlatpakOciSignatureClass
+{
+  FlatpakJsonClass parent_class;
+};
+
+FlatpakOciSignature *flatpak_oci_signature_new (const char *digest, const char *ref);
+
+
+#define FLATPAK_TYPE_OCI_INDEX_RESPONSE flatpak_oci_index_response_get_type ()
+G_DECLARE_FINAL_TYPE (FlatpakOciIndexResponse, flatpak_oci_index_response, FLATPAK, OCI_INDEX_RESPONSE, FlatpakJson)
+
+typedef struct
+{
+  char *digest;
+  char *mediatype;
+  char *os;
+  char *architecture;
+  GHashTable *annotations;
+  GHashTable *labels;
+  char **tags;
+} FlatpakOciIndexImage;
+
+typedef struct
+{
+  char *digest;
+  char *mediatype;
+  char **tags;
+  FlatpakOciIndexImage **images;
+} FlatpakOciIndexImageList;
+
+typedef struct
+{
+  char *name;
+  FlatpakOciIndexImage **images;
+  FlatpakOciIndexImageList **lists;
+} FlatpakOciIndexRepository;
+
+struct _FlatpakOciIndexResponse
+{
+  FlatpakJson parent;
+
+  char *registry;
+  FlatpakOciIndexRepository **results;
+};
+
+struct _FlatpakOciIndexResponseClass
+{
+  FlatpakJsonClass parent_class;
+};
+
+#endif /* __FLATPAK_JSON_OCI_H__ */
diff --git a/common/flatpak-json.c b/common/flatpak-json.c
new file mode 100644 (file)
index 0000000..ba94de4
--- /dev/null
@@ -0,0 +1,634 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+#include "string.h"
+
+#include "flatpak-json.h"
+#include "flatpak-utils.h"
+#include "libglnx.h"
+
+G_DEFINE_TYPE (FlatpakJson, flatpak_json, G_TYPE_OBJECT);
+
+static void
+flatpak_json_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (flatpak_json_parent_class)->finalize (object);
+}
+
+static void
+flatpak_json_class_init (FlatpakJsonClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_json_finalize;
+}
+
+static void
+flatpak_json_init (FlatpakJson *self)
+{
+}
+
+static gboolean
+demarshal (JsonNode *parent_node,
+           const char *name,
+           gpointer dest,
+           FlatpakJsonPropType type,
+           gpointer type_data,
+           gpointer type_data2,
+           FlatpakJsonPropFlags flags,
+           GError **error)
+{
+  JsonObject *parent_object;
+  JsonNode *node;
+
+  if (type != FLATPAK_JSON_PROP_TYPE_PARENT)
+    {
+      parent_object = json_node_get_object (parent_node);
+      node = json_object_get_member (parent_object, name);
+
+      if (node == NULL && (flags & FLATPAK_JSON_PROP_FLAGS_MANDATORY) != 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "No value for mandatory property %s", name);
+          return FALSE;
+        }
+    }
+  else
+    node = parent_node;
+
+  if (node == NULL || JSON_NODE_TYPE (node) == JSON_NODE_NULL)
+    return TRUE;
+
+  switch (type)
+    {
+    case FLATPAK_JSON_PROP_TYPE_STRING:
+      if (!JSON_NODE_HOLDS_VALUE (node) ||
+          json_node_get_value_type (node) != G_TYPE_STRING)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting string for property %s", name);
+          return FALSE;
+        }
+      *(char **)dest = g_strdup (json_node_get_string (node));
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_INT64:
+      if (!JSON_NODE_HOLDS_VALUE (node) ||
+          json_node_get_value_type (node) != G_TYPE_INT64)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting int64 for property %s", name);
+          return FALSE;
+        }
+      *(gint64 *)dest = json_node_get_int (node);
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_BOOL:
+      if (!JSON_NODE_HOLDS_VALUE (node) ||
+          json_node_get_value_type (node) != G_TYPE_BOOLEAN)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting bool for property %s", name);
+          return FALSE;
+        }
+      *(gboolean *)dest = json_node_get_boolean (node);
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_STRV:
+      if (!JSON_NODE_HOLDS_ARRAY (node))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting array for property %s", name);
+          return FALSE;
+        }
+      {
+        JsonArray *array = json_node_get_array (node);
+        guint i, array_len = json_array_get_length (array);
+        g_autoptr(GPtrArray) str_array = g_ptr_array_sized_new (array_len + 1);
+
+        for (i = 0; i < array_len; i++)
+          {
+            JsonNode *val = json_array_get_element (array, i);
+
+            if (JSON_NODE_TYPE (val) != JSON_NODE_VALUE)
+              continue;
+
+            if (json_node_get_string (val) != NULL)
+              g_ptr_array_add (str_array, (gpointer) g_strdup (json_node_get_string (val)));
+          }
+
+        g_ptr_array_add (str_array, NULL);
+        *(char ***)dest = (char **)g_ptr_array_free (g_steal_pointer (&str_array), FALSE);
+      }
+
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_PARENT:
+    case FLATPAK_JSON_PROP_TYPE_STRUCT:
+      if (!JSON_NODE_HOLDS_OBJECT (node))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting object for property %s", name);
+          return FALSE;
+        }
+      {
+        FlatpakJsonProp *struct_props = type_data;
+        int i;
+
+        if ((struct_props->flags & FLATPAK_JSON_PROP_FLAGS_STRICT) != 0)
+          {
+            JsonObject *object = json_node_get_object (node);
+            g_autoptr(GList) members = json_object_get_members (object);
+            GList *l;
+
+            /* Verify that all members are known properties if strict flag is set */
+            for (l = members; l != NULL; l = l->next)
+              {
+                const char *name = l->data;
+                for (i = 0; struct_props[i].name != NULL; i++)
+                  {
+                    if (strcmp (struct_props[i].name, name) == 0)
+                      break;
+                  }
+                if (struct_props[i].name == NULL)
+                  return flatpak_fail (error, "Unknown property named %s", name);
+              }
+          }
+
+        for (i = 0; struct_props[i].name != NULL; i++)
+          {
+            if (!demarshal (node, struct_props[i].name,
+                            G_STRUCT_MEMBER_P (dest, struct_props[i].offset),
+                            struct_props[i].type, struct_props[i].type_data, struct_props[i].type_data2,
+                            struct_props[i].flags, error))
+              return FALSE;
+          }
+      }
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_STRUCTV:
+      if (!JSON_NODE_HOLDS_ARRAY (node))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting array for property %s", name);
+          return FALSE;
+        }
+      {
+        JsonArray *array = json_node_get_array (node);
+        guint array_len = json_array_get_length (array);
+        FlatpakJsonProp *struct_props = type_data;
+        g_autoptr(GPtrArray) obj_array = g_ptr_array_sized_new (array_len + 1);
+        int i, j;
+        gboolean res = TRUE;
+
+        for (j = 0; res && j < array_len; j++)
+          {
+            JsonNode *val = json_array_get_element (array, j);
+            gpointer new_element;
+
+            if (!JSON_NODE_HOLDS_OBJECT (val))
+              {
+                g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                             "Expecting object elemen for property %s", name);
+                res = FALSE;
+                break;
+              }
+
+            new_element = g_malloc0 ((gsize)type_data2);
+            g_ptr_array_add (obj_array, new_element);
+
+            for (i = 0; struct_props[i].name != NULL; i++)
+              {
+                if (!demarshal (val, struct_props[i].name,
+                                G_STRUCT_MEMBER_P (new_element, struct_props[i].offset),
+                                struct_props[i].type, struct_props[i].type_data, struct_props[i].type_data2,
+                                struct_props[i].flags, error))
+                  {
+                    res = FALSE;
+                    break;
+                  }
+              }
+
+          }
+
+        /* NULL terminate */
+        g_ptr_array_add (obj_array, NULL);
+
+        /* We always set the array, even if it is partial, because we don't know how
+           to free what we demarshalled so far */
+        *(gpointer *)dest = (gpointer *)g_ptr_array_free (g_steal_pointer (&obj_array), FALSE);
+        return res;
+      }
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_STRMAP:
+      if (!JSON_NODE_HOLDS_OBJECT (node))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting object for property %s", name);
+          return FALSE;
+        }
+      {
+        g_autoptr(GHashTable) h = NULL;
+        JsonObject *object = json_node_get_object (node);
+        g_autoptr(GList) members = NULL;
+        GList *l;
+
+        h = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+        members = json_object_get_members (object);
+        for (l = members; l != NULL; l = l->next)
+          {
+            const char *member_name = l->data;
+            JsonNode *val;
+            const char *val_str;
+
+            val = json_object_get_member (object, member_name);
+            val_str = json_node_get_string (val);
+            if (val_str == NULL)
+              {
+                g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                             "Wrong type for string member %s", member_name);
+                return FALSE;
+              }
+
+            g_hash_table_insert (h, g_strdup (member_name), g_strdup (val_str));
+          }
+
+        *(GHashTable **)dest = g_steal_pointer (&h);
+      }
+      break;
+
+    case FLATPAK_JSON_PROP_TYPE_BOOLMAP:
+      if (!JSON_NODE_HOLDS_OBJECT (node))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Expecting object for property %s", name);
+          return FALSE;
+        }
+      {
+        JsonObject *object = json_node_get_object (node);
+        g_autoptr(GPtrArray) res = g_ptr_array_new_with_free_func (g_free);
+        g_autoptr(GList) members = NULL;
+        GList *l;
+
+        members = json_object_get_members (object);
+        for (l = members; l != NULL; l = l->next)
+          {
+            const char *member_name = l->data;
+
+            g_ptr_array_add (res, g_strdup (member_name));
+          }
+
+        g_ptr_array_add (res, NULL);
+
+        *(char ***)dest =  (char **)g_ptr_array_free (g_steal_pointer (&res), FALSE);
+      }
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+
+  return TRUE;
+}
+
+FlatpakJson *
+flatpak_json_from_node (JsonNode *node, GType type, GError **error)
+{
+  g_autoptr(FlatpakJson) json = NULL;
+  FlatpakJsonProp *props = NULL;
+  gpointer class;
+  int i;
+
+  /* We should handle these before we get here */
+  g_assert (node != NULL);
+  g_assert (JSON_NODE_TYPE (node) != JSON_NODE_NULL);
+
+  if (JSON_NODE_TYPE (node) != JSON_NODE_OBJECT)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Expecting a JSON object, but the node is of type `%s'",
+                   json_node_type_name (node));
+      return NULL;
+    }
+
+  json = g_object_new (type, NULL);
+
+  class = FLATPAK_JSON_GET_CLASS (json);
+  while (FLATPAK_JSON_CLASS (class)->props != NULL)
+    {
+      props = FLATPAK_JSON_CLASS (class)->props;
+      for (i = 0; props[i].name != NULL; i++)
+        {
+          if (!demarshal (node, props[i].name,
+                          G_STRUCT_MEMBER_P (json, props[i].offset),
+                          props[i].type, props[i].type_data, props[i].type_data2,
+                          props[i].flags, error))
+            return NULL;
+        }
+      class = g_type_class_peek_parent (class);
+    }
+
+  return g_steal_pointer (&json);
+}
+
+FlatpakJson *
+flatpak_json_from_bytes (GBytes         *bytes,
+                        GType           type,
+                        GError        **error)
+{
+  g_autoptr(JsonParser) parser = NULL;
+  JsonNode *root = NULL;
+
+  parser = json_parser_new ();
+  if (!json_parser_load_from_data (parser,
+                                   g_bytes_get_data (bytes, NULL),
+                                   g_bytes_get_size (bytes),
+                                   error))
+    return NULL;
+
+  root = json_parser_get_root (parser);
+
+  return flatpak_json_from_node (root, type, error);
+}
+
+static JsonNode *
+marshal (JsonObject *parent,
+         const char *name,
+         gpointer src,
+         FlatpakJsonPropType type,
+         gpointer type_data,
+         FlatpakJsonPropFlags flags)
+{
+  JsonNode *retval = NULL;
+
+  switch (type)
+    {
+    case FLATPAK_JSON_PROP_TYPE_STRING:
+      {
+        const char *str = *(const char **)src;
+        if (str != NULL)
+          retval = json_node_init_string (json_node_alloc (), str);
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_INT64:
+      {
+        retval = json_node_init_int (json_node_alloc (), *(gint64 *)src);
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_BOOL:
+      {
+        gboolean val = *(gboolean *)src;
+        if (val)
+          retval = json_node_init_boolean (json_node_alloc (), val);
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_STRV:
+      {
+        char **strv = *(char ***)src;
+        int i;
+        JsonArray *array;
+
+        if (strv != NULL && strv[0] != NULL)
+          {
+            array = json_array_sized_new (g_strv_length (strv));
+            for (i = 0; strv[i] != NULL; i++)
+              {
+                JsonNode *str = json_node_new (JSON_NODE_VALUE);
+
+                json_node_set_string (str, strv[i]);
+                json_array_add_element (array, str);
+              }
+
+            retval = json_node_init_array (json_node_alloc (), array);
+            json_array_unref (array);
+          }
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_PARENT:
+    case FLATPAK_JSON_PROP_TYPE_STRUCT:
+      {
+        FlatpakJsonProp *struct_props = type_data;
+        JsonObject *obj;
+        int i;
+        gboolean empty = TRUE;
+
+        if (type == FLATPAK_JSON_PROP_TYPE_PARENT)
+          obj = parent;
+        else
+          obj = json_object_new ();
+
+        for (i = 0; struct_props[i].name != NULL; i++)
+          {
+            JsonNode *val = marshal (obj, struct_props[i].name,
+                                     G_STRUCT_MEMBER_P (src, struct_props[i].offset),
+                                     struct_props[i].type, struct_props[i].type_data, struct_props[i].flags);
+
+            if (val == NULL)
+              continue;
+
+            empty = FALSE;
+            json_object_set_member (obj, struct_props[i].name, val);
+          }
+
+        if (type != FLATPAK_JSON_PROP_TYPE_PARENT &&
+            (!empty || (flags & FLATPAK_JSON_PROP_FLAGS_OPTIONAL) == 0))
+          {
+            retval = json_node_new (JSON_NODE_OBJECT);
+            json_node_take_object (retval, obj);
+          }
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_STRUCTV:
+      {
+        FlatpakJsonProp *struct_props = type_data;
+        gpointer *structv = *(gpointer **)src;
+        int i, j;
+        JsonArray *array;
+
+        if (structv != NULL && structv[0] != NULL)
+          {
+            array = json_array_new ();
+            for (j = 0; structv[j] != NULL; j++)
+              {
+                JsonObject *obj = json_object_new ();
+                JsonNode *node;
+
+                for (i = 0; struct_props[i].name != NULL; i++)
+                  {
+                    JsonNode *val = marshal (obj, struct_props[i].name,
+                                             G_STRUCT_MEMBER_P (structv[j], struct_props[i].offset),
+                                             struct_props[i].type, struct_props[i].type_data, struct_props[i].flags);
+
+                    if (val == NULL)
+                      continue;
+
+                    json_object_set_member (obj, struct_props[i].name, val);
+                  }
+
+                node = json_node_new (JSON_NODE_OBJECT);
+                json_node_take_object (node, obj);
+                json_array_add_element (array, node);
+              }
+
+            retval = json_node_init_array (json_node_alloc (), array);
+            json_array_unref (array);
+          }
+
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_STRMAP:
+      {
+        GHashTable *map = *(GHashTable **)src;
+
+        if (map != NULL && g_hash_table_size (map) > 0)
+          {
+            GHashTableIter iter;
+            gpointer _key, _value;
+            JsonObject *object;
+
+            object = json_object_new ();
+
+            g_hash_table_iter_init (&iter, map);
+            while (g_hash_table_iter_next (&iter, &_key, &_value))
+              {
+                const char *key = _key;
+                const char *value = _value;
+                JsonNode *str = json_node_new (JSON_NODE_VALUE);
+
+                json_node_set_string (str, value);
+                json_object_set_member (object, key, str);
+              }
+
+            retval = json_node_init_object (json_node_alloc (), object);
+            json_object_unref (object);
+          }
+        break;
+      }
+
+    case FLATPAK_JSON_PROP_TYPE_BOOLMAP:
+      {
+        char **map = *(char ***)src;
+
+        if (map != NULL && map[0] != NULL)
+          {
+            JsonObject *object;
+            int i;
+
+            object = json_object_new ();
+
+            for (i = 0; map[i] != NULL; i++)
+              {
+                const char *element = map[i];
+                JsonObject *empty_o = json_object_new ();
+                JsonNode *empty = json_node_init_object (json_node_alloc (), empty_o);
+                json_object_unref (empty_o);
+
+                json_object_set_member (object, element, empty);
+              }
+
+            retval = json_node_init_object (json_node_alloc (), object);
+            json_object_unref (object);
+          }
+        break;
+      }
+
+    default:
+      g_assert_not_reached ();
+    }
+
+  return retval;
+}
+
+static void
+marshal_props_for_class (FlatpakJson *self,
+                         FlatpakJsonClass *class,
+                         JsonObject *obj)
+{
+  FlatpakJsonProp *props = NULL;
+  int i;
+  gpointer parent_class;
+
+  parent_class = g_type_class_peek_parent (class);
+
+  if (FLATPAK_JSON_CLASS (parent_class)->props != NULL)
+    marshal_props_for_class (self,
+                             FLATPAK_JSON_CLASS(parent_class),
+                             obj);
+
+  props = FLATPAK_JSON_CLASS (class)->props;
+  for (i = 0; props[i].name != NULL; i++)
+    {
+      JsonNode *val = marshal (obj, props[i].name,
+                               G_STRUCT_MEMBER_P (self, props[i].offset),
+                               props[i].type, props[i].type_data, props[i].flags);
+
+      if (val == NULL)
+        continue;
+
+      json_object_set_member (obj, props[i].name, val);
+    }
+}
+
+JsonNode *
+flatpak_json_to_node (FlatpakJson *self)
+{
+  JsonNode *retval;
+  JsonObject *obj;
+  gpointer class;
+
+  if (self == NULL)
+    return json_node_new (JSON_NODE_NULL);
+
+  obj = json_object_new ();
+
+  class = FLATPAK_JSON_GET_CLASS (self);
+  marshal_props_for_class (self, FLATPAK_JSON_CLASS (class), obj);
+
+  retval = json_node_new (JSON_NODE_OBJECT);
+  json_node_take_object (retval, obj);
+
+  return retval;
+}
+
+GBytes *
+flatpak_json_to_bytes (FlatpakJson  *self)
+{
+  g_autoptr(JsonNode) node = NULL;
+  g_autoptr(JsonGenerator) generator = NULL;
+  char *str;
+
+  node = flatpak_json_to_node (FLATPAK_JSON (self));
+
+  generator = json_generator_new ();
+  json_generator_set_pretty (generator, TRUE);
+  json_generator_set_root (generator, node);
+
+  str = json_generator_to_data (generator, NULL);
+  return g_bytes_new_take (str, strlen (str));
+}
diff --git a/common/flatpak-json.h b/common/flatpak-json.h
new file mode 100644 (file)
index 0000000..719929d
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_JSON_H__
+#define __FLATPAK_JSON_H__
+
+#include <json-glib/json-glib.h>
+
+G_BEGIN_DECLS
+
+#define FLATPAK_TYPE_JSON flatpak_json_get_type ()
+
+typedef struct _FlatpakJsonProp FlatpakJsonProp;
+
+typedef enum {
+  FLATPAK_JSON_PROP_TYPE_PARENT,
+  FLATPAK_JSON_PROP_TYPE_INT64,
+  FLATPAK_JSON_PROP_TYPE_BOOL,
+  FLATPAK_JSON_PROP_TYPE_STRING,
+  FLATPAK_JSON_PROP_TYPE_STRUCT,
+  FLATPAK_JSON_PROP_TYPE_STRUCTV,
+  FLATPAK_JSON_PROP_TYPE_STRV,
+  FLATPAK_JSON_PROP_TYPE_STRMAP,
+  FLATPAK_JSON_PROP_TYPE_BOOLMAP,
+} FlatpakJsonPropType;
+
+typedef enum {
+  FLATPAK_JSON_PROP_FLAGS_NONE = 0,
+  FLATPAK_JSON_PROP_FLAGS_OPTIONAL = 1<<0,
+  FLATPAK_JSON_PROP_FLAGS_STRICT = 1<<1,
+  FLATPAK_JSON_PROP_FLAGS_MANDATORY = 1<<2,
+} FlatpakJsonPropFlags;
+
+
+struct _FlatpakJsonProp {
+  const char *name;
+  gsize offset;
+  FlatpakJsonPropType type;
+  gpointer type_data;
+  gpointer type_data2;
+  FlatpakJsonPropFlags flags;
+} ;
+
+#define FLATPAK_JSON_STRING_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRING }
+#define FLATPAK_JSON_MANDATORY_STRING_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRING, 0, 0, FLATPAK_JSON_PROP_FLAGS_MANDATORY }
+#define FLATPAK_JSON_INT64_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_INT64 }
+#define FLATPAK_JSON_BOOL_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_BOOL }
+#define FLATPAK_JSON_STRV_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRV }
+#define FLATPAK_JSON_STRMAP_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRMAP }
+#define FLATPAK_JSON_BOOLMAP_PROP(_struct, _field, _name) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_BOOLMAP }
+#define FLATPAK_JSON_STRUCT_PROP(_struct, _field, _name, _props) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRUCT, (gpointer)_props}
+#define FLATPAK_JSON_OPT_STRUCT_PROP(_struct, _field, _name, _props) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRUCT, (gpointer)_props, 0, FLATPAK_JSON_PROP_FLAGS_OPTIONAL}
+#define FLATPAK_JSON_STRICT_STRUCT_PROP(_struct, _field, _name, _props) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRUCT, (gpointer)_props, 0, FLATPAK_JSON_PROP_FLAGS_STRICT}
+#define FLATPAK_JSON_MANDATORY_STRICT_STRUCT_PROP(_struct, _field, _name, _props) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRUCT, (gpointer)_props, 0, FLATPAK_JSON_PROP_FLAGS_STRICT | FLATPAK_JSON_PROP_FLAGS_MANDATORY}
+#define FLATPAK_JSON_PARENT_PROP(_struct, _field, _props) \
+  { "parent", G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_PARENT, (gpointer)_props}
+#define FLATPAK_JSON_STRUCTV_PROP(_struct, _field, _name, _props) \
+  { _name, G_STRUCT_OFFSET (_struct, _field), FLATPAK_JSON_PROP_TYPE_STRUCTV, (gpointer)_props, (gpointer) sizeof (**((_struct *) 0)->_field) }
+#define FLATPAK_JSON_LAST_PROP { NULL }
+
+G_DECLARE_DERIVABLE_TYPE (FlatpakJson, flatpak_json, FLATPAK, JSON, GObject)
+
+struct _FlatpakJsonClass {
+  GObjectClass parent_class;
+
+  FlatpakJsonProp *props;
+  const char *mediatype;
+};
+
+FlatpakJson *flatpak_json_from_node (JsonNode       *node,
+                                     GType           type,
+                                     GError        **error);
+JsonNode   *flatpak_json_to_node   (FlatpakJson  *self);
+FlatpakJson *flatpak_json_from_bytes (GBytes         *bytes,
+                                      GType           type,
+                                      GError        **error);
+GBytes     *flatpak_json_to_bytes  (FlatpakJson  *self);
+
+G_END_DECLS
+
+#endif /* __FLATPAK_JSON_H__ */
diff --git a/common/flatpak-oci-registry.c b/common/flatpak-oci-registry.c
new file mode 100644 (file)
index 0000000..331eac4
--- /dev/null
@@ -0,0 +1,2147 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+#include <gio/gunixoutputstream.h>
+#include <gio/gunixinputstream.h>
+
+#include "libglnx.h"
+
+#include <gpgme.h>
+#include <libsoup/soup.h>
+#include "flatpak-oci-registry.h"
+#include "flatpak-utils.h"
+
+G_DEFINE_QUARK (flatpak_oci_error, flatpak_oci_error)
+
+#define MAX_JSON_SIZE (1024 * 1024)
+
+typedef struct archive FlatpakAutoArchiveWrite;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(FlatpakAutoArchiveWrite, archive_write_free)
+
+static void flatpak_oci_registry_initable_iface_init (GInitableIface *iface);
+
+struct FlatpakOciRegistry
+{
+  GObject parent;
+
+  gboolean for_write;
+  gboolean valid;
+  gboolean is_docker;
+  char *uri;
+  int tmp_dfd;
+
+  /* Local repos */
+  int dfd;
+
+  /* Remote repos */
+  SoupSession *soup_session;
+  SoupURI *base_uri;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakOciRegistryClass;
+
+enum {
+  PROP_0,
+
+  PROP_URI,
+  PROP_FOR_WRITE,
+  PROP_TMP_DFD,
+};
+
+G_DEFINE_TYPE_WITH_CODE (FlatpakOciRegistry, flatpak_oci_registry, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+                                                flatpak_oci_registry_initable_iface_init))
+
+static void
+flatpak_oci_registry_finalize (GObject *object)
+{
+  FlatpakOciRegistry *self = FLATPAK_OCI_REGISTRY (object);
+
+  if (self->dfd != -1)
+    close (self->dfd);
+
+  g_clear_object (&self->soup_session);
+  g_clear_pointer (&self->base_uri, soup_uri_free);
+  g_free (self->uri);
+
+  G_OBJECT_CLASS (flatpak_oci_registry_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_registry_set_property (GObject         *object,
+                                  guint            prop_id,
+                                  const GValue    *value,
+                                  GParamSpec      *pspec)
+{
+  FlatpakOciRegistry *self = FLATPAK_OCI_REGISTRY (object);
+  const char *uri;
+
+  switch (prop_id)
+    {
+    case PROP_URI:
+      /* Ensure the base uri ends with a / so relative urls work */
+      uri = g_value_get_string (value);
+      if (g_str_has_prefix (uri, "/"))
+        self->uri = g_strdup (uri);
+      else
+        self->uri = g_strconcat (uri, "/", NULL);
+      break;
+    case PROP_FOR_WRITE:
+      self->for_write = g_value_get_boolean (value);
+      break;
+    case PROP_TMP_DFD:
+      self->tmp_dfd = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_oci_registry_get_property (GObject         *object,
+                                  guint            prop_id,
+                                  GValue          *value,
+                                  GParamSpec      *pspec)
+{
+  FlatpakOciRegistry *self = FLATPAK_OCI_REGISTRY (object);
+
+  switch (prop_id)
+    {
+    case PROP_URI:
+      g_value_set_string (value, self->uri);
+      break;
+    case PROP_FOR_WRITE:
+      g_value_set_boolean (value, self->for_write);
+      break;
+    case PROP_TMP_DFD:
+      g_value_set_int (value, self->tmp_dfd);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_oci_registry_class_init (FlatpakOciRegistryClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_oci_registry_finalize;
+  object_class->get_property = flatpak_oci_registry_get_property;
+  object_class->set_property = flatpak_oci_registry_set_property;
+
+  g_object_class_install_property (object_class,
+                                   PROP_URI,
+                                   g_param_spec_string ("uri",
+                                                        "",
+                                                        "",
+                                                        NULL,
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_TMP_DFD,
+                                   g_param_spec_int ("tmp-dfd",
+                                                     "",
+                                                     "",
+                                                     -1, G_MAXINT, -1,
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_FOR_WRITE,
+                                   g_param_spec_boolean ("for-write",
+                                                         "",
+                                                         "",
+                                                         FALSE,
+                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+flatpak_oci_registry_init (FlatpakOciRegistry *self)
+{
+  self->dfd = -1;
+  self->tmp_dfd = -1;
+}
+
+const char *
+flatpak_oci_registry_get_uri (FlatpakOciRegistry   *self)
+{
+  return self->uri;
+}
+
+FlatpakOciRegistry *
+flatpak_oci_registry_new (const char *uri,
+                         gboolean for_write,
+                         int tmp_dfd,
+                         GCancellable *cancellable,
+                         GError **error)
+{
+  FlatpakOciRegistry *oci_registry;
+
+  oci_registry = g_initable_new (FLATPAK_TYPE_OCI_REGISTRY,
+                                 cancellable, error,
+                                 "uri", uri,
+                                 "for-write", for_write,
+                                 "tmp-dfd", tmp_dfd,
+                                 NULL);
+
+  return oci_registry;
+}
+
+static int
+local_open_file (int dfd,
+                 const char *subpath,
+                 struct stat *st_buf,
+                 GCancellable *cancellable,
+                 GError **error)
+{
+  glnx_autofd int fd = -1;
+  struct stat tmp_st_buf;
+
+  do
+    fd = openat (dfd, subpath, O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOCTTY);
+  while (G_UNLIKELY (fd == -1 && errno == EINTR));
+  if (fd == -1)
+    {
+      glnx_set_error_from_errno (error);
+      return -1;
+    }
+
+  if (st_buf == NULL)
+    st_buf = &tmp_st_buf;
+
+  if (fstat (fd, st_buf) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return -1;
+    }
+
+  if (!S_ISREG (st_buf->st_mode))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Non-regular file in OCI registry at %s", subpath);
+      return -1;
+    }
+
+  return glnx_steal_fd (&fd);
+}
+
+static GBytes *
+local_load_file (int dfd,
+                 const char *subpath,
+                 const char *etag,
+                 char **etag_out,
+                 GCancellable *cancellable,
+                 GError **error)
+{
+  glnx_autofd int fd = -1;
+  struct stat st_buf;
+  GBytes *bytes;
+  g_autofree char *current_etag = NULL;
+
+  fd = local_open_file (dfd, subpath, &st_buf, cancellable, error);
+  if (fd == -1)
+    return NULL;
+
+  current_etag = g_strdup_printf ("%lu", st_buf.st_mtime);
+
+  if (etag != NULL && strcmp (current_etag, etag) == 0)
+    {
+      g_set_error (error, FLATPAK_OCI_ERROR, FLATPAK_OCI_ERROR_NOT_CHANGED,
+                   "File %s was not changed", subpath);
+      return NULL;
+    }
+
+  bytes = glnx_fd_readall_bytes (fd, cancellable, error);
+  if (bytes == NULL)
+    return NULL;
+
+  if (etag_out)
+    *etag_out = g_steal_pointer (&current_etag);
+
+  return bytes;
+}
+
+static GBytes *
+remote_load_file (SoupSession *soup_session,
+                  SoupURI *base,
+                  const char *subpath,
+                  const char *etag,
+                  char **etag_out,
+                  GCancellable *cancellable,
+                  GError **error)
+{
+  g_autoptr(SoupURI) uri = NULL;
+  g_autoptr(GBytes) bytes = NULL;
+  g_autofree char *uri_s = NULL;
+
+  uri = soup_uri_new_with_base (base, subpath);
+  if (uri == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                   "Invalid relative url %s", subpath);
+      return NULL;
+    }
+
+  uri_s = soup_uri_to_string (uri, FALSE);
+  bytes = flatpak_load_http_uri (soup_session,
+                                 uri_s, FLATPAK_HTTP_FLAGS_ACCEPT_OCI, etag, etag_out,
+                                 NULL, NULL,
+                                 cancellable, error);
+  if (bytes == NULL)
+    return NULL;
+
+  return g_steal_pointer (&bytes);
+}
+
+static GBytes *
+flatpak_oci_registry_load_file (FlatpakOciRegistry  *self,
+                                const char *subpath,
+                                const char *etag,
+                                char **etag_out,
+                                GCancellable *cancellable,
+                                GError **error)
+{
+  if (self->dfd != -1)
+    return local_load_file (self->dfd, subpath, etag, etag_out, cancellable, error);
+  else
+    return remote_load_file (self->soup_session, self->base_uri, subpath, etag, etag_out, cancellable, error);
+}
+
+static JsonNode *
+parse_json (GBytes *bytes, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(JsonParser) parser = NULL;
+  JsonNode *root = NULL;
+
+  parser = json_parser_new ();
+  if (!json_parser_load_from_data (parser,
+                                   g_bytes_get_data (bytes, NULL),
+                                   g_bytes_get_size (bytes),
+                                   error))
+    return NULL;
+
+  root = json_parser_get_root (parser);
+  if (root == NULL || !JSON_NODE_HOLDS_OBJECT (root))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid json, no root object");
+      return NULL;
+    }
+
+  return json_node_copy (root);
+}
+
+static gboolean
+verify_oci_version (GBytes *oci_layout_bytes, gboolean *not_json, GCancellable *cancellable, GError **error)
+{
+  const char *version;
+  g_autoptr(JsonNode) node = NULL;
+  JsonObject *oci_layout;
+
+  node = parse_json (oci_layout_bytes, cancellable, error);
+  if (node == NULL)
+    {
+      *not_json = TRUE;
+      return FALSE;
+    }
+
+  *not_json = FALSE;
+  oci_layout = json_node_get_object (node);
+
+  version = json_object_get_string_member (oci_layout, "imageLayoutVersion");
+  if (version == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Unsupported oci repo: oci-layout version missing");
+      return FALSE;
+    }
+
+  if (strcmp (version, "1.0.0") != 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Unsupported existing oci-layout version %s (only 1.0.0 supported)", version);
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_oci_registry_ensure_local (FlatpakOciRegistry *self,
+                                  gboolean for_write,
+                                  GCancellable *cancellable,
+                                  GError **error)
+{
+  g_autoptr(GFile) dir = g_file_new_for_uri (self->uri);
+  glnx_autofd int local_dfd = -1;
+  int dfd;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GBytes) oci_layout_bytes = NULL;
+  gboolean not_json;
+
+  if (self->dfd != -1)
+    dfd = self->dfd;
+  else
+    {
+      if (!glnx_opendirat (AT_FDCWD, flatpak_file_get_path_cached (dir),
+                           TRUE, &local_dfd, &local_error))
+        {
+          if (for_write && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+            {
+              g_clear_error (&local_error);
+
+              if (!glnx_shutil_mkdir_p_at (AT_FDCWD, flatpak_file_get_path_cached (dir), 0755, cancellable, error))
+                return FALSE;
+
+              if (!glnx_opendirat (AT_FDCWD, flatpak_file_get_path_cached (dir),
+                                   TRUE, &local_dfd, error))
+                return FALSE;
+            }
+          else
+            {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              return FALSE;
+            }
+        }
+
+      dfd = local_dfd;
+    }
+
+  if (for_write)
+    {
+      if (!glnx_shutil_mkdir_p_at (dfd, "blobs/sha256", 0755, cancellable, error))
+        return FALSE;
+    }
+
+  oci_layout_bytes = local_load_file (dfd, "oci-layout", NULL, NULL, cancellable, &local_error);
+  if (oci_layout_bytes == NULL)
+    {
+      if (for_write && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          const char *new_layout_data = "{\"imageLayoutVersion\": \"1.0.0\"}";
+
+          g_clear_error (&local_error);
+
+          if (!glnx_file_replace_contents_at (dfd, "oci-layout",
+                                              (const guchar *)new_layout_data,
+                                              strlen (new_layout_data),
+                                              0,
+                                              cancellable, error))
+            return FALSE;
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&local_error));
+          return FALSE;
+        }
+    }
+  else if (!verify_oci_version (oci_layout_bytes, &not_json, cancellable, error))
+    return FALSE;
+
+  if (self->dfd == -1 && local_dfd != -1)
+    self->dfd = glnx_steal_fd (&local_dfd);
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_oci_registry_ensure_remote (FlatpakOciRegistry *self,
+                                   gboolean for_write,
+                                   GCancellable *cancellable,
+                                   GError **error)
+{
+  g_autoptr(SoupURI) baseuri = NULL;
+  g_autoptr(GBytes) oci_layout_bytes = NULL;
+
+  if (for_write)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Writes are not supported for remote OCI registries");
+      return FALSE;
+    }
+
+  self->soup_session = flatpak_create_soup_session (PACKAGE_STRING);
+  baseuri = soup_uri_new (self->uri);
+  if (baseuri == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                   "Invalid url %s", self->uri);
+      return FALSE;
+    }
+
+  oci_layout_bytes = remote_load_file (self->soup_session, baseuri, "oci-layout", NULL, NULL, cancellable, NULL);
+  if (oci_layout_bytes != NULL)
+    {
+      g_autoptr(GError) local_error = NULL;
+      gboolean not_json;
+
+      if (!verify_oci_version (oci_layout_bytes, &not_json, cancellable, &local_error))
+       {
+         if (not_json)
+           self->is_docker = TRUE;
+         else
+           {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+             return FALSE;
+           }
+       }
+    }
+  else
+    self->is_docker = TRUE;
+
+  self->base_uri = g_steal_pointer (&baseuri);
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_oci_registry_initable_init (GInitable     *initable,
+                                   GCancellable  *cancellable,
+                                   GError       **error)
+{
+  FlatpakOciRegistry *self = FLATPAK_OCI_REGISTRY (initable);
+  gboolean res;
+
+  if (self->tmp_dfd == -1 &&
+      !glnx_opendirat (AT_FDCWD, "/tmp", TRUE, &self->tmp_dfd, error))
+    return FALSE;
+
+  if (g_str_has_prefix (self->uri, "file:/"))
+    res = flatpak_oci_registry_ensure_local (self, self->for_write, cancellable, error);
+  else
+    res = flatpak_oci_registry_ensure_remote (self, self->for_write, cancellable, error);
+
+  if (!res)
+    return FALSE;
+
+  self->valid = TRUE;
+
+  return TRUE;
+}
+
+static void
+flatpak_oci_registry_initable_iface_init (GInitableIface *iface)
+{
+  iface->init = flatpak_oci_registry_initable_init;
+}
+
+FlatpakOciIndex *
+flatpak_oci_registry_load_index (FlatpakOciRegistry  *self,
+                                 const char           *etag,
+                                 char               **etag_out,
+                                 GCancellable       *cancellable,
+                                 GError            **error)
+{
+  g_autoptr(GBytes) bytes = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  if (etag_out)
+    *etag_out = NULL;
+
+  g_assert (self->valid);
+
+  bytes = flatpak_oci_registry_load_file (self, "index.json", etag, etag_out, cancellable, &local_error);
+  if (bytes == NULL)
+    {
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return NULL;
+    }
+
+  return (FlatpakOciIndex *)flatpak_json_from_bytes (bytes, FLATPAK_TYPE_OCI_INDEX, error);
+}
+
+gboolean
+flatpak_oci_registry_save_index (FlatpakOciRegistry  *self,
+                                 FlatpakOciIndex     *index,
+                                 GCancellable        *cancellable,
+                                 GError             **error)
+{
+  g_autoptr(GBytes) bytes = NULL;
+
+  g_assert (self->valid);
+
+  bytes = flatpak_json_to_bytes (FLATPAK_JSON (index));
+
+  if (!glnx_file_replace_contents_at (self->dfd, "index.json",
+                                      g_bytes_get_data (bytes, NULL),
+                                      g_bytes_get_size (bytes),
+                                      0, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+write_update_checksum (GOutputStream  *out,
+                       gconstpointer   data,
+                       gsize           len,
+                       gsize          *out_bytes_written,
+                       GChecksum      *checksum,
+                       GCancellable   *cancellable,
+                       GError        **error)
+{
+  if (out)
+    {
+      if (!g_output_stream_write_all (out, data, len, out_bytes_written,
+                                      cancellable, error))
+        return FALSE;
+    }
+  else if (out_bytes_written)
+    {
+      *out_bytes_written = len;
+    }
+
+  if (checksum)
+    g_checksum_update (checksum, data, len);
+
+  return TRUE;
+}
+
+static gboolean
+splice_update_checksum (GOutputStream  *out,
+                        GInputStream   *in,
+                        GChecksum      *checksum,
+                        GCancellable   *cancellable,
+                        GError        **error)
+{
+  g_return_val_if_fail (out != NULL || checksum != NULL, FALSE);
+
+  if (checksum != NULL)
+    {
+      gsize bytes_read, bytes_written;
+      char buf[4096];
+      do
+        {
+          if (!g_input_stream_read_all (in, buf, sizeof(buf), &bytes_read, cancellable, error))
+            return FALSE;
+          if (!write_update_checksum (out, buf, bytes_read, &bytes_written, checksum,
+                                      cancellable, error))
+            return FALSE;
+        }
+      while (bytes_read > 0);
+    }
+  else if (out != NULL)
+    {
+      if (g_output_stream_splice (out, in, 0, cancellable, error) < 0)
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static char *
+get_digest_subpath (FlatpakOciRegistry *self,
+                   const char *repository,
+                   gboolean is_manifest,
+                   const char *digest,
+                    GError **error)
+{
+  g_autoptr(GString) s = g_string_new ("");
+
+  if (!g_str_has_prefix (digest, "sha256:"))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Unsupported digest type %s", digest);
+      return NULL;
+    }
+
+  if (self->is_docker)
+    g_string_append (s, "v2/");
+
+  if (repository)
+    {
+      g_string_append (s, repository);
+      g_string_append (s, "/");
+    }
+
+  if (self->is_docker)
+    {
+      if (is_manifest)
+       g_string_append (s, "manifests/");
+      else
+       g_string_append (s, "blobs/");
+      g_string_append (s, digest);
+    }
+  else
+    {
+      g_string_append (s, "blobs/sha256/");
+      g_string_append (s, digest + strlen ("sha256:"));
+    }
+
+  return g_string_free (g_steal_pointer (&s), FALSE);
+}
+
+static char *
+checksum_fd (int fd, GCancellable *cancellable, GError **error)
+{
+  g_autoptr(GChecksum) checksum = NULL;
+  g_autoptr(GInputStream) in = g_unix_input_stream_new (fd, FALSE);
+
+  checksum = g_checksum_new (G_CHECKSUM_SHA256);
+
+  if (!splice_update_checksum (NULL, in, checksum, cancellable, error))
+    return NULL;
+
+  return g_strdup (g_checksum_get_string (checksum));
+}
+
+int
+flatpak_oci_registry_download_blob (FlatpakOciRegistry    *self,
+                                   const char            *repository,
+                                   gboolean               manifest,
+                                    const char            *digest,
+                                    FlatpakLoadUriProgress progress_cb,
+                                    gpointer               user_data,
+                                    GCancellable          *cancellable,
+                                    GError               **error)
+{
+  g_autofree char *subpath = NULL;
+  glnx_autofd int fd = -1;
+
+  g_assert (self->valid);
+
+  subpath = get_digest_subpath (self, repository, manifest, digest, error);
+  if (subpath == NULL)
+    return -1;
+
+  if (self->dfd != -1)
+    {
+      /* Local case, trust checksum */
+      fd = local_open_file (self->dfd, subpath, NULL, cancellable, error);
+      if (fd == -1)
+        return -1;
+    }
+  else
+    {
+      g_autoptr(SoupURI) uri = NULL;
+      g_autofree char *uri_s = NULL;
+      g_autofree char *checksum = NULL;
+      g_autofree char *tmpfile_name = g_strdup_printf ("oci-layer-XXXXXX");
+      g_autoptr(GOutputStream) out_stream = NULL;
+
+      /* remote case, download and verify */
+
+      uri = soup_uri_new_with_base (self->base_uri, subpath);
+      if (uri == NULL)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                       "Invalid relative url %s", subpath);
+          return -1;
+        }
+
+      uri_s = soup_uri_to_string (uri, FALSE);
+
+      if (!flatpak_open_in_tmpdir_at (self->tmp_dfd, 0600, tmpfile_name,
+                                      &out_stream, cancellable, error))
+        return -1;
+
+      fd = local_open_file (self->tmp_dfd, tmpfile_name, NULL, cancellable, error);
+      (void)unlinkat (self->tmp_dfd, tmpfile_name, 0);
+
+      if (fd == -1)
+        return -1;
+
+      if (!flatpak_download_http_uri (self->soup_session, uri_s,
+                                     FLATPAK_HTTP_FLAGS_ACCEPT_OCI,
+                                     out_stream,
+                                      progress_cb, user_data,
+                                      cancellable, error))
+        return -1;
+
+      if (!g_output_stream_close (out_stream, cancellable, error))
+        return -1;
+
+      checksum = checksum_fd (fd, cancellable, error);
+      if (checksum == NULL)
+        return -1;
+
+      if (strcmp (checksum, digest + strlen ("sha256:")) != 0)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Checksum digest did not match (%s != %s)", digest, checksum);
+          return -1;
+        }
+
+      lseek (fd, 0, SEEK_SET);
+    }
+
+  return glnx_steal_fd (&fd);
+}
+
+gboolean
+flatpak_oci_registry_mirror_blob (FlatpakOciRegistry    *self,
+                                  FlatpakOciRegistry    *source_registry,
+                                 const char           *repository,
+                                 gboolean              manifest,
+                                  const char            *digest,
+                                  FlatpakLoadUriProgress progress_cb,
+                                  gpointer               user_data,
+                                  GCancellable         *cancellable,
+                                  GError              **error)
+{
+  g_autofree char *src_subpath = NULL;
+  g_autofree char *dst_subpath = NULL;
+  g_auto(GLnxTmpfile) tmpf = { 0 };
+  g_autoptr(GOutputStream) out_stream = NULL;
+  struct stat stbuf;
+  g_autofree char *checksum = NULL;
+
+  g_assert (self->valid);
+
+  if (!self->for_write)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Write not supported to registry");
+      return FALSE;
+    }
+
+  src_subpath = get_digest_subpath (source_registry, repository, manifest, digest, error);
+  if (src_subpath == NULL)
+    return FALSE;
+
+  dst_subpath = get_digest_subpath (self, NULL, manifest, digest, error);
+  if (dst_subpath == NULL)
+    return FALSE;
+
+  /* Check if its already available */
+  if (fstatat (self->dfd, dst_subpath, &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
+    return TRUE;
+
+  if (!glnx_open_tmpfile_linkable_at (self->dfd, "blobs/sha256",
+                                      O_RDWR | O_CLOEXEC | O_NOCTTY,
+                                      &tmpf, error))
+    return FALSE;
+
+  if (source_registry->dfd != -1)
+    {
+      glnx_autofd int src_fd = -1;
+
+      src_fd = local_open_file (source_registry->dfd, src_subpath, NULL, cancellable, error);
+      if (src_fd == -1)
+        return FALSE;
+
+      if (glnx_regfile_copy_bytes (src_fd, tmpf.fd, (off_t)-1) < 0)
+        return glnx_throw_errno_prefix (error, "copyfile");
+    }
+  else
+    {
+      g_autoptr(SoupURI) uri = NULL;
+      g_autofree char *uri_s = NULL;
+
+      uri = soup_uri_new_with_base (source_registry->base_uri, src_subpath);
+      if (uri == NULL)
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+                       "Invalid relative url %s", src_subpath);
+          return FALSE;
+        }
+
+      out_stream = g_unix_output_stream_new (tmpf.fd, FALSE);
+
+      uri_s = soup_uri_to_string (uri, FALSE);
+      if (!flatpak_download_http_uri (source_registry->soup_session, uri_s,
+                                     FLATPAK_HTTP_FLAGS_ACCEPT_OCI, out_stream,
+                                      progress_cb, user_data,
+                                      cancellable, error))
+        return FALSE;
+
+      if (!g_output_stream_close (out_stream, cancellable, error))
+        return FALSE;
+    }
+
+  lseek (tmpf.fd, 0, SEEK_SET);
+
+  checksum = checksum_fd (tmpf.fd, cancellable, error);
+  if (checksum == NULL)
+    return FALSE;
+
+  if (strcmp (checksum, digest + strlen ("sha256:")) != 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Checksum digest did not match (%s != %s)", digest, checksum);
+      return FALSE;
+    }
+
+  if (!glnx_link_tmpfile_at (&tmpf,
+                             GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST,
+                             self->dfd, dst_subpath,
+                             error))
+    return FALSE;
+
+  return TRUE;
+}
+
+GBytes *
+flatpak_oci_registry_load_blob (FlatpakOciRegistry  *self,
+                               const char          *repository,
+                               gboolean             manifest,
+                               const char          *digest,
+                               GCancellable        *cancellable,
+                               GError             **error)
+{
+  g_autofree char *subpath = NULL;
+  g_autoptr(GBytes) bytes = NULL;
+  g_autofree char *json_checksum = NULL;
+
+  g_assert (self->valid);
+
+  subpath = get_digest_subpath (self, repository, manifest, digest, error);
+  if (subpath == NULL)
+    return NULL;
+
+  bytes = flatpak_oci_registry_load_file (self, subpath, NULL, NULL, cancellable, error);
+  if (bytes == NULL)
+    return NULL;
+
+  json_checksum = g_compute_checksum_for_bytes  (G_CHECKSUM_SHA256, bytes);
+
+  if (strcmp (json_checksum, digest + strlen ("sha256:")) != 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+                   "Checksum for digest %s is wrong (was %s)", digest, json_checksum);
+      return NULL;
+    }
+
+  return g_steal_pointer (&bytes);
+}
+
+char *
+flatpak_oci_registry_store_blob (FlatpakOciRegistry  *self,
+                                GBytes             *data,
+                                GCancellable       *cancellable,
+                                GError            **error)
+{
+  g_autofree char *sha256 = g_compute_checksum_for_bytes (G_CHECKSUM_SHA256, data);
+  g_autofree char *subpath = NULL;
+
+  g_assert (self->valid);
+
+  subpath = g_strdup_printf ("blobs/sha256/%s", sha256);
+  if (!glnx_file_replace_contents_at (self->dfd, subpath,
+                                      g_bytes_get_data (data, NULL),
+                                      g_bytes_get_size (data),
+                                      0, cancellable, error))
+    return FALSE;
+
+  return g_strdup_printf ("sha256:%s", sha256);
+}
+
+FlatpakOciDescriptor *
+flatpak_oci_registry_store_json (FlatpakOciRegistry    *self,
+                                FlatpakJson           *json,
+                                GCancellable         *cancellable,
+                                GError              **error)
+{
+  g_autoptr(GBytes) bytes = flatpak_json_to_bytes (json);
+  g_autofree char *digest = NULL;
+
+  digest = flatpak_oci_registry_store_blob (self, bytes, cancellable, error);
+  if (digest == NULL)
+    return NULL;
+
+  return flatpak_oci_descriptor_new (FLATPAK_JSON_CLASS (FLATPAK_JSON_GET_CLASS (json))->mediatype, digest, g_bytes_get_size (bytes));
+}
+
+FlatpakOciVersioned *
+flatpak_oci_registry_load_versioned (FlatpakOciRegistry  *self,
+                                    const char          *repository,
+                                     const char          *digest,
+                                     gsize               *out_size,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  g_autoptr(GBytes) bytes = NULL;
+
+  g_assert (self->valid);
+
+  bytes = flatpak_oci_registry_load_blob (self, repository, TRUE, digest, cancellable, error);
+  if (bytes == NULL)
+    return NULL;
+
+  if (out_size)
+    *out_size = g_bytes_get_size (bytes);
+  return flatpak_oci_versioned_from_json (bytes, error);
+}
+
+struct FlatpakOciLayerWriter
+{
+  GObject parent;
+
+  FlatpakOciRegistry *registry;
+
+  GChecksum *uncompressed_checksum;
+  GChecksum *compressed_checksum;
+  struct archive *archive;
+  GZlibCompressor *compressor;
+  guint64 uncompressed_size;
+  guint64 compressed_size;
+  GLnxTmpfile tmpf;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakOciLayerWriterClass;
+
+G_DEFINE_TYPE (FlatpakOciLayerWriter, flatpak_oci_layer_writer, G_TYPE_OBJECT)
+
+static gboolean
+propagate_libarchive_error (GError      **error,
+                            struct archive *a)
+{
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+               "%s", archive_error_string (a));
+  return FALSE;
+}
+
+static void
+flatpak_oci_layer_writer_reset (FlatpakOciLayerWriter *self)
+{
+  glnx_tmpfile_clear (&self->tmpf);
+
+  g_checksum_reset (self->uncompressed_checksum);
+  g_checksum_reset (self->compressed_checksum);
+
+  if (self->archive)
+    {
+      archive_write_free (self->archive);
+      self->archive = NULL;
+    }
+
+  g_clear_object (&self->compressor);
+}
+
+
+static void
+flatpak_oci_layer_writer_finalize (GObject *object)
+{
+  FlatpakOciLayerWriter *self = FLATPAK_OCI_LAYER_WRITER (object);
+
+  flatpak_oci_layer_writer_reset (self);
+
+  g_checksum_free (self->compressed_checksum);
+  g_checksum_free (self->uncompressed_checksum);
+  glnx_tmpfile_clear (&self->tmpf);
+
+  g_clear_object (&self->registry);
+
+  G_OBJECT_CLASS (flatpak_oci_layer_writer_parent_class)->finalize (object);
+}
+
+static void
+flatpak_oci_layer_writer_class_init (FlatpakOciLayerWriterClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_oci_layer_writer_finalize;
+
+}
+
+static void
+flatpak_oci_layer_writer_init (FlatpakOciLayerWriter *self)
+{
+  self->uncompressed_checksum = g_checksum_new (G_CHECKSUM_SHA256);
+  self->compressed_checksum = g_checksum_new (G_CHECKSUM_SHA256);
+}
+
+static int
+flatpak_oci_layer_writer_open_cb (struct archive *archive,
+                                 void *client_data)
+{
+  return ARCHIVE_OK;
+}
+
+static gssize
+flatpak_oci_layer_writer_compress (FlatpakOciLayerWriter *self,
+                                  const void *buffer,
+                                  size_t length,
+                                  gboolean at_end)
+{
+  guchar compressed_buffer[8192];
+  GConverterResult res;
+  gsize total_bytes_read, bytes_read, bytes_written, to_write_len;
+  guchar *to_write;
+  g_autoptr(GError) local_error = NULL;
+  GConverterFlags flags = 0;
+  bytes_read = 0;
+
+  total_bytes_read = 0;
+
+  if (at_end)
+    flags |= G_CONVERTER_INPUT_AT_END;
+
+  do
+    {
+      res = g_converter_convert (G_CONVERTER (self->compressor),
+                                 buffer, length,
+                                 compressed_buffer, sizeof (compressed_buffer),
+                                 flags, &bytes_read, &bytes_written,
+                                 &local_error);
+      if (res == G_CONVERTER_ERROR)
+        {
+          archive_set_error (self->archive, EIO, "%s", local_error->message);
+          return -1;
+        }
+
+      g_checksum_update (self->uncompressed_checksum, buffer, bytes_read);
+      g_checksum_update (self->compressed_checksum, compressed_buffer, bytes_written);
+      self->uncompressed_size += bytes_read;
+      self->compressed_size += bytes_written;
+
+      to_write_len = bytes_written;
+      to_write = compressed_buffer;
+      while (to_write_len > 0)
+        {
+          ssize_t res = write (self->tmpf.fd, to_write, to_write_len);
+          if (res <= 0)
+            {
+              if (errno == EINTR)
+                continue;
+              archive_set_error (self->archive, errno, "Write error");
+              return -1;
+            }
+
+          to_write_len -= res;
+          to_write += res;
+        }
+
+      total_bytes_read += bytes_read;
+    }
+  while ((length > 0 && bytes_read == 0) || /* Repeat if we consumed nothing */
+         (at_end && res != G_CONVERTER_FINISHED)); /* Or until finished if at_end */
+
+  return total_bytes_read;
+}
+
+static ssize_t
+flatpak_oci_layer_writer_write_cb (struct archive *archive,
+                                   void *client_data,
+                                   const void *buffer,
+                                   size_t length)
+{
+  FlatpakOciLayerWriter *self = FLATPAK_OCI_LAYER_WRITER (client_data);
+
+  return flatpak_oci_layer_writer_compress (self, buffer, length, FALSE);
+}
+
+static int
+flatpak_oci_layer_writer_close_cb (struct archive *archive,
+                                   void *client_data)
+{
+  FlatpakOciLayerWriter *self = FLATPAK_OCI_LAYER_WRITER (client_data);
+  gssize res;
+  char buffer[1] = {0};
+
+  res = flatpak_oci_layer_writer_compress (self, &buffer, 0, TRUE);
+  if (res < 0)
+    return ARCHIVE_FATAL;
+
+  return ARCHIVE_OK;
+}
+
+FlatpakOciLayerWriter *
+flatpak_oci_registry_write_layer (FlatpakOciRegistry    *self,
+                                 GCancellable         *cancellable,
+                                 GError              **error)
+{
+  g_autoptr(FlatpakOciLayerWriter) oci_layer_writer = NULL;
+  g_autoptr(FlatpakAutoArchiveWrite) a = NULL;
+  g_auto(GLnxTmpfile) tmpf = { 0 };
+
+  g_assert (self->valid);
+
+  if (!self->for_write)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Write not supported to registry");
+      return NULL;
+    }
+
+  oci_layer_writer = g_object_new (FLATPAK_TYPE_OCI_LAYER_WRITER, NULL);
+  oci_layer_writer->registry = g_object_ref (self);
+
+  if (!glnx_open_tmpfile_linkable_at (self->dfd,
+                                      "blobs/sha256",
+                                      O_WRONLY,
+                                      &tmpf,
+                                      error))
+    return NULL;
+
+  if (fchmod (tmpf.fd, 0644) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  a = archive_write_new ();
+  if (archive_write_set_format_gnutar (a) != ARCHIVE_OK ||
+      archive_write_add_filter_none (a) != ARCHIVE_OK)
+    {
+      propagate_libarchive_error (error, a);
+      return NULL;
+    }
+
+  if (archive_write_open (a, oci_layer_writer,
+                          flatpak_oci_layer_writer_open_cb,
+                          flatpak_oci_layer_writer_write_cb,
+                          flatpak_oci_layer_writer_close_cb) != ARCHIVE_OK)
+    {
+      propagate_libarchive_error (error, a);
+      return NULL;
+    }
+
+  flatpak_oci_layer_writer_reset (oci_layer_writer);
+
+  oci_layer_writer->archive = g_steal_pointer (&a);
+  /* Transfer ownership of the tmpfile */
+  oci_layer_writer->tmpf = tmpf; tmpf.initialized = 0;
+  oci_layer_writer->compressor = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP, -1);
+
+  return g_steal_pointer (&oci_layer_writer);
+}
+
+gboolean
+flatpak_oci_layer_writer_close (FlatpakOciLayerWriter  *self,
+                               char                  **uncompressed_digest_out,
+                               FlatpakOciDescriptor  **res_out,
+                               GCancellable           *cancellable,
+                               GError                **error)
+{
+  g_autofree char *path = NULL;
+
+  if (archive_write_close (self->archive) != ARCHIVE_OK)
+    return propagate_libarchive_error (error, self->archive);
+
+  path = g_strdup_printf ("blobs/sha256/%s",
+                          g_checksum_get_string (self->compressed_checksum));
+
+  if (!glnx_link_tmpfile_at (&self->tmpf,
+                             GLNX_LINK_TMPFILE_REPLACE,
+                             self->registry->dfd,
+                             path,
+                             error))
+    return FALSE;
+
+  if (uncompressed_digest_out != NULL)
+    *uncompressed_digest_out = g_strdup_printf ("sha256:%s", g_checksum_get_string (self->uncompressed_checksum));
+  if (res_out != NULL)
+    {
+      g_autofree char *digest = g_strdup_printf ("sha256:%s", g_checksum_get_string (self->compressed_checksum));
+
+      *res_out = flatpak_oci_descriptor_new (FLATPAK_OCI_MEDIA_TYPE_IMAGE_LAYER, digest, self->compressed_size);
+    }
+
+  return TRUE;
+}
+
+struct archive *
+flatpak_oci_layer_writer_get_archive (FlatpakOciLayerWriter  *self)
+{
+  return self->archive;
+}
+
+typedef struct {
+  int fd;
+  GChecksum *checksum;
+  char buffer[16*1024];
+} FlatpakArchiveReadWithChecksum;
+
+static int
+checksum_open_cb (struct archive *a, void *user_data)
+{
+  return ARCHIVE_OK;
+}
+
+
+static ssize_t
+checksum_read_cb (struct archive *a, void *user_data, const void **buff)
+{
+  FlatpakArchiveReadWithChecksum *data = user_data;
+  ssize_t bytes_read;
+
+  *buff = &data->buffer;
+  do
+    bytes_read = read (data->fd, &data->buffer, sizeof (data->buffer));
+  while (G_UNLIKELY (bytes_read == -1 && errno == EINTR));
+
+  if (bytes_read < 0)
+    {
+      archive_set_error (a, errno, "Read error on fd %d", data->fd);
+      return -1;
+    }
+
+  g_checksum_update (data->checksum, (guchar *)data->buffer, bytes_read);
+
+  return bytes_read;
+}
+
+static int64_t
+checksum_skip_cb (struct archive *a, void *user_data, int64_t request)
+{
+  FlatpakArchiveReadWithChecksum *data = user_data;
+  int64_t old_offset, new_offset;
+
+  if (((old_offset = lseek (data->fd, 0, SEEK_CUR)) >= 0) &&
+      ((new_offset = lseek (data->fd, request, SEEK_CUR)) >= 0))
+    return new_offset - old_offset;
+
+  archive_set_error (a, errno, "Error seeking");
+  return -1;
+}
+
+static int
+checksum_close_cb (struct archive *a, void *user_data)
+{
+  FlatpakArchiveReadWithChecksum *data = user_data;
+
+  g_free (data);
+
+  return ARCHIVE_OK;
+}
+
+gboolean
+flatpak_archive_read_open_fd_with_checksum (struct archive *a,
+                                            int fd,
+                                            GChecksum *checksum,
+                                            GError **error)
+{
+  FlatpakArchiveReadWithChecksum *data = g_new0 (FlatpakArchiveReadWithChecksum, 1);
+
+  data->fd = fd;
+  data->checksum = checksum;
+
+  if (archive_read_open2 (a, data,
+                          checksum_open_cb,
+                          checksum_read_cb,
+                          checksum_skip_cb,
+                          checksum_close_cb) != ARCHIVE_OK)
+    return propagate_libarchive_error (error, a);
+
+  return TRUE;
+}
+
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(gpgme_data_t, gpgme_data_release, NULL)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(gpgme_ctx_t, gpgme_release, NULL)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(gpgme_key_t, gpgme_key_unref, NULL)
+
+static void
+flatpak_gpgme_error_to_gio_error (gpgme_error_t   gpg_error,
+                                  GError        **error)
+{
+  GIOErrorEnum errcode;
+
+  /* XXX This list is incomplete.  Add cases as needed. */
+
+  switch (gpgme_err_code (gpg_error))
+    {
+      /* special case - shouldn't be here */
+      case GPG_ERR_NO_ERROR:
+        g_return_if_reached ();
+
+      /* special case - abort on out-of-memory */
+      case GPG_ERR_ENOMEM:
+        g_error ("%s: out of memory",
+                 gpgme_strsource (gpg_error));
+
+      case GPG_ERR_INV_VALUE:
+        errcode = G_IO_ERROR_INVALID_ARGUMENT;
+        break;
+
+      default:
+        errcode = G_IO_ERROR_FAILED;
+        break;
+    }
+
+  g_set_error (error, G_IO_ERROR, errcode, "%s: error code %d",
+               gpgme_strsource (gpg_error), gpgme_err_code (gpg_error));
+}
+
+/**** The functions below are based on seahorse-gpgme-data.c ****/
+
+static void
+set_errno_from_gio_error (GError *error)
+{
+  /* This is the reverse of g_io_error_from_errno() */
+
+  g_return_if_fail (error != NULL);
+
+  switch (error->code)
+    {
+      case G_IO_ERROR_FAILED:
+        errno = EIO;
+        break;
+      case G_IO_ERROR_NOT_FOUND:
+        errno = ENOENT;
+        break;
+      case G_IO_ERROR_EXISTS:
+        errno = EEXIST;
+        break;
+      case G_IO_ERROR_IS_DIRECTORY:
+        errno = EISDIR;
+        break;
+      case G_IO_ERROR_NOT_DIRECTORY:
+        errno = ENOTDIR;
+        break;
+      case G_IO_ERROR_NOT_EMPTY:
+        errno = ENOTEMPTY;
+        break;
+      case G_IO_ERROR_NOT_REGULAR_FILE:
+      case G_IO_ERROR_NOT_SYMBOLIC_LINK:
+      case G_IO_ERROR_NOT_MOUNTABLE_FILE:
+        errno = EBADF;
+        break;
+      case G_IO_ERROR_FILENAME_TOO_LONG:
+        errno = ENAMETOOLONG;
+        break;
+      case G_IO_ERROR_INVALID_FILENAME:
+        errno = EINVAL;
+        break;
+      case G_IO_ERROR_TOO_MANY_LINKS:
+        errno = EMLINK;
+        break;
+      case G_IO_ERROR_NO_SPACE:
+        errno = ENOSPC;
+        break;
+      case G_IO_ERROR_INVALID_ARGUMENT:
+        errno = EINVAL;
+        break;
+      case G_IO_ERROR_PERMISSION_DENIED:
+        errno = EPERM;
+        break;
+      case G_IO_ERROR_NOT_SUPPORTED:
+        errno = ENOTSUP;
+        break;
+      case G_IO_ERROR_NOT_MOUNTED:
+        errno = ENOENT;
+        break;
+      case G_IO_ERROR_ALREADY_MOUNTED:
+        errno = EALREADY;
+        break;
+      case G_IO_ERROR_CLOSED:
+        errno = EBADF;
+        break;
+      case G_IO_ERROR_CANCELLED:
+        errno = EINTR;
+        break;
+      case G_IO_ERROR_PENDING:
+        errno = EALREADY;
+        break;
+      case G_IO_ERROR_READ_ONLY:
+        errno = EACCES;
+        break;
+      case G_IO_ERROR_CANT_CREATE_BACKUP:
+        errno = EIO;
+        break;
+      case G_IO_ERROR_WRONG_ETAG:
+        errno = EACCES;
+        break;
+      case G_IO_ERROR_TIMED_OUT:
+        errno = EIO;
+        break;
+      case G_IO_ERROR_WOULD_RECURSE:
+        errno = ELOOP;
+        break;
+      case G_IO_ERROR_BUSY:
+        errno = EBUSY;
+        break;
+      case G_IO_ERROR_WOULD_BLOCK:
+        errno = EWOULDBLOCK;
+        break;
+      case G_IO_ERROR_HOST_NOT_FOUND:
+        errno = EHOSTDOWN;
+        break;
+      case G_IO_ERROR_WOULD_MERGE:
+        errno = EIO;
+        break;
+      case G_IO_ERROR_FAILED_HANDLED:
+        errno = 0;
+        break;
+      default:
+        errno = EIO;
+        break;
+    }
+}
+
+static ssize_t
+data_write_cb (void *handle, const void *buffer, size_t size)
+{
+  GOutputStream *output_stream = handle;
+  gsize bytes_written;
+  GError *local_error = NULL;
+
+  g_return_val_if_fail (G_IS_OUTPUT_STREAM (output_stream), -1);
+
+  if (g_output_stream_write_all (output_stream, buffer, size,
+                                 &bytes_written, NULL, &local_error))
+    {
+      g_output_stream_flush (output_stream, NULL, &local_error);
+    }
+
+  if (local_error != NULL)
+    {
+      set_errno_from_gio_error (local_error);
+      g_clear_error (&local_error);
+      bytes_written = -1;
+    }
+
+  return bytes_written;
+}
+
+static off_t
+data_seek_cb (void *handle, off_t offset, int whence)
+{
+  GObject *stream = handle;
+  GSeekable *seekable;
+  GSeekType seek_type = 0;
+  off_t position = -1;
+  GError *local_error = NULL;
+
+  g_return_val_if_fail (G_IS_INPUT_STREAM (stream) ||
+                        G_IS_OUTPUT_STREAM (stream), -1);
+
+  if (!G_IS_SEEKABLE (stream)) {
+    errno = EOPNOTSUPP;
+    goto out;
+  }
+
+  switch (whence)
+    {
+      case SEEK_SET:
+        seek_type = G_SEEK_SET;
+        break;
+      case SEEK_CUR:
+        seek_type = G_SEEK_CUR;
+        break;
+      case SEEK_END:
+        seek_type = G_SEEK_END;
+        break;
+      default:
+        g_assert_not_reached ();
+    }
+
+  seekable = G_SEEKABLE (stream);
+
+  if (!g_seekable_seek (seekable, offset, seek_type, NULL, &local_error))
+    {
+      set_errno_from_gio_error (local_error);
+      g_clear_error (&local_error);
+      goto out;
+    }
+
+  position = g_seekable_tell (seekable);
+
+out:
+  return position;
+}
+
+static void
+data_release_cb (void *handle)
+{
+  GObject *stream = handle;
+
+  g_return_if_fail (G_IS_INPUT_STREAM (stream) ||
+                    G_IS_OUTPUT_STREAM (stream));
+
+  g_object_unref (stream);
+}
+
+static struct gpgme_data_cbs data_output_cbs = {
+  NULL,
+  data_write_cb,
+  data_seek_cb,
+  data_release_cb
+};
+
+static gpgme_data_t
+flatpak_gpgme_data_output (GOutputStream *output_stream)
+{
+  gpgme_data_t data = NULL;
+  gpgme_error_t gpg_error;
+
+  g_return_val_if_fail (G_IS_OUTPUT_STREAM (output_stream), NULL);
+
+  gpg_error = gpgme_data_new_from_cbs (&data, &data_output_cbs, output_stream);
+
+  /* The only possible error is ENOMEM, which we abort on. */
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      g_assert (gpgme_err_code (gpg_error) == GPG_ERR_ENOMEM);
+      flatpak_gpgme_error_to_gio_error (gpg_error, NULL);
+      g_assert_not_reached ();
+    }
+
+  g_object_ref (output_stream);
+
+  return data;
+}
+
+static gpgme_ctx_t
+flatpak_gpgme_new_ctx (const char *homedir,
+                       GError **error)
+{
+  gpgme_error_t err;
+  g_auto(gpgme_ctx_t) context = NULL;
+
+  if ((err = gpgme_new (&context)) != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (err, error);
+      g_prefix_error (error, "Unable to create gpg context: ");
+      return NULL;
+    }
+
+  if (homedir != NULL)
+    {
+      gpgme_engine_info_t info;
+
+      info = gpgme_ctx_get_engine_info (context);
+
+      if ((err = gpgme_ctx_set_engine_info (context, info->protocol, NULL, homedir))
+          != GPG_ERR_NO_ERROR)
+        {
+          flatpak_gpgme_error_to_gio_error (err, error);
+          g_prefix_error (error, "Unable to set gpg homedir to '%s': ",
+                          homedir);
+          return NULL;
+        }
+    }
+
+  return g_steal_pointer (&context);
+}
+
+GBytes *
+flatpak_oci_sign_data (GBytes *data,
+                       const gchar **key_ids,
+                       const char *homedir,
+                       GError **error)
+{
+  g_auto(GLnxTmpfile) tmpf = { 0 };
+  g_autoptr(GOutputStream) tmp_signature_output = NULL;
+  g_auto(gpgme_ctx_t) context = NULL;
+  gpgme_error_t err;
+  g_auto(gpgme_data_t) commit_buffer = NULL;
+  g_auto(gpgme_data_t) signature_buffer = NULL;
+  g_autoptr(GMappedFile) signature_file = NULL;
+  int i;
+
+  if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, "/tmp", O_RDWR | O_CLOEXEC,
+                                      &tmpf, error))
+    return NULL;
+
+  tmp_signature_output = g_unix_output_stream_new (tmpf.fd, FALSE);
+
+  context = flatpak_gpgme_new_ctx (homedir, error);
+  if (!context)
+    return NULL;
+
+  for (i = 0; key_ids[i] != NULL; i++)
+    {
+      g_auto(gpgme_key_t) key = NULL;
+
+      /* Get the secret keys with the given key id */
+      err = gpgme_get_key (context, key_ids[i], &key, 1);
+      if (gpgme_err_code (err) == GPG_ERR_EOF)
+        {
+          flatpak_fail (error,"No gpg key found with ID %s (homedir: %s)", key_ids[i],
+                        homedir ? homedir : "<default>");
+          return NULL;
+        }
+      else if (err != GPG_ERR_NO_ERROR)
+        {
+          flatpak_fail (error, "Unable to lookup key ID %s: %d)", key_ids[i], err);
+          return NULL;
+        }
+
+      /* Add the key to the context as a signer */
+      if ((err = gpgme_signers_add (context, key)) != GPG_ERR_NO_ERROR)
+        {
+          flatpak_fail (error, "Error signing commit: %d", err);
+          return NULL;
+        }
+    }
+
+  {
+    gsize len;
+    const char *buf = g_bytes_get_data (data, &len);
+    if ((err = gpgme_data_new_from_mem (&commit_buffer, buf, len, FALSE)) != GPG_ERR_NO_ERROR)
+      {
+        flatpak_gpgme_error_to_gio_error (err, error);
+        g_prefix_error (error, "Failed to create buffer from commit file: ");
+        return NULL;
+      }
+  }
+
+  signature_buffer = flatpak_gpgme_data_output (tmp_signature_output);
+
+  if ((err = gpgme_op_sign (context, commit_buffer, signature_buffer, GPGME_SIG_MODE_NORMAL))
+      != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (err, error);
+      g_prefix_error (error, "Failure signing commit file: ");
+      return NULL;
+    }
+
+  if (!g_output_stream_close (tmp_signature_output, NULL, error))
+    return NULL;
+
+  signature_file = g_mapped_file_new_from_fd (tmpf.fd, FALSE, error);
+  if (!signature_file)
+    return NULL;
+
+  return g_mapped_file_get_bytes (signature_file);
+}
+
+static gboolean
+signature_is_valid (gpgme_signature_t signature)
+{
+  /* Mimic the way librepo tests for a valid signature, checking both
+   * summary and status fields.
+   *
+   * - VALID summary flag means the signature is fully valid.
+   * - GREEN summary flag means the signature is valid with caveats.
+   * - No summary but also no error means the signature is valid but
+   *   the signing key is not certified with a trusted signature.
+   */
+  return (signature->summary & GPGME_SIGSUM_VALID) ||
+         (signature->summary & GPGME_SIGSUM_GREEN) ||
+         (signature->summary == 0 && signature->status == GPG_ERR_NO_ERROR);
+}
+
+static GString *
+read_gpg_buffer (gpgme_data_t buffer, GError **error)
+{
+  g_autoptr(GString) res = g_string_new ("");
+  char buf[1024];
+  int ret;
+
+  ret = gpgme_data_seek (buffer, 0, SEEK_SET);
+  if (ret)
+    {
+      flatpak_fail (error, "Can't seek in gpg plain text");
+      return NULL;
+    }
+  while ((ret = gpgme_data_read (buffer, buf, sizeof(buf)-1)) > 0)
+    g_string_append_len (res, buf, ret);
+  if (ret < 0)
+    {
+      flatpak_fail (error, "Can't read in gpg plain text");
+      return NULL;
+    }
+
+  return g_steal_pointer (&res);
+}
+
+static gboolean
+flatpak_gpgme_ctx_tmp_home_dir (gpgme_ctx_t     gpgme_ctx,
+                                GLnxTmpDir     *tmpdir,
+                                OstreeRepo     *repo,
+                                const char     *remote_name,
+                                GCancellable   *cancellable,
+                                GError        **error)
+{
+  g_autofree char *tmp_home_dir_pattern = NULL;
+  gpgme_error_t gpg_error;
+  g_autoptr(GFile) keyring_file = NULL;
+  g_autofree char *keyring_name = NULL;
+
+  g_return_val_if_fail (gpgme_ctx != NULL, FALSE);
+
+  /* GPGME has no API for using multiple keyrings (aka, gpg --keyring),
+   * so we create a temporary directory and tell GPGME to use it as the
+   * home directory.  Then (optionally) create a pubring.gpg file there
+   * and hand the caller an open output stream to concatenate necessary
+   * keyring files. */
+
+  tmp_home_dir_pattern = g_build_filename (g_get_tmp_dir (), "flatpak-gpg-XXXXXX", NULL);
+
+  if (!glnx_mkdtempat (AT_FDCWD, tmp_home_dir_pattern, 0700,
+                       tmpdir, error))
+    return FALSE;
+
+  /* Not documented, but gpgme_ctx_set_engine_info() accepts NULL for
+   * the executable file name, which leaves the old setting unchanged. */
+  gpg_error = gpgme_ctx_set_engine_info (gpgme_ctx,
+                                         GPGME_PROTOCOL_OpenPGP,
+                                         NULL, tmpdir->path);
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (gpg_error, error);
+      return FALSE;
+    }
+
+  keyring_name = g_strdup_printf ("%s.trustedkeys.gpg", remote_name);
+  keyring_file = g_file_get_child (ostree_repo_get_path (repo), keyring_name);
+
+  if (g_file_query_exists (keyring_file, NULL) &&
+      !glnx_file_copy_at (AT_FDCWD, flatpak_file_get_path_cached (keyring_file), NULL,
+                          tmpdir->fd, "pubring.gpg",
+                          GLNX_FILE_COPY_OVERWRITE | GLNX_FILE_COPY_NOXATTRS,
+                          cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+FlatpakOciSignature *
+flatpak_oci_verify_signature (OstreeRepo *repo,
+                              const char *remote_name,
+                              GBytes *signed_data,
+                              GError **error)
+{
+  gpgme_ctx_t context;
+  gpgme_error_t gpg_error;
+  g_auto(gpgme_data_t) signed_data_buffer = NULL;
+  g_auto(gpgme_data_t) plain_buffer = NULL;
+  gpgme_verify_result_t vresult;
+  gpgme_signature_t sig;
+  int valid_count;
+  g_autoptr(GString) plain = NULL;
+  g_autoptr(GBytes) plain_bytes = NULL;
+  g_autoptr(FlatpakJson) json = NULL;
+  g_auto(GLnxTmpDir) tmp_home_dir = { 0, };
+
+  gpg_error = gpgme_new (&context);
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (gpg_error, error);
+      g_prefix_error (error, "Unable to create context: ");
+      return NULL;
+    }
+
+  if (!flatpak_gpgme_ctx_tmp_home_dir (context, &tmp_home_dir, repo, remote_name, NULL, error))
+    return NULL;
+
+  gpg_error = gpgme_data_new_from_mem (&signed_data_buffer,
+                                       g_bytes_get_data (signed_data, NULL),
+                                       g_bytes_get_size (signed_data),
+                                       0 /* do not copy */);
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (gpg_error, error);
+      g_prefix_error (error, "Unable to read signed data: ");
+      return NULL;
+    }
+
+  gpg_error = gpgme_data_new (&plain_buffer);
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (gpg_error, error);
+      g_prefix_error (error, "Unable to allocate plain buffer: ");
+      return NULL;
+    }
+
+  gpg_error = gpgme_op_verify (context, signed_data_buffer, NULL, plain_buffer);
+  if (gpg_error != GPG_ERR_NO_ERROR)
+    {
+      flatpak_gpgme_error_to_gio_error (gpg_error, error);
+      g_prefix_error (error, "Unable to complete signature verification: ");
+      return NULL;
+    }
+
+  vresult = gpgme_op_verify_result (context);
+
+  valid_count = 0;
+  for (sig = vresult->signatures; sig != NULL; sig = sig->next)
+    {
+      if (signature_is_valid (sig))
+        valid_count++;
+    }
+
+  if (valid_count == 0)
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "GPG signatures found, but none are in trusted keyring");
+      return FALSE;
+    }
+
+  plain = read_gpg_buffer (plain_buffer, error);
+  if (plain == NULL)
+    return NULL;
+  plain_bytes = g_string_free_to_bytes (g_steal_pointer (&plain));
+  json = flatpak_json_from_bytes (plain_bytes, FLATPAK_TYPE_OCI_SIGNATURE, error);
+  if (json == NULL)
+    return FALSE;
+
+  return g_steal_pointer (&json);
+}
+
+static const char *
+get_image_ref (FlatpakOciIndexImage *img)
+{
+  return g_hash_table_lookup (img->annotations, "org.flatpak.ref");
+}
+
+typedef struct {
+  char *repository;
+  FlatpakOciIndexImage *image;
+} ImageInfo;
+
+static gint
+compare_image_by_ref (ImageInfo *a,
+                      ImageInfo *b)
+{
+  const char *a_ref = get_image_ref (a->image);
+  const char *b_ref = get_image_ref (b->image);
+
+  return g_strcmp0 (a_ref, b_ref);
+}
+
+GVariant *
+flatpak_oci_index_fetch_summary (SoupSession *soup_session,
+                                 const char *uri,
+                                 const char *etag,
+                                 GCancellable *cancellable,
+                                 GError **error)
+{
+  g_autoptr(GBytes) res = NULL;
+  g_autofree char *new_etag = NULL;
+  g_autoptr(FlatpakJson) json = NULL;
+  FlatpakOciIndexResponse *response;
+  g_autoptr(SoupURI) registry_uri = NULL;
+  g_autofree char *registry_uri_s = NULL;
+  int i;
+  g_autoptr(GArray) images = g_array_new (FALSE, TRUE, sizeof (ImageInfo));
+  g_autoptr(GVariantBuilder) refs_builder = NULL;
+  g_autoptr(GVariantBuilder) additional_metadata_builder = NULL;
+  g_autoptr(GVariantBuilder) summary_builder = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  g_autoptr(GVariantBuilder) ref_data_builder = NULL;
+  g_autoptr(GString) index_uri = g_string_new (uri);
+  g_autoptr(SoupURI) soup_uri = NULL;
+  g_autofree char *query_uri = NULL;
+
+  if (!g_str_has_suffix (index_uri->str, "/"))
+    g_string_append_c (index_uri, '/');
+
+  if (!g_str_has_suffix (uri, "/index/"))
+    g_string_append (index_uri, "index/");
+
+  g_string_append (index_uri, "/static");
+  soup_uri = soup_uri_new (index_uri->str);
+  soup_uri_set_query_from_fields (soup_uri,
+                                 "os", "linux",
+                                 "tag", "latest",
+                                 "annotation:org.flatpak.ref:exists", "1",
+                                 NULL);
+  query_uri = soup_uri_to_string (soup_uri, FALSE);
+
+  res = flatpak_load_http_uri (soup_session,
+                               query_uri,
+                               0, etag,
+                               &new_etag, NULL, NULL,
+                               cancellable, error);
+  if (res == NULL)
+    return NULL;
+
+  json = flatpak_json_from_bytes (res, FLATPAK_TYPE_OCI_INDEX_RESPONSE, error);
+  if (json == NULL)
+    return NULL;
+
+  response = (FlatpakOciIndexResponse *)json;
+
+  registry_uri = soup_uri_new_with_base (soup_uri, response->registry);
+  registry_uri_s = soup_uri_to_string (registry_uri, FALSE);
+
+  for (i = 0; response->results != NULL && response->results[i] != NULL; i++)
+    {
+      FlatpakOciIndexRepository *r = response->results[i];
+      int j;
+      ImageInfo info = { r->name };
+
+      for (j = 0; r->images != NULL && r->images[j] != NULL; j++)
+       {
+         info.image = r->images[j];
+         g_array_append_val (images, info);
+       }
+
+      for (j = 0; r->lists != NULL && r->lists[j] != NULL; j++)
+        {
+          FlatpakOciIndexImageList *list =  r->lists[j];
+          int k;
+
+          for (k = 0; list->images != NULL && list->images[k] != NULL; k++)
+           {
+             info.image = list->images[k];
+             g_array_append_val (images, info);
+           }
+        }
+    }
+
+  refs_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(s(taya{sv}))"));
+  ref_data_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{s(tts)}"));
+  additional_metadata_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+
+  /* The summary has to be sorted by ref */
+  g_array_sort (images, (GCompareFunc)compare_image_by_ref);
+
+  for (i = 0; i < images->len; i++)
+    {
+      ImageInfo *info = &g_array_index (images, ImageInfo, i);
+      FlatpakOciIndexImage *image = info->image;
+      const char *ref = get_image_ref (image);
+      const char *fake_commit;
+      guint64 installed_size = 0;
+      guint64 download_size = 0;
+      const char *installed_size_str;
+      const char *download_size_str;
+      const char *metadata_contents = NULL;
+      g_autoptr(GVariantBuilder) ref_metadata_builder = NULL;
+
+      if (ref == NULL)
+        continue;
+
+      metadata_contents = g_hash_table_lookup (image->annotations, "org.flatpak.metadata");
+      if (metadata_contents == NULL && !g_str_has_prefix (ref, "appstream/"))
+        continue; /* Not a flatpak, skip */
+
+      if (!g_str_has_prefix (image->digest, "sha256:"))
+        {
+          g_debug ("Ignoring digest type %s", image->digest);
+          continue;
+        }
+
+      fake_commit = image->digest + strlen ("sha256:");
+
+      installed_size_str = g_hash_table_lookup (image->annotations, "org.flatpak.installed-size");
+      if (installed_size_str)
+        installed_size = g_ascii_strtoull (installed_size_str, NULL, 10);
+
+      download_size_str = g_hash_table_lookup (image->annotations, "org.flatpak.download-size");
+      if (download_size_str)
+        download_size = g_ascii_strtoull (download_size_str, NULL, 10);
+
+      ref_metadata_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+
+      g_variant_builder_add (ref_metadata_builder, "{sv}", "xa.oci-repository",
+                            g_variant_new_string (info->repository));
+
+      g_variant_builder_add_value (refs_builder,
+                                   g_variant_new ("(s(t@ay@a{sv}))", ref,
+                                                  0,
+                                                  ostree_checksum_to_bytes_v (fake_commit),
+                                                  g_variant_builder_end (ref_metadata_builder)));
+      g_variant_builder_add (ref_data_builder, "{s(tts)}",
+                             ref,
+                             GUINT64_TO_BE (installed_size),
+                             GUINT64_TO_BE (download_size),
+                             metadata_contents ? metadata_contents : "");
+    }
+
+  g_variant_builder_add (additional_metadata_builder, "{sv}", "xa.cache",
+                         g_variant_new_variant (g_variant_builder_end (ref_data_builder)));
+  if (new_etag)
+    g_variant_builder_add (additional_metadata_builder, "{sv}", "xa.oci-etag",
+                           g_variant_new_string (new_etag));
+
+  g_variant_builder_add (additional_metadata_builder, "{sv}", "xa.oci-registry-uri",
+                         g_variant_new_string (registry_uri_s));
+
+  summary_builder = g_variant_builder_new (OSTREE_SUMMARY_GVARIANT_FORMAT);
+
+  g_variant_builder_add_value (summary_builder, g_variant_builder_end (refs_builder));
+  g_variant_builder_add_value (summary_builder, g_variant_builder_end (additional_metadata_builder));
+
+  summary = g_variant_ref_sink (g_variant_builder_end (summary_builder));
+
+  return g_steal_pointer (&summary);
+}
+
+gboolean
+flatpak_oci_index_verify_ref (SoupSession *soup_session,
+                             const char *uri,
+                             const char *ref,
+                             const char *digest,
+                             GCancellable *cancellable,
+                             GError **error)
+{
+  g_autoptr(GBytes) res = NULL;
+  g_autoptr(FlatpakJson) json = NULL;
+  g_autoptr(SoupURI) soup_uri = NULL;
+  g_autofree char *query_uri = NULL;
+
+  FlatpakOciIndexResponse *response;
+  int i;
+  g_autoptr(GString) index_uri = g_string_new (uri);
+
+  if (!g_str_has_suffix (index_uri->str, "/"))
+    g_string_append_c (index_uri, '/');
+
+  if (!g_str_has_suffix (uri, "/index/"))
+    g_string_append (index_uri, "index/");
+
+  g_string_append (index_uri, "/dynamic");
+
+  soup_uri = soup_uri_new (index_uri->str);
+  soup_uri_set_query_from_fields (soup_uri,
+                                 "os", "linux",
+                                 "annotation:org.flatpak.ref", ref,
+                                 NULL);
+  query_uri = soup_uri_to_string (soup_uri, FALSE);
+
+  res = flatpak_load_http_uri (soup_session,
+                               query_uri,
+                               0, NULL, NULL, NULL, NULL,
+                               cancellable, error);
+  if (res == NULL)
+    return FALSE;
+
+  json = flatpak_json_from_bytes (res, FLATPAK_TYPE_OCI_INDEX_RESPONSE, error);
+  if (json == NULL)
+    return FALSE;
+
+  response = (FlatpakOciIndexResponse *)json;
+
+  for (i = 0; response->results != NULL && response->results[i] != NULL; i++)
+    {
+      FlatpakOciIndexRepository *r = response->results[i];
+      int j;
+
+      for (j = 0; r->images != NULL && r->images[j] != NULL; j++)
+       {
+         FlatpakOciIndexImage *image = r->images[j];
+         const char *image_ref = get_image_ref (image);
+         if (image_ref != NULL &&
+             g_strcmp0 (image_ref, ref) == 0 &&
+             g_strcmp0 (digest, image->digest) == 0)
+           return TRUE;
+       }
+
+      for (j = 0; r->lists != NULL && r->lists[j] != NULL; j++)
+        {
+          FlatpakOciIndexImageList *list =  r->lists[j];
+          int k;
+
+          for (k = 0; list->images != NULL && list->images[k] != NULL; k++)
+           {
+             FlatpakOciIndexImage *image = list->images[k];
+             const char *image_ref = get_image_ref (image);
+             if (image_ref != NULL &&
+                 g_strcmp0 (image_ref, ref) == 0 &&
+                 g_strcmp0 (digest, image->digest) == 0)
+               return TRUE;
+           }
+        }
+    }
+
+  return flatpak_fail (error, "No matching image for %s\n", ref);
+}
diff --git a/common/flatpak-oci-registry.h b/common/flatpak-oci-registry.h
new file mode 100644 (file)
index 0000000..c430c91
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2016 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_OCI_REGISTRY_H__
+#define __FLATPAK_OCI_REGISTRY_H__
+
+#include "libglnx/libglnx.h"
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <archive.h>
+#include "flatpak-json-oci.h"
+#include "flatpak-utils.h"
+
+#define FLATPAK_TYPE_OCI_REGISTRY flatpak_oci_registry_get_type ()
+#define FLATPAK_OCI_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_OCI_REGISTRY, FlatpakOciRegistry))
+#define FLATPAK_IS_OCI_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_OCI_REGISTRY))
+
+GType flatpak_oci_registry_get_type (void);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakOciRegistry, g_object_unref)
+
+#define FLATPAK_TYPE_OCI_LAYER_WRITER flatpak_oci_layer_writer_get_type ()
+#define FLATPAK_OCI_LAYER_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_OCI_LAYER_WRITER, FlatpakOciLayerWriter))
+#define FLATPAK_IS_OCI_LAYER_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_OCI_LAYER_WRITER))
+
+GType flatpak_oci_layer_writer_get_type (void);
+
+typedef enum {
+  FLATPAK_OCI_ERROR_NOT_CHANGED = 0,
+} FlatpakOciErrorEnum;
+
+#define FLATPAK_OCI_ERROR flatpak_oci_error_quark ()
+
+FLATPAK_EXTERN GQuark  flatpak_oci_error_quark (void);
+
+typedef struct FlatpakOciLayerWriter FlatpakOciLayerWriter;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakOciLayerWriter, g_object_unref)
+
+FlatpakOciRegistry  *  flatpak_oci_registry_new                  (const char           *uri,
+                                                                  gboolean              for_write,
+                                                                  int                   tmp_dfd,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+const char          *  flatpak_oci_registry_get_uri              (FlatpakOciRegistry   *self);
+FlatpakOciIndex     *  flatpak_oci_registry_load_index           (FlatpakOciRegistry   *self,
+                                                                  const char           *etag,
+                                                                  char               **etag_out,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+gboolean               flatpak_oci_registry_save_index           (FlatpakOciRegistry   *self,
+                                                                  FlatpakOciIndex      *index,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+int                    flatpak_oci_registry_download_blob        (FlatpakOciRegistry   *self,
+                                                                  const char           *repository,
+                                                                 gboolean              manifest,
+                                                                  const char           *digest,
+                                                                  FlatpakLoadUriProgress progress_cb,
+                                                                  gpointer               user_data,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+GBytes             *   flatpak_oci_registry_load_blob            (FlatpakOciRegistry   *self,
+                                                                  const char           *repository,
+                                                                 gboolean              manifest,
+                                                                  const char           *digest,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+char *                 flatpak_oci_registry_store_blob           (FlatpakOciRegistry   *self,
+                                                                  GBytes               *data,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+gboolean               flatpak_oci_registry_mirror_blob          (FlatpakOciRegistry   *self,
+                                                                  FlatpakOciRegistry   *source_registry,
+                                                                  const char           *repository,
+                                                                 gboolean              manifest,
+                                                                  const char           *digest,
+                                                                  FlatpakLoadUriProgress progress_cb,
+                                                                  gpointer               user_data,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+FlatpakOciDescriptor * flatpak_oci_registry_store_json           (FlatpakOciRegistry   *self,
+                                                                  FlatpakJson          *json,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+FlatpakOciVersioned *  flatpak_oci_registry_load_versioned       (FlatpakOciRegistry   *self,
+                                                                  const char           *repository,
+                                                                  const char           *digest,
+                                                                  gsize                *out_size,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+FlatpakOciLayerWriter *flatpak_oci_registry_write_layer          (FlatpakOciRegistry   *self,
+                                                                  GCancellable         *cancellable,
+                                                                  GError              **error);
+
+struct archive *flatpak_oci_layer_writer_get_archive (FlatpakOciLayerWriter  *self);
+gboolean        flatpak_oci_layer_writer_close       (FlatpakOciLayerWriter  *self,
+                                                      char                 **uncompressed_digest_out,
+                                                      FlatpakOciDescriptor **res_out,
+                                                      GCancellable          *cancellable,
+                                                      GError               **error);
+
+gboolean flatpak_archive_read_open_fd_with_checksum (struct archive *a,
+                                                     int fd,
+                                                     GChecksum *checksum,
+                                                     GError **error);
+
+GBytes *flatpak_oci_sign_data (GBytes *data,
+                               const gchar **okey_ids,
+                               const char *homedir,
+                               GError **error);
+
+FlatpakOciSignature *flatpak_oci_verify_signature (OstreeRepo *repo,
+                                                   const char *remote_name,
+                                                   GBytes *signature,
+                                                   GError **error);
+
+GVariant *flatpak_oci_index_fetch_summary (SoupSession *soup_session,
+                                           const char *uri,
+                                           const char *etag,
+                                           GCancellable *cancellable,
+                                           GError **error);
+
+gboolean flatpak_oci_index_verify_ref (SoupSession *soup_session,
+                                      const char *uri,
+                                      const char *ref,
+                                      const char *digest,
+                                      GCancellable *cancellable,
+                                      GError **error);
+
+#endif /* __FLATPAK_OCI_REGISTRY_H__ */
diff --git a/common/flatpak-portal-error.c b/common/flatpak-portal-error.c
new file mode 100644 (file)
index 0000000..1389707
--- /dev/null
@@ -0,0 +1,48 @@
+/* flatpak-error.c
+ *
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-portal-error.h"
+
+#include <gio/gio.h>
+
+static const GDBusErrorEntry flatpak_error_entries[] = {
+  {FLATPAK_PORTAL_ERROR_FAILED,                           "org.freedesktop.portal.Error.Failed"},
+  {FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,                 "org.freedesktop.portal.Error.InvalidArgument"},
+  {FLATPAK_PORTAL_ERROR_NOT_FOUND,                        "org.freedesktop.portal.Error.NotFound"},
+  {FLATPAK_PORTAL_ERROR_EXISTS,                           "org.freedesktop.portal.Error.Exists"},
+  {FLATPAK_PORTAL_ERROR_NOT_ALLOWED,                      "org.freedesktop.portal.Error.NotAllowed"},
+  {FLATPAK_PORTAL_ERROR_CANCELLED,                        "org.freedesktop.portal.Error.Cancelled"},
+  {FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED,                 "org.freedesktop.portal.Error.WindowDestroyed"},
+};
+
+GQuark
+flatpak_portal_error_quark (void)
+{
+  static volatile gsize quark_volatile = 0;
+
+  g_dbus_error_register_error_domain ("flatpak-portal-error-quark",
+                                      &quark_volatile,
+                                      flatpak_error_entries,
+                                      G_N_ELEMENTS (flatpak_error_entries));
+  return (GQuark) quark_volatile;
+}
diff --git a/common/flatpak-portal-error.h b/common/flatpak-portal-error.h
new file mode 100644 (file)
index 0000000..14afad9
--- /dev/null
@@ -0,0 +1,49 @@
+/* flatpak-portal-error.c
+ *
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef FLATPAK_PORTAL_ERROR_H
+#define FLATPAK_PORTAL_ERROR_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * XdpErrorEnum:
+ */
+typedef enum {
+  FLATPAK_PORTAL_ERROR_FAILED     = 0,
+  FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+  FLATPAK_PORTAL_ERROR_NOT_FOUND,
+  FLATPAK_PORTAL_ERROR_EXISTS,
+  FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+  FLATPAK_PORTAL_ERROR_CANCELLED,
+  FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED,
+} FlatpakErrorEnum;
+
+
+#define FLATPAK_PORTAL_ERROR flatpak_portal_error_quark ()
+
+FLATPAK_EXTERN GQuark  flatpak_portal_error_quark (void);
+
+G_END_DECLS
+
+#endif /* FLATPAK_PORTAL_ERROR_H */
diff --git a/common/flatpak-run.c b/common/flatpak-run.c
new file mode 100644 (file)
index 0000000..34c8b05
--- /dev/null
@@ -0,0 +1,5515 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/utsname.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/personality.h>
+#include <grp.h>
+#include <unistd.h>
+#include <gio/gunixfdlist.h>
+
+#ifdef ENABLE_SECCOMP
+#include <seccomp.h>
+#endif
+
+#ifdef ENABLE_XAUTH
+#include <X11/Xauth.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#include <gio/gio.h>
+#include "libglnx/libglnx.h"
+
+#include "flatpak-run.h"
+#include "flatpak-proxy.h"
+#include "flatpak-utils.h"
+#include "flatpak-dir.h"
+#include "flatpak-systemd-dbus.h"
+#include "document-portal/xdp-dbus.h"
+#include "lib/flatpak-error.h"
+
+#define DEFAULT_SHELL "/bin/sh"
+
+typedef enum {
+  FLATPAK_CONTEXT_SHARED_NETWORK   = 1 << 0,
+  FLATPAK_CONTEXT_SHARED_IPC       = 1 << 1,
+} FlatpakContextShares;
+
+/* In numerical order of more privs */
+typedef enum {
+  FLATPAK_FILESYSTEM_MODE_READ_ONLY    = 1,
+  FLATPAK_FILESYSTEM_MODE_READ_WRITE   = 2,
+  FLATPAK_FILESYSTEM_MODE_CREATE       = 3,
+} FlatpakFilesystemMode;
+
+
+/* Same order as enum */
+const char *flatpak_context_shares[] = {
+  "network",
+  "ipc",
+  NULL
+};
+
+typedef enum {
+  FLATPAK_CONTEXT_SOCKET_X11         = 1 << 0,
+  FLATPAK_CONTEXT_SOCKET_WAYLAND     = 1 << 1,
+  FLATPAK_CONTEXT_SOCKET_PULSEAUDIO  = 1 << 2,
+  FLATPAK_CONTEXT_SOCKET_SESSION_BUS = 1 << 3,
+  FLATPAK_CONTEXT_SOCKET_SYSTEM_BUS  = 1 << 4,
+} FlatpakContextSockets;
+
+/* Same order as enum */
+const char *flatpak_context_sockets[] = {
+  "x11",
+  "wayland",
+  "pulseaudio",
+  "session-bus",
+  "system-bus",
+  NULL
+};
+
+const char *dont_mount_in_root[] = {
+  ".", "..", "lib", "lib32", "lib64", "bin", "sbin", "usr", "boot", "root",
+  "tmp", "etc", "app", "run", "proc", "sys", "dev", "var", NULL
+};
+
+/* 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 */
+const char *dont_export_in[] = {
+  "/lib", "/lib32", "/lib64", "/bin", "/sbin", "/usr", "/etc", "/app", "/dev", NULL
+};
+
+typedef enum {
+  FLATPAK_CONTEXT_DEVICE_DRI         = 1 << 0,
+  FLATPAK_CONTEXT_DEVICE_ALL         = 1 << 1,
+  FLATPAK_CONTEXT_DEVICE_KVM         = 1 << 2,
+} FlatpakContextDevices;
+
+const char *flatpak_context_devices[] = {
+  "dri",
+  "all",
+  "kvm",
+  NULL
+};
+
+typedef enum {
+  FLATPAK_CONTEXT_FEATURE_DEVEL        = 1 << 0,
+  FLATPAK_CONTEXT_FEATURE_MULTIARCH    = 1 << 1,
+} FlatpakContextFeatures;
+
+const char *flatpak_context_features[] = {
+  "devel",
+  "multiarch",
+  NULL
+};
+
+static gboolean
+add_dbus_proxy_args (GPtrArray *argv_array,
+                     GPtrArray *session_dbus_proxy_argv,
+                     gboolean   enable_session_logging,
+                     GPtrArray *system_dbus_proxy_argv,
+                     gboolean   enable_system_logging,
+                     GPtrArray *a11y_dbus_proxy_argv,
+                     gboolean   enable_a11y_logging,
+                     int        sync_fds[2],
+                     const char *app_info_path,
+                     GError   **error);
+
+struct FlatpakContext
+{
+  FlatpakContextShares  shares;
+  FlatpakContextShares  shares_valid;
+  FlatpakContextSockets sockets;
+  FlatpakContextSockets sockets_valid;
+  FlatpakContextDevices devices;
+  FlatpakContextDevices devices_valid;
+  FlatpakContextFeatures  features;
+  FlatpakContextFeatures  features_valid;
+  GHashTable           *env_vars;
+  GHashTable           *persistent;
+  GHashTable           *filesystems;
+  GHashTable           *session_bus_policy;
+  GHashTable           *system_bus_policy;
+  GHashTable           *generic_policy;
+};
+
+FlatpakContext *
+flatpak_context_new (void)
+{
+  FlatpakContext *context;
+
+  context = g_slice_new0 (FlatpakContext);
+  context->env_vars = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  context->persistent = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  context->filesystems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  context->session_bus_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  context->system_bus_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  context->generic_policy = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                   g_free, (GDestroyNotify)g_strfreev);
+
+  return context;
+}
+
+void
+flatpak_context_free (FlatpakContext *context)
+{
+  g_hash_table_destroy (context->env_vars);
+  g_hash_table_destroy (context->persistent);
+  g_hash_table_destroy (context->filesystems);
+  g_hash_table_destroy (context->session_bus_policy);
+  g_hash_table_destroy (context->system_bus_policy);
+  g_hash_table_destroy (context->generic_policy);
+  g_slice_free (FlatpakContext, context);
+}
+
+static guint32
+flatpak_context_bitmask_from_string (const char *name, const char **names)
+{
+  guint32 i;
+
+  for (i = 0; names[i] != NULL; i++)
+    {
+      if (strcmp (names[i], name) == 0)
+        return 1 << i;
+    }
+
+  return 0;
+}
+
+static char **
+flatpak_context_bitmask_to_string (guint32 enabled, guint32 valid, const char **names)
+{
+  guint32 i;
+  GPtrArray *array;
+
+  array = g_ptr_array_new ();
+
+  for (i = 0; names[i] != NULL; i++)
+    {
+      guint32 bitmask = 1 << i;
+      if (valid & bitmask)
+        {
+          if (enabled & bitmask)
+            g_ptr_array_add (array, g_strdup (names[i]));
+          else
+            g_ptr_array_add (array, g_strdup_printf ("!%s", names[i]));
+        }
+    }
+
+  g_ptr_array_add (array, NULL);
+  return (char **) g_ptr_array_free (array, FALSE);
+}
+
+static void
+flatpak_context_bitmask_to_args (guint32 enabled, guint32 valid, const char **names,
+                                 const char *enable_arg, const char *disable_arg,
+                                 GPtrArray *args)
+{
+  guint32 i;
+
+  for (i = 0; names[i] != NULL; i++)
+    {
+      guint32 bitmask = 1 << i;
+      if (valid & bitmask)
+        {
+          if (enabled & bitmask)
+            g_ptr_array_add (args, g_strdup_printf ("%s=%s", enable_arg, names[i]));
+          else
+            g_ptr_array_add (args, g_strdup_printf ("%s=%s", disable_arg, names[i]));
+        }
+    }
+}
+
+
+static FlatpakContextShares
+flatpak_context_share_from_string (const char *string, GError **error)
+{
+  FlatpakContextShares shares = flatpak_context_bitmask_from_string (string, flatpak_context_shares);
+
+  if (shares == 0)
+    {
+      g_autofree char *values = g_strjoinv (", ", (char **)flatpak_context_shares);
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+                   _("Unknown share type %s, valid types are: %s"), string, values);
+    }
+
+  return shares;
+}
+
+static char **
+flatpak_context_shared_to_string (FlatpakContextShares shares, FlatpakContextShares valid)
+{
+  return flatpak_context_bitmask_to_string (shares, valid, flatpak_context_shares);
+}
+
+static void
+flatpak_context_shared_to_args (FlatpakContextShares shares,
+                                FlatpakContextShares valid,
+                                GPtrArray *args)
+{
+  return flatpak_context_bitmask_to_args (shares, valid, flatpak_context_shares, "--share", "--unshare", args);
+}
+
+static FlatpakPolicy
+flatpak_policy_from_string (const char *string, GError **error)
+{
+  const char *policies[] = { "none", "see", "filtered", "talk", "own", NULL };
+  int i;
+  g_autofree char *values = NULL;
+
+  for (i = 0; policies[i]; i++)
+    {
+      if (strcmp (string, policies[i]) == 0)
+        return i;
+    }
+
+  values = g_strjoinv (", ", (char **)policies);
+  g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+               _("Unknown policy type %s, valid types are: %s"), string, values);
+
+  return -1;
+}
+
+static const char *
+flatpak_policy_to_string (FlatpakPolicy policy)
+{
+  if (policy == FLATPAK_POLICY_SEE)
+    return "see";
+  if (policy == FLATPAK_POLICY_TALK)
+    return "talk";
+  if (policy == FLATPAK_POLICY_OWN)
+    return "own";
+
+  return "none";
+}
+
+static gboolean
+flatpak_verify_dbus_name (const char *name, GError **error)
+{
+  const char *name_part;
+  g_autofree char *tmp = NULL;
+
+  if (g_str_has_suffix (name, ".*"))
+    {
+      tmp = g_strndup (name, strlen (name) - 2);
+      name_part = tmp;
+    }
+  else
+    {
+      name_part = name;
+    }
+
+  if (g_dbus_is_name (name_part) && !g_dbus_is_unique_name (name_part))
+    return TRUE;
+
+  g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+               _("Invalid dbus name %s\n"), name);
+  return FALSE;
+}
+
+static FlatpakContextSockets
+flatpak_context_socket_from_string (const char *string, GError **error)
+{
+  FlatpakContextSockets sockets = flatpak_context_bitmask_from_string (string, flatpak_context_sockets);
+
+  if (sockets == 0)
+    {
+      g_autofree char *values = g_strjoinv (", ", (char **)flatpak_context_sockets);
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+                   _("Unknown socket type %s, valid types are: %s"), string, values);
+    }
+
+  return sockets;
+}
+
+static char **
+flatpak_context_sockets_to_string (FlatpakContextSockets sockets, FlatpakContextSockets valid)
+{
+  return flatpak_context_bitmask_to_string (sockets, valid, flatpak_context_sockets);
+}
+
+static void
+flatpak_context_sockets_to_args (FlatpakContextSockets sockets,
+                                 FlatpakContextSockets valid,
+                                 GPtrArray *args)
+{
+  return flatpak_context_bitmask_to_args (sockets, valid, flatpak_context_sockets, "--socket", "--nosocket", args);
+}
+
+static FlatpakContextDevices
+flatpak_context_device_from_string (const char *string, GError **error)
+{
+  FlatpakContextDevices devices = flatpak_context_bitmask_from_string (string, flatpak_context_devices);
+
+  if (devices == 0)
+    {
+      g_autofree char *values = g_strjoinv (", ", (char **)flatpak_context_devices);
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+                   _("Unknown device type %s, valid types are: %s"), string, values);
+    }
+  return devices;
+}
+
+static char **
+flatpak_context_devices_to_string (FlatpakContextDevices devices, FlatpakContextDevices valid)
+{
+  return flatpak_context_bitmask_to_string (devices, valid, flatpak_context_devices);
+}
+
+static void
+flatpak_context_devices_to_args (FlatpakContextDevices devices,
+                                 FlatpakContextDevices valid,
+                                 GPtrArray *args)
+{
+  return flatpak_context_bitmask_to_args (devices, valid, flatpak_context_devices, "--device", "--nodevice", args);
+}
+
+static FlatpakContextFeatures
+flatpak_context_feature_from_string (const char *string, GError **error)
+{
+  FlatpakContextFeatures feature = flatpak_context_bitmask_from_string (string, flatpak_context_features);
+
+  if (feature == 0)
+    {
+      g_autofree char *values = g_strjoinv (", ", (char **)flatpak_context_features);
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+                   _("Unknown feature type %s, valid types are: %s"), string, values);
+    }
+
+  return feature;
+}
+
+static char **
+flatpak_context_features_to_string (FlatpakContextFeatures features, FlatpakContextFeatures valid)
+{
+  return flatpak_context_bitmask_to_string (features, valid, flatpak_context_features);
+}
+
+static void
+flatpak_context_features_to_args (FlatpakContextFeatures features,
+                                FlatpakContextFeatures valid,
+                                GPtrArray *args)
+{
+  return flatpak_context_bitmask_to_args (features, valid, flatpak_context_features, "--allow", "--disallow", args);
+}
+
+static void
+flatpak_context_add_shares (FlatpakContext      *context,
+                            FlatpakContextShares shares)
+{
+  context->shares_valid |= shares;
+  context->shares |= shares;
+}
+
+static void
+flatpak_context_remove_shares (FlatpakContext      *context,
+                               FlatpakContextShares shares)
+{
+  context->shares_valid |= shares;
+  context->shares &= ~shares;
+}
+
+static void
+flatpak_context_add_sockets (FlatpakContext       *context,
+                             FlatpakContextSockets sockets)
+{
+  context->sockets_valid |= sockets;
+  context->sockets |= sockets;
+}
+
+static void
+flatpak_context_remove_sockets (FlatpakContext       *context,
+                                FlatpakContextSockets sockets)
+{
+  context->sockets_valid |= sockets;
+  context->sockets &= ~sockets;
+}
+
+static void
+flatpak_context_add_devices (FlatpakContext       *context,
+                             FlatpakContextDevices devices)
+{
+  context->devices_valid |= devices;
+  context->devices |= devices;
+}
+
+static void
+flatpak_context_remove_devices (FlatpakContext       *context,
+                                FlatpakContextDevices devices)
+{
+  context->devices_valid |= devices;
+  context->devices &= ~devices;
+}
+
+static void
+flatpak_context_add_features (FlatpakContext       *context,
+                           FlatpakContextFeatures   features)
+{
+  context->features_valid |= features;
+  context->features |= features;
+}
+
+static void
+flatpak_context_remove_features (FlatpakContext       *context,
+                               FlatpakContextFeatures  features)
+{
+  context->features_valid |= features;
+  context->features &= ~features;
+}
+
+static void
+flatpak_context_set_env_var (FlatpakContext *context,
+                             const char     *name,
+                             const char     *value)
+{
+  g_hash_table_insert (context->env_vars, g_strdup (name), g_strdup (value));
+}
+
+void
+flatpak_context_set_session_bus_policy (FlatpakContext *context,
+                                        const char     *name,
+                                        FlatpakPolicy   policy)
+{
+  g_hash_table_insert (context->session_bus_policy, g_strdup (name), GINT_TO_POINTER (policy));
+}
+
+void
+flatpak_context_set_system_bus_policy (FlatpakContext *context,
+                                       const char     *name,
+                                       FlatpakPolicy   policy)
+{
+  g_hash_table_insert (context->system_bus_policy, g_strdup (name), GINT_TO_POINTER (policy));
+}
+
+static void
+flatpak_context_apply_generic_policy (FlatpakContext *context,
+                                      const char     *key,
+                                      const char     *value)
+{
+  GPtrArray *new = g_ptr_array_new ();
+  const char **old_v;
+  int i;
+
+  g_assert (strchr (key, '.') != NULL);
+
+  old_v = g_hash_table_lookup (context->generic_policy, key);
+  for (i = 0; old_v != NULL && old_v[i] != NULL; i++)
+    {
+      const char *old = old_v[i];
+      const char *cmp1 = old;
+      const char *cmp2 = value;
+      if (*cmp1 == '!')
+        cmp1++;
+      if (*cmp2 == '!')
+        cmp2++;
+      if (strcmp (cmp1, cmp2) != 0)
+        g_ptr_array_add (new, g_strdup (old));
+    }
+
+  g_ptr_array_add (new, g_strdup (value));
+  g_ptr_array_add (new, NULL);
+
+  g_hash_table_insert (context->generic_policy, g_strdup (key),
+                       g_ptr_array_free (new, FALSE));
+}
+
+static void
+flatpak_context_set_persistent (FlatpakContext *context,
+                                const char     *path)
+{
+  g_hash_table_insert (context->persistent, g_strdup (path), GINT_TO_POINTER (1));
+}
+
+static gboolean
+get_xdg_dir_from_prefix (const char *prefix,
+                         const char **where,
+                         const char **dir)
+{
+  if (strcmp (prefix, "xdg-data") == 0)
+    {
+      if (where)
+        *where = "data";
+      if (dir)
+        *dir = g_get_user_data_dir ();
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-cache") == 0)
+    {
+      if (where)
+        *where = "cache";
+      if (dir)
+        *dir = g_get_user_cache_dir ();
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-config") == 0)
+    {
+      if (where)
+        *where = "config";
+      if (dir)
+        *dir = g_get_user_config_dir ();
+      return TRUE;
+    }
+  return FALSE;
+}
+
+/* This looks only in the xdg dirs (config, cache, data), not the user
+   definable ones */
+static char *
+get_xdg_dir_from_string (const char *filesystem,
+                         const char **suffix,
+                         const char **where)
+{
+  char *slash;
+  const char *rest;
+  g_autofree char *prefix = NULL;
+  const char *dir = NULL;
+  gsize len;
+
+  slash = strchr (filesystem, '/');
+
+  if (slash)
+    len = slash - filesystem;
+  else
+    len = strlen (filesystem);
+
+  rest = filesystem + len;
+  while (*rest == '/')
+    rest++;
+
+  if (suffix != NULL)
+    *suffix = rest;
+
+  prefix = g_strndup (filesystem, len);
+
+  if (get_xdg_dir_from_prefix (prefix, where, &dir))
+    return g_build_filename (dir, rest, NULL);
+
+  return NULL;
+}
+
+static gboolean
+get_xdg_user_dir_from_string (const char  *filesystem,
+                              const char **config_key,
+                              const char **suffix,
+                              const char **dir)
+{
+  char *slash;
+  const char *rest;
+  g_autofree char *prefix = NULL;
+  gsize len;
+
+  slash = strchr (filesystem, '/');
+
+  if (slash)
+    len = slash - filesystem;
+  else
+    len = strlen (filesystem);
+
+  rest = filesystem + len;
+  while (*rest == '/')
+    rest++;
+
+  if (suffix)
+    *suffix = rest;
+
+  prefix = g_strndup (filesystem, len);
+
+  if (strcmp (prefix, "xdg-desktop") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_DESKTOP_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-documents") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_DOCUMENTS_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-download") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_DOWNLOAD_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-music") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_MUSIC_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-pictures") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_PICTURES_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-public-share") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_PUBLICSHARE_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-templates") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_TEMPLATES_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES);
+      return TRUE;
+    }
+  if (strcmp (prefix, "xdg-videos") == 0)
+    {
+      if (config_key)
+        *config_key = "XDG_VIDEOS_DIR";
+      if (dir)
+        *dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
+      return TRUE;
+    }
+  if (get_xdg_dir_from_prefix (prefix, NULL, dir))
+    {
+      if (config_key)
+        *config_key = NULL;
+      return TRUE;
+    }
+  /* Don't support xdg-run without suffix, because that doesn't work */
+  if (strcmp (prefix, "xdg-run") == 0 &&
+      *rest != 0)
+    {
+      if (config_key)
+        *config_key = NULL;
+      if (dir)
+        *dir = g_get_user_runtime_dir ();
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static char *
+parse_filesystem_flags (const char *filesystem, FlatpakFilesystemMode *mode)
+{
+  gsize len = strlen (filesystem);
+
+  if (mode)
+    *mode = FLATPAK_FILESYSTEM_MODE_READ_WRITE;
+
+  if (g_str_has_suffix (filesystem, ":ro"))
+    {
+      len -= 3;
+      if (mode)
+        *mode = FLATPAK_FILESYSTEM_MODE_READ_ONLY;
+    }
+  else if (g_str_has_suffix (filesystem, ":rw"))
+    {
+      len -= 3;
+      if (mode)
+        *mode = FLATPAK_FILESYSTEM_MODE_READ_WRITE;
+    }
+  else if (g_str_has_suffix (filesystem, ":create"))
+    {
+      len -= 7;
+      if (mode)
+        *mode = FLATPAK_FILESYSTEM_MODE_CREATE;
+    }
+
+  return g_strndup (filesystem, len);
+}
+
+static gboolean
+flatpak_context_verify_filesystem (const char *filesystem_and_mode,
+                                   GError    **error)
+{
+  g_autofree char *filesystem = parse_filesystem_flags (filesystem_and_mode, NULL);
+
+  if (strcmp (filesystem, "host") == 0)
+    return TRUE;
+  if (strcmp (filesystem, "home") == 0)
+    return TRUE;
+  if (get_xdg_user_dir_from_string (filesystem, NULL, NULL, NULL))
+    return TRUE;
+  if (g_str_has_prefix (filesystem, "~/"))
+    return TRUE;
+  if (g_str_has_prefix (filesystem, "/"))
+    return TRUE;
+
+  g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+               _("Unknown filesystem location %s, valid locations are: host, home, xdg-*[/...], ~/dir, /dir"), filesystem);
+  return FALSE;
+}
+
+static void
+flatpak_context_add_filesystem (FlatpakContext *context,
+                                const char     *what)
+{
+  FlatpakFilesystemMode mode;
+  char *fs = parse_filesystem_flags (what, &mode);
+
+  g_hash_table_insert (context->filesystems, fs, GINT_TO_POINTER (mode));
+}
+
+static void
+flatpak_context_remove_filesystem (FlatpakContext *context,
+                                   const char     *what)
+{
+  g_hash_table_insert (context->filesystems,
+                       parse_filesystem_flags (what, NULL),
+                       NULL);
+}
+
+void
+flatpak_context_merge (FlatpakContext *context,
+                       FlatpakContext *other)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+
+  context->shares &= ~other->shares_valid;
+  context->shares |= other->shares;
+  context->shares_valid |= other->shares_valid;
+  context->sockets &= ~other->sockets_valid;
+  context->sockets |= other->sockets;
+  context->sockets_valid |= other->sockets_valid;
+  context->devices &= ~other->devices_valid;
+  context->devices |= other->devices;
+  context->devices_valid |= other->devices_valid;
+  context->features &= ~other->features_valid;
+  context->features |= other->features;
+  context->features_valid |= other->features_valid;
+
+  g_hash_table_iter_init (&iter, other->env_vars);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->env_vars, g_strdup (key), g_strdup (value));
+
+  g_hash_table_iter_init (&iter, other->persistent);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->persistent, g_strdup (key), value);
+
+  g_hash_table_iter_init (&iter, other->filesystems);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->filesystems, g_strdup (key), value);
+
+  g_hash_table_iter_init (&iter, other->session_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->session_bus_policy, g_strdup (key), value);
+
+  g_hash_table_iter_init (&iter, other->system_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->system_bus_policy, g_strdup (key), value);
+
+  g_hash_table_iter_init (&iter, other->system_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_hash_table_insert (context->system_bus_policy, g_strdup (key), value);
+
+  g_hash_table_iter_init (&iter, other->generic_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char **policy_values = (const char **)value;
+      int i;
+
+      for (i = 0; policy_values[i] != NULL; i++)
+        flatpak_context_apply_generic_policy (context, (char *)key, policy_values[i]);
+    }
+
+}
+
+static gboolean
+option_share_cb (const gchar *option_name,
+                 const gchar *value,
+                 gpointer     data,
+                 GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextShares share;
+
+  share = flatpak_context_share_from_string (value, error);
+  if (share == 0)
+    return FALSE;
+
+  flatpak_context_add_shares (context, share);
+
+  return TRUE;
+}
+
+static gboolean
+option_unshare_cb (const gchar *option_name,
+                   const gchar *value,
+                   gpointer     data,
+                   GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextShares share;
+
+  share = flatpak_context_share_from_string (value, error);
+  if (share == 0)
+    return FALSE;
+
+  flatpak_context_remove_shares (context, share);
+
+  return TRUE;
+}
+
+static gboolean
+option_socket_cb (const gchar *option_name,
+                  const gchar *value,
+                  gpointer     data,
+                  GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextSockets socket;
+
+  socket = flatpak_context_socket_from_string (value, error);
+  if (socket == 0)
+    return FALSE;
+
+  flatpak_context_add_sockets (context, socket);
+
+  return TRUE;
+}
+
+static gboolean
+option_nosocket_cb (const gchar *option_name,
+                    const gchar *value,
+                    gpointer     data,
+                    GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextSockets socket;
+
+  socket = flatpak_context_socket_from_string (value, error);
+  if (socket == 0)
+    return FALSE;
+
+  flatpak_context_remove_sockets (context, socket);
+
+  return TRUE;
+}
+
+static gboolean
+option_device_cb (const gchar *option_name,
+                  const gchar *value,
+                  gpointer     data,
+                  GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextDevices device;
+
+  device = flatpak_context_device_from_string (value, error);
+  if (device == 0)
+    return FALSE;
+
+  flatpak_context_add_devices (context, device);
+
+  return TRUE;
+}
+
+static gboolean
+option_nodevice_cb (const gchar *option_name,
+                    const gchar *value,
+                    gpointer     data,
+                    GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextDevices device;
+
+  device = flatpak_context_device_from_string (value, error);
+  if (device == 0)
+    return FALSE;
+
+  flatpak_context_remove_devices (context, device);
+
+  return TRUE;
+}
+
+static gboolean
+option_allow_cb (const gchar *option_name,
+                 const gchar *value,
+                 gpointer     data,
+                 GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextFeatures feature;
+
+  feature = flatpak_context_feature_from_string (value, error);
+  if (feature == 0)
+    return FALSE;
+
+  flatpak_context_add_features (context, feature);
+
+  return TRUE;
+}
+
+static gboolean
+option_disallow_cb (const gchar *option_name,
+                    const gchar *value,
+                    gpointer     data,
+                    GError     **error)
+{
+  FlatpakContext *context = data;
+  FlatpakContextFeatures feature;
+
+  feature = flatpak_context_feature_from_string (value, error);
+  if (feature == 0)
+    return FALSE;
+
+  flatpak_context_remove_features (context, feature);
+
+  return TRUE;
+}
+
+static gboolean
+option_filesystem_cb (const gchar *option_name,
+                      const gchar *value,
+                      gpointer     data,
+                      GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_context_verify_filesystem (value, error))
+    return FALSE;
+
+  flatpak_context_add_filesystem (context, value);
+  return TRUE;
+}
+
+static gboolean
+option_nofilesystem_cb (const gchar *option_name,
+                        const gchar *value,
+                        gpointer     data,
+                        GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_context_verify_filesystem (value, error))
+    return FALSE;
+
+  flatpak_context_remove_filesystem (context, value);
+  return TRUE;
+}
+
+static gboolean
+option_env_cb (const gchar *option_name,
+               const gchar *value,
+               gpointer     data,
+               GError     **error)
+{
+  FlatpakContext *context = data;
+
+  g_auto(GStrv) split = g_strsplit (value, "=", 2);
+
+  if (split == NULL || split[0] == NULL || split[0][0] == 0 || split[1] == NULL)
+    {
+      g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+                   _("Invalid env format %s"), value);
+      return FALSE;
+    }
+
+  flatpak_context_set_env_var (context, split[0], split[1]);
+  return TRUE;
+}
+
+static gboolean
+option_own_name_cb (const gchar *option_name,
+                    const gchar *value,
+                    gpointer     data,
+                    GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_verify_dbus_name (value, error))
+    return FALSE;
+
+  flatpak_context_set_session_bus_policy (context, value, FLATPAK_POLICY_OWN);
+  return TRUE;
+}
+
+static gboolean
+option_talk_name_cb (const gchar *option_name,
+                     const gchar *value,
+                     gpointer     data,
+                     GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_verify_dbus_name (value, error))
+    return FALSE;
+
+  flatpak_context_set_session_bus_policy (context, value, FLATPAK_POLICY_TALK);
+  return TRUE;
+}
+
+static gboolean
+option_system_own_name_cb (const gchar *option_name,
+                           const gchar *value,
+                           gpointer     data,
+                           GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_verify_dbus_name (value, error))
+    return FALSE;
+
+  flatpak_context_set_system_bus_policy (context, value, FLATPAK_POLICY_OWN);
+  return TRUE;
+}
+
+static gboolean
+option_system_talk_name_cb (const gchar *option_name,
+                            const gchar *value,
+                            gpointer     data,
+                            GError     **error)
+{
+  FlatpakContext *context = data;
+
+  if (!flatpak_verify_dbus_name (value, error))
+    return FALSE;
+
+  flatpak_context_set_system_bus_policy (context, value, FLATPAK_POLICY_TALK);
+  return TRUE;
+}
+
+static gboolean
+option_add_generic_policy_cb (const gchar *option_name,
+                              const gchar *value,
+                              gpointer     data,
+                              GError     **error)
+{
+  FlatpakContext *context = data;
+  char *t;
+  g_autofree char *key = NULL;
+  const char *policy_value;
+
+  t = strchr (value, '=');
+  if (t == NULL)
+    return flatpak_fail (error, "--policy arguments must be in the form SUBSYSTEM.KEY=[!]VALUE");
+  policy_value = t + 1;
+  key = g_strndup (value, t - value);
+  if (strchr (key, '.') == NULL)
+    return flatpak_fail (error, "--policy arguments must be in the form SUBSYSTEM.KEY=[!]VALUE");
+
+  if (policy_value[0] == '!')
+    return flatpak_fail (error, "--policy values can't start with \"!\"");
+
+  flatpak_context_apply_generic_policy (context, key, policy_value);
+
+  return TRUE;
+}
+
+static gboolean
+option_remove_generic_policy_cb (const gchar *option_name,
+                                 const gchar *value,
+                                 gpointer     data,
+                                 GError     **error)
+{
+  FlatpakContext *context = data;
+  char *t;
+  g_autofree char *key = NULL;
+  const char *policy_value;
+  g_autofree char *extended_value = NULL;
+
+  t = strchr (value, '=');
+  if (t == NULL)
+    return flatpak_fail (error, "--policy arguments must be in the form SUBSYSTEM.KEY=[!]VALUE");
+  policy_value = t + 1;
+  key = g_strndup (value, t - value);
+  if (strchr (key, '.') == NULL)
+    return flatpak_fail (error, "--policy arguments must be in the form SUBSYSTEM.KEY=[!]VALUE");
+
+  if (policy_value[0] == '!')
+    return flatpak_fail (error, "--policy values can't start with \"!\"");
+
+  extended_value = g_strconcat ("!", policy_value, NULL);
+
+  flatpak_context_apply_generic_policy (context, key, extended_value);
+
+  return TRUE;
+}
+
+static gboolean
+option_persist_cb (const gchar *option_name,
+                   const gchar *value,
+                   gpointer     data,
+                   GError     **error)
+{
+  FlatpakContext *context = data;
+
+  flatpak_context_set_persistent (context, value);
+  return TRUE;
+}
+
+static gboolean option_no_desktop_deprecated;
+
+static GOptionEntry context_options[] = {
+  { "share", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_share_cb, N_("Share with host"), N_("SHARE") },
+  { "unshare", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_unshare_cb, N_("Unshare with host"), N_("SHARE") },
+  { "socket", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_socket_cb, N_("Expose socket to app"), N_("SOCKET") },
+  { "nosocket", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_nosocket_cb, N_("Don't expose socket to app"), N_("SOCKET") },
+  { "device", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_device_cb, N_("Expose device to app"), N_("DEVICE") },
+  { "nodevice", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_nodevice_cb, N_("Don't expose device to app"), N_("DEVICE") },
+  { "allow", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_allow_cb, N_("Allow feature"), N_("FEATURE") },
+  { "disallow", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_disallow_cb, N_("Don't allow feature"), N_("FEATURE") },
+  { "filesystem", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_filesystem_cb, N_("Expose filesystem to app (:ro for read-only)"), N_("FILESYSTEM[:ro]") },
+  { "nofilesystem", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_nofilesystem_cb, N_("Don't expose filesystem to app"), N_("FILESYSTEM") },
+  { "env", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_env_cb, N_("Set environment variable"), N_("VAR=VALUE") },
+  { "own-name", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_own_name_cb, N_("Allow app to own name on the session bus"), N_("DBUS_NAME") },
+  { "talk-name", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_talk_name_cb, N_("Allow app to talk to name on the session bus"), N_("DBUS_NAME") },
+  { "system-own-name", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_system_own_name_cb, N_("Allow app to own name on the system bus"), N_("DBUS_NAME") },
+  { "system-talk-name", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_system_talk_name_cb, N_("Allow app to talk to name on the system bus"), N_("DBUS_NAME") },
+  { "add-policy", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_add_generic_policy_cb, N_("Add generic policy option"), N_("SUBSYSTEM.KEY=VALUE") },
+  { "remove-policy", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_remove_generic_policy_cb, N_("Remove generic policy option"), N_("SUBSYSTEM.KEY=VALUE") },
+  { "persist", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, &option_persist_cb, N_("Persist home directory"), N_("FILENAME") },
+  /* This is not needed/used anymore, so hidden, but we accept it for backwards compat */
+  { "no-desktop", 0, G_OPTION_FLAG_IN_MAIN |  G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &option_no_desktop_deprecated, N_("Don't require a running session (no cgroups creation)"), NULL },
+  { NULL }
+};
+
+void
+flatpak_context_complete (FlatpakContext *context, FlatpakCompletion *completion)
+{
+  flatpak_complete_options (completion, context_options);
+}
+
+GOptionGroup  *
+flatpak_context_get_options (FlatpakContext *context)
+{
+  GOptionGroup *group;
+
+  group = g_option_group_new ("environment",
+                              "Runtime Environment",
+                              "Runtime Environment",
+                              context,
+                              NULL);
+  g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
+
+  g_option_group_add_entries (group, context_options);
+
+  return group;
+}
+
+static const char *
+parse_negated (const char *option, gboolean *negated)
+{
+  if (option[0] == '!')
+    {
+      option++;
+      *negated = TRUE;
+    }
+  else
+    {
+      *negated = FALSE;
+    }
+  return option;
+}
+
+/*
+ * Merge the FLATPAK_METADATA_GROUP_CONTEXT,
+ * FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY,
+ * FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY and
+ * FLATPAK_METADATA_GROUP_ENVIRONMENT groups, and all groups starting
+ * with FLATPAK_METADATA_GROUP_PREFIX_POLICY, from metakey into context.
+ *
+ * This is a merge, not a replace!
+ */
+gboolean
+flatpak_context_load_metadata (FlatpakContext *context,
+                               GKeyFile       *metakey,
+                               GError        **error)
+{
+  gboolean remove;
+  g_auto(GStrv) groups = NULL;
+  int i;
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL))
+    {
+      g_auto(GStrv) shares = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                         FLATPAK_METADATA_KEY_SHARED, NULL, error);
+      if (shares == NULL)
+        return FALSE;
+
+      for (i = 0; shares[i] != NULL; i++)
+        {
+          FlatpakContextShares share;
+
+          share = flatpak_context_share_from_string (parse_negated (shares[i], &remove), error);
+          if (share == 0)
+            return FALSE;
+          if (remove)
+            flatpak_context_remove_shares (context, share);
+          else
+            flatpak_context_add_shares (context, share);
+        }
+    }
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL))
+    {
+      g_auto(GStrv) sockets = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                          FLATPAK_METADATA_KEY_SOCKETS, NULL, error);
+      if (sockets == NULL)
+        return FALSE;
+
+      for (i = 0; sockets[i] != NULL; i++)
+        {
+          FlatpakContextSockets socket = flatpak_context_socket_from_string (parse_negated (sockets[i], &remove), error);
+          if (socket == 0)
+            return FALSE;
+          if (remove)
+            flatpak_context_remove_sockets (context, socket);
+          else
+            flatpak_context_add_sockets (context, socket);
+        }
+    }
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL))
+    {
+      g_auto(GStrv) devices = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                          FLATPAK_METADATA_KEY_DEVICES, NULL, error);
+      if (devices == NULL)
+        return FALSE;
+
+
+      for (i = 0; devices[i] != NULL; i++)
+        {
+          FlatpakContextDevices device = flatpak_context_device_from_string (parse_negated (devices[i], &remove), error);
+          if (device == 0)
+            return FALSE;
+          if (remove)
+            flatpak_context_remove_devices (context, device);
+          else
+            flatpak_context_add_devices (context, device);
+        }
+    }
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FEATURES, NULL))
+    {
+      g_auto(GStrv) features = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                         FLATPAK_METADATA_KEY_FEATURES, NULL, error);
+      if (features == NULL)
+        return FALSE;
+
+
+      for (i = 0; features[i] != NULL; i++)
+        {
+          FlatpakContextFeatures feature = flatpak_context_feature_from_string (parse_negated (features[i], &remove), error);
+          if (feature == 0)
+            return FALSE;
+          if (remove)
+            flatpak_context_remove_features (context, feature);
+          else
+            flatpak_context_add_features (context, feature);
+        }
+    }
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_FILESYSTEMS, NULL))
+    {
+      g_auto(GStrv) filesystems = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                              FLATPAK_METADATA_KEY_FILESYSTEMS, NULL, error);
+      if (filesystems == NULL)
+        return FALSE;
+
+      for (i = 0; filesystems[i] != NULL; i++)
+        {
+          const char *fs = parse_negated (filesystems[i], &remove);
+          if (!flatpak_context_verify_filesystem (fs, error))
+            return FALSE;
+          if (remove)
+            flatpak_context_remove_filesystem (context, fs);
+          else
+            flatpak_context_add_filesystem (context, fs);
+        }
+    }
+
+  if (g_key_file_has_key (metakey, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_PERSISTENT, NULL))
+    {
+      g_auto(GStrv) persistent = g_key_file_get_string_list (metakey, FLATPAK_METADATA_GROUP_CONTEXT,
+                                                             FLATPAK_METADATA_KEY_PERSISTENT, NULL, error);
+      if (persistent == NULL)
+        return FALSE;
+
+      for (i = 0; persistent[i] != NULL; i++)
+        flatpak_context_set_persistent (context, persistent[i]);
+    }
+
+  if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY))
+    {
+      g_auto(GStrv) keys = NULL;
+      gsize i, keys_count;
+
+      keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY, &keys_count, NULL);
+      for (i = 0; i < keys_count; i++)
+        {
+          const char *key = keys[i];
+          g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY, key, NULL);
+          FlatpakPolicy policy;
+
+          if (!flatpak_verify_dbus_name (key, error))
+            return FALSE;
+
+          policy = flatpak_policy_from_string (value, error);
+          if ((int) policy == -1)
+            return FALSE;
+
+          flatpak_context_set_session_bus_policy (context, key, policy);
+        }
+    }
+
+  if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY))
+    {
+      g_auto(GStrv) keys = NULL;
+      gsize i, keys_count;
+
+      keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY, &keys_count, NULL);
+      for (i = 0; i < keys_count; i++)
+        {
+          const char *key = keys[i];
+          g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY, key, NULL);
+          FlatpakPolicy policy;
+
+          if (!flatpak_verify_dbus_name (key, error))
+            return FALSE;
+
+          policy = flatpak_policy_from_string (value, error);
+          if ((int) policy == -1)
+            return FALSE;
+
+          flatpak_context_set_system_bus_policy (context, key, policy);
+        }
+    }
+
+  if (g_key_file_has_group (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT))
+    {
+      g_auto(GStrv) keys = NULL;
+      gsize i, keys_count;
+
+      keys = g_key_file_get_keys (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT, &keys_count, NULL);
+      for (i = 0; i < keys_count; i++)
+        {
+          const char *key = keys[i];
+          g_autofree char *value = g_key_file_get_string (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT, key, NULL);
+
+          flatpak_context_set_env_var (context, key, value);
+        }
+    }
+
+  groups = g_key_file_get_groups (metakey, NULL);
+  for (i = 0; groups[i] != NULL; i++)
+    {
+      const char *group = groups[i];
+      const char *subsystem;
+      int j;
+
+      if (g_str_has_prefix (group, FLATPAK_METADATA_GROUP_PREFIX_POLICY))
+        {
+          g_auto(GStrv) keys = NULL;
+          subsystem = group + strlen (FLATPAK_METADATA_GROUP_PREFIX_POLICY);
+          keys = g_key_file_get_keys (metakey, group, NULL, NULL);
+          for (j = 0; keys != NULL && keys[j] != NULL; j++)
+            {
+              const char *key = keys[j];
+              g_autofree char *policy_key = g_strdup_printf ("%s.%s", subsystem, key);
+              g_auto(GStrv) values = NULL;
+              int k;
+
+              values = g_key_file_get_string_list (metakey, group, key, NULL, NULL);
+              for (k = 0; values != NULL && values[k] != NULL; k++)
+                flatpak_context_apply_generic_policy (context, policy_key,
+                                                      values[k]);
+            }
+        }
+    }
+
+  return TRUE;
+}
+
+/*
+ * Save the FLATPAK_METADATA_GROUP_CONTEXT,
+ * FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY,
+ * FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY and
+ * FLATPAK_METADATA_GROUP_ENVIRONMENT groups, and all groups starting
+ * with FLATPAK_METADATA_GROUP_PREFIX_POLICY, into metakey
+ */
+void
+flatpak_context_save_metadata (FlatpakContext *context,
+                               gboolean        flatten,
+                               GKeyFile       *metakey)
+{
+  g_auto(GStrv) shared = NULL;
+  g_auto(GStrv) sockets = NULL;
+  g_auto(GStrv) devices = NULL;
+  g_auto(GStrv) features = NULL;
+  GHashTableIter iter;
+  gpointer key, value;
+  FlatpakContextShares shares_mask = context->shares;
+  FlatpakContextShares shares_valid = context->shares_valid;
+  FlatpakContextSockets sockets_mask = context->sockets;
+  FlatpakContextSockets sockets_valid = context->sockets_valid;
+  FlatpakContextDevices devices_mask = context->devices;
+  FlatpakContextDevices devices_valid = context->devices_valid;
+  FlatpakContextFeatures features_mask = context->features;
+  FlatpakContextFeatures features_valid = context->features;
+  g_auto(GStrv) groups = NULL;
+  int i;
+
+  if (flatten)
+    {
+      /* A flattened format means we don't expect this to be merged on top of
+         another context. In that case we never need to negate any flags.
+         We calculate this by removing the zero parts of the mask from the valid set.
+      */
+      /* First we make sure only the valid parts of the mask are set, in case we
+         got some leftover */
+      shares_mask &= shares_valid;
+      sockets_mask &= sockets_valid;
+      devices_mask &= devices_valid;
+      features_mask &= features_valid;
+
+      /* Then just set the valid set to be the mask set */
+      shares_valid = shares_mask;
+      sockets_valid = sockets_mask;
+      devices_valid = devices_mask;
+      features_valid = features_mask;
+    }
+
+  shared = flatpak_context_shared_to_string (shares_mask, shares_valid);
+  sockets = flatpak_context_sockets_to_string (sockets_mask, sockets_valid);
+  devices = flatpak_context_devices_to_string (devices_mask, devices_valid);
+  features = flatpak_context_features_to_string (features_mask, features_valid);
+
+  if (shared[0] != NULL)
+    {
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_SHARED,
+                                  (const char * const *) shared, g_strv_length (shared));
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_SHARED,
+                             NULL);
+    }
+
+  if (sockets[0] != NULL)
+    {
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_SOCKETS,
+                                  (const char * const *) sockets, g_strv_length (sockets));
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_SOCKETS,
+                             NULL);
+    }
+
+  if (devices[0] != NULL)
+    {
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_DEVICES,
+                                  (const char * const *) devices, g_strv_length (devices));
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_DEVICES,
+                             NULL);
+    }
+
+  if (features[0] != NULL)
+    {
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_FEATURES,
+                                  (const char * const *) features, g_strv_length (features));
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_FEATURES,
+                             NULL);
+    }
+
+  if (g_hash_table_size (context->filesystems) > 0)
+    {
+      g_autoptr(GPtrArray) array = g_ptr_array_new_with_free_func (g_free);
+
+      g_hash_table_iter_init (&iter, context->filesystems);
+      while (g_hash_table_iter_next (&iter, &key, &value))
+        {
+          FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);
+
+          if (mode == FLATPAK_FILESYSTEM_MODE_READ_ONLY)
+            g_ptr_array_add (array, g_strconcat (key, ":ro", NULL));
+          else if (mode == FLATPAK_FILESYSTEM_MODE_CREATE)
+            g_ptr_array_add (array, g_strconcat (key, ":create", NULL));
+          else if (value != NULL)
+            g_ptr_array_add (array, g_strdup (key));
+          else
+            g_ptr_array_add (array, g_strconcat ("!", key, NULL));
+        }
+
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_FILESYSTEMS,
+                                  (const char * const *) array->pdata, array->len);
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_FILESYSTEMS,
+                             NULL);
+    }
+
+  if (g_hash_table_size (context->persistent) > 0)
+    {
+      g_autofree char **keys = (char **) g_hash_table_get_keys_as_array (context->persistent, NULL);
+
+      g_key_file_set_string_list (metakey,
+                                  FLATPAK_METADATA_GROUP_CONTEXT,
+                                  FLATPAK_METADATA_KEY_PERSISTENT,
+                                  (const char * const *) keys, g_strv_length (keys));
+    }
+  else
+    {
+      g_key_file_remove_key (metakey,
+                             FLATPAK_METADATA_GROUP_CONTEXT,
+                             FLATPAK_METADATA_KEY_PERSISTENT,
+                             NULL);
+    }
+
+  g_key_file_remove_group (metakey, FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY, NULL);
+  g_hash_table_iter_init (&iter, context->session_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      FlatpakPolicy policy = GPOINTER_TO_INT (value);
+      if (policy > 0)
+        g_key_file_set_string (metakey,
+                               FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY,
+                               (char *) key, flatpak_policy_to_string (policy));
+    }
+
+  g_key_file_remove_group (metakey, FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY, NULL);
+  g_hash_table_iter_init (&iter, context->system_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      FlatpakPolicy policy = GPOINTER_TO_INT (value);
+      if (policy > 0)
+        g_key_file_set_string (metakey,
+                               FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY,
+                               (char *) key, flatpak_policy_to_string (policy));
+    }
+
+  g_key_file_remove_group (metakey, FLATPAK_METADATA_GROUP_ENVIRONMENT, NULL);
+  g_hash_table_iter_init (&iter, context->env_vars);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      g_key_file_set_string (metakey,
+                             FLATPAK_METADATA_GROUP_ENVIRONMENT,
+                             (char *) key, (char *) value);
+    }
+
+
+  groups = g_key_file_get_groups (metakey, NULL);
+  for (i = 0; groups[i] != NULL; i++)
+    {
+      const char *group = groups[i];
+      if (g_str_has_prefix (group, FLATPAK_METADATA_GROUP_PREFIX_POLICY))
+        g_key_file_remove_group (metakey, group, NULL);
+    }
+
+  g_hash_table_iter_init (&iter, context->generic_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      g_auto(GStrv) parts = g_strsplit ((const char *)key, ".", 2);
+      g_autofree char *group = NULL;
+      g_assert (parts[1] != NULL);
+      const char **policy_values = (const char **)value;
+      g_autoptr(GPtrArray) new = g_ptr_array_new ();
+
+      for (i = 0; policy_values[i] != NULL; i++)
+        {
+          const char *policy_value = policy_values[i];
+
+          if (!flatten || policy_value[0] != '!')
+            g_ptr_array_add (new, (char *)policy_value);
+        }
+
+      if (new->len > 0)
+        {
+          group = g_strconcat (FLATPAK_METADATA_GROUP_PREFIX_POLICY,
+                               parts[0], NULL);
+          g_key_file_set_string_list (metakey, group, parts[1],
+                                      (const char * const*)new->pdata,
+                                      new->len);
+        }
+    }
+}
+
+void
+flatpak_context_allow_host_fs (FlatpakContext *context)
+{
+  flatpak_context_add_filesystem (context, "host");
+}
+
+gboolean
+flatpak_context_get_needs_session_bus_proxy (FlatpakContext *context)
+{
+  return g_hash_table_size (context->session_bus_policy) > 0;
+}
+
+gboolean
+flatpak_context_get_needs_system_bus_proxy (FlatpakContext *context)
+{
+  return g_hash_table_size (context->system_bus_policy) > 0;
+}
+
+void
+flatpak_context_to_args (FlatpakContext *context,
+                         GPtrArray *args)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+
+  flatpak_context_shared_to_args (context->shares, context->shares_valid, args);
+  flatpak_context_sockets_to_args (context->sockets, context->sockets_valid, args);
+  flatpak_context_devices_to_args (context->devices, context->devices_valid, args);
+  flatpak_context_features_to_args (context->features, context->features_valid, args);
+
+  g_hash_table_iter_init (&iter, context->env_vars);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_ptr_array_add (args, g_strdup_printf ("--env=%s=%s", (char *)key, (char *)value));
+
+  g_hash_table_iter_init (&iter, context->persistent);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    g_ptr_array_add (args, g_strdup_printf ("--persist=%s", (char *)key));
+
+  g_hash_table_iter_init (&iter, context->session_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *name = key;
+      FlatpakPolicy policy = GPOINTER_TO_INT (value);
+
+      g_ptr_array_add (args, g_strdup_printf ("--%s-name=%s", flatpak_policy_to_string (policy), name));
+    }
+
+  g_hash_table_iter_init (&iter, context->system_bus_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *name = key;
+      FlatpakPolicy policy = GPOINTER_TO_INT (value);
+
+      g_ptr_array_add (args, g_strdup_printf ("--system-%s-name=%s", flatpak_policy_to_string (policy), name));
+    }
+
+  g_hash_table_iter_init (&iter, context->filesystems);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);
+
+      if (mode == FLATPAK_FILESYSTEM_MODE_READ_ONLY)
+        g_ptr_array_add (args, g_strdup_printf ("--filesystem=%s:ro", (char *)key));
+      else if (mode == FLATPAK_FILESYSTEM_MODE_READ_WRITE)
+        g_ptr_array_add (args, g_strdup_printf ("--filesystem=%s", (char *)key));
+      else if (mode == FLATPAK_FILESYSTEM_MODE_CREATE)
+        g_ptr_array_add (args, g_strdup_printf ("--filesystem=%s:create", (char *)key));
+      else
+        g_ptr_array_add (args, g_strdup_printf ("--nofilesystem=%s", (char *)key));
+    }
+}
+
+static char *
+extract_unix_path_from_dbus_address (const char *address)
+{
+  const char *path, *path_end;
+
+  if (address == NULL)
+    return NULL;
+
+  if (!g_str_has_prefix (address, "unix:"))
+    return NULL;
+
+  path = strstr (address, "path=");
+  if (path == NULL)
+    return NULL;
+  path += strlen ("path=");
+  path_end = path;
+  while (*path_end != 0 && *path_end != ',')
+    path_end++;
+
+  return g_strndup (path, path_end - path);
+}
+
+#ifdef ENABLE_XAUTH
+static gboolean
+auth_streq (char *str,
+            char *au_str,
+            int   au_len)
+{
+  return au_len == strlen (str) && memcmp (str, au_str, au_len) == 0;
+}
+
+static gboolean
+xauth_entry_should_propagate (Xauth *xa,
+                              char  *hostname,
+                              char  *number)
+{
+  /* ensure entry isn't for remote access */
+  if (xa->family != FamilyLocal && xa->family != FamilyWild)
+    return FALSE;
+
+  /* ensure entry is for this machine */
+  if (xa->family == FamilyLocal && !auth_streq (hostname, xa->address, xa->address_length))
+    return FALSE;
+
+  /* ensure entry is for this session */
+  if (xa->number != NULL && !auth_streq (number, xa->number, xa->number_length))
+    return FALSE;
+
+  return TRUE;
+}
+
+static void
+write_xauth (char *number, FILE *output)
+{
+  Xauth *xa, local_xa;
+  char *filename;
+  FILE *f;
+  struct utsname unames;
+
+  if (uname (&unames))
+    {
+      g_warning ("uname failed");
+      return;
+    }
+
+  filename = XauFileName ();
+  f = fopen (filename, "rb");
+  if (f == NULL)
+    return;
+
+  while (TRUE)
+    {
+      xa = XauReadAuth (f);
+      if (xa == NULL)
+        break;
+      if (xauth_entry_should_propagate (xa, unames.nodename, number))
+        {
+          local_xa = *xa;
+          if (local_xa.number)
+            {
+              local_xa.number = "99";
+              local_xa.number_length = 2;
+            }
+
+          if (!XauWriteAuth (output, &local_xa))
+            g_warning ("xauth write error");
+        }
+
+      XauDisposeAuth (xa);
+    }
+
+  fclose (f);
+}
+#endif /* ENABLE_XAUTH */
+
+static void
+add_args (GPtrArray *argv_array, ...)
+{
+  va_list args;
+  const gchar *arg;
+
+  va_start (args, argv_array);
+  while ((arg = va_arg (args, const gchar *)))
+    g_ptr_array_add (argv_array, g_strdup (arg));
+  va_end (args);
+}
+
+static void
+add_args_data_fd (GPtrArray *argv_array,
+                  GArray    *fd_array,
+                  const char *op,
+                  int fd,
+                  const char *path_optional)
+{
+  g_autofree char *fd_str = g_strdup_printf ("%d", fd);
+  if (fd_array)
+    g_array_append_val (fd_array, fd);
+
+  add_args (argv_array,
+            op, fd_str, path_optional,
+            NULL);
+}
+
+
+/* If memfd_create() is available, generate a sealed memfd with contents of
+ * @str. Otherwise use an O_TMPFILE @tmpf in anonymous mode, write @str to
+ * @tmpf, and lseek() back to the start. See also similar uses in e.g.
+ * rpm-ostree for running dracut.
+ */
+static gboolean
+buffer_to_sealed_memfd_or_tmpfile (GLnxTmpfile *tmpf,
+                                   const char  *name,
+                                   const char  *str,
+                                   size_t       len,
+                                   GError     **error)
+{
+  if (len == -1)
+    len = strlen (str);
+  glnx_autofd int memfd = memfd_create (name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
+  int fd; /* Unowned */
+  if (memfd != -1)
+    {
+      fd = memfd;
+    }
+  else
+    {
+      /* We use an anonymous fd (i.e. O_EXCL) since we don't want
+       * the target container to potentially be able to re-link it.
+       */
+      if (!G_IN_SET (errno, ENOSYS, EOPNOTSUPP))
+        return glnx_throw_errno_prefix (error, "memfd_create");
+      if (!glnx_open_anonymous_tmpfile (O_RDWR | O_CLOEXEC, tmpf, error))
+        return FALSE;
+      fd = tmpf->fd;
+    }
+  if (ftruncate (fd, len) < 0)
+    return glnx_throw_errno_prefix (error, "ftruncate");
+  if (glnx_loop_write (fd, str, len) < 0)
+    return glnx_throw_errno_prefix (error, "write");
+  if (lseek (fd, 0, SEEK_SET) < 0)
+    return glnx_throw_errno_prefix (error, "lseek");
+  if (memfd != -1)
+    {
+      if (fcntl (memfd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE | F_SEAL_SEAL) < 0)
+        return glnx_throw_errno_prefix (error, "fcntl(F_ADD_SEALS)");
+      /* The other values can stay default */
+      tmpf->fd = glnx_steal_fd (&memfd);
+      tmpf->initialized = TRUE;
+    }
+  return TRUE;
+}
+
+static void
+flatpak_run_add_x11_args (FlatpakBwrap *bwrap,
+                          gboolean allowed)
+{
+  g_autofree char *x11_socket = NULL;
+  const char *display;
+
+  /* Always cover /tmp/.X11-unix, that way we never see the host one in case
+   * we have access to the host /tmp. If you request X access we'll put the right
+   * thing in this anyway.
+   */
+  flatpak_bwrap_add_args (bwrap,
+                          "--tmpfs", "/tmp/.X11-unix",
+                          NULL);
+
+  if (!allowed)
+    {
+      flatpak_bwrap_unset_env (bwrap, "DISPLAY");
+      return;
+    }
+
+  g_debug ("Allowing x11 access");
+
+  display = g_getenv ("DISPLAY");
+  if (display && display[0] == ':' && g_ascii_isdigit (display[1]))
+    {
+      const char *display_nr = &display[1];
+      const char *display_nr_end = display_nr;
+      g_autofree char *d = NULL;
+
+      while (g_ascii_isdigit (*display_nr_end))
+        display_nr_end++;
+
+      d = g_strndup (display_nr, display_nr_end - display_nr);
+      x11_socket = g_strdup_printf ("/tmp/.X11-unix/X%s", d);
+
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", x11_socket, "/tmp/.X11-unix/X99",
+                              NULL);
+      flatpak_bwrap_set_env (bwrap, "DISPLAY", ":99.0", TRUE);
+
+#ifdef ENABLE_XAUTH
+      g_auto(GLnxTmpfile) xauth_tmpf  = { 0, };
+
+      if (glnx_open_anonymous_tmpfile (O_RDWR | O_CLOEXEC, &xauth_tmpf, NULL))
+        {
+          FILE *output = fdopen (xauth_tmpf.fd, "wb");
+          if (output != NULL)
+            {
+              /* fd is now owned by output, steal it from the tmpfile */
+              int tmp_fd = dup (glnx_steal_fd (&xauth_tmpf.fd));
+              if (tmp_fd != -1)
+                {
+                  g_autofree char *dest = g_strdup_printf ("/run/user/%d/Xauthority", getuid ());
+
+                  write_xauth (d, output);
+                  flatpak_bwrap_add_args_data_fd (bwrap, "--bind-data", tmp_fd, dest);
+
+                  flatpak_bwrap_set_env (bwrap, "XAUTHORITY", dest, TRUE);
+                }
+
+              fclose (output);
+
+              if (tmp_fd != -1)
+                lseek (tmp_fd, 0, SEEK_SET);
+            }
+        }
+#endif
+    }
+  else
+    {
+      flatpak_bwrap_unset_env (bwrap, "DISPLAY");
+    }
+
+}
+
+static void
+flatpak_run_add_wayland_args (FlatpakBwrap *bwrap)
+{
+  const char *wayland_display;
+  g_autofree char *wayland_socket = NULL;
+  g_autofree char *sandbox_wayland_socket = NULL;
+
+  wayland_display = g_getenv ("WAYLAND_DISPLAY");
+  if (!wayland_display)
+    wayland_display = "wayland-0";
+
+  wayland_socket = g_build_filename (g_get_user_runtime_dir (), wayland_display, NULL);
+  sandbox_wayland_socket = g_strdup_printf ("/run/user/%d/%s", getuid (), wayland_display);
+
+  if (g_file_test (wayland_socket, G_FILE_TEST_EXISTS))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", wayland_socket, sandbox_wayland_socket,
+                              NULL);
+    }
+}
+
+static void
+flatpak_run_add_pulseaudio_args (FlatpakBwrap *bwrap)
+{
+  g_autofree char *pulseaudio_socket = g_build_filename (g_get_user_runtime_dir (), "pulse/native", NULL);
+
+  flatpak_bwrap_unset_env (bwrap, "PULSE_SERVER");
+
+  if (g_file_test (pulseaudio_socket, G_FILE_TEST_EXISTS))
+    {
+      gboolean share_shm = FALSE; /* TODO: When do we add this? */
+      g_autofree char *client_config = g_strdup_printf ("enable-shm=%s\n", share_shm ? "yes" : "no");
+      g_autofree char *sandbox_socket_path = g_strdup_printf ("/run/user/%d/pulse/native", getuid ());
+      g_autofree char *pulse_server = g_strdup_printf ("unix:/run/user/%d/pulse/native", getuid ());
+      g_autofree char *config_path = g_strdup_printf ("/run/user/%d/pulse/config", getuid ());
+
+      /* FIXME - error handling */
+      if (!flatpak_bwrap_add_args_data (bwrap, "pulseaudio", client_config, -1, config_path, NULL))
+        return;
+
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", pulseaudio_socket, sandbox_socket_path,
+                              NULL);
+
+      flatpak_bwrap_set_env (bwrap, "PULSE_SERVER", pulse_server, TRUE);
+      flatpak_bwrap_set_env (bwrap, "PULSE_CLIENTCONFIG", config_path, TRUE);
+    }
+}
+
+static void
+flatpak_run_add_journal_args (FlatpakBwrap *bwrap)
+{
+  g_autofree char *journal_socket_socket = g_strdup ("/run/systemd/journal/socket");
+  g_autofree char *journal_stdout_socket = g_strdup ("/run/systemd/journal/stdout");
+
+  if (g_file_test (journal_socket_socket, G_FILE_TEST_EXISTS))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", journal_socket_socket, journal_socket_socket,
+                              NULL);
+    }
+  if (g_file_test (journal_stdout_socket, G_FILE_TEST_EXISTS))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", journal_stdout_socket, journal_stdout_socket,
+                              NULL);
+    }
+}
+
+static char *
+create_proxy_socket (char *template)
+{
+  g_autofree char *proxy_socket_dir = g_build_filename (g_get_user_runtime_dir (), ".dbus-proxy", NULL);
+  g_autofree char *proxy_socket = g_build_filename (proxy_socket_dir, template, NULL);
+  int fd;
+
+  if (!glnx_shutil_mkdir_p_at (AT_FDCWD, proxy_socket_dir, 0755, NULL, NULL))
+    return NULL;
+
+  fd = g_mkstemp (proxy_socket);
+  if (fd == -1)
+    return NULL;
+
+  close (fd);
+
+  return g_steal_pointer (&proxy_socket);
+}
+
+static gboolean
+flatpak_run_add_system_dbus_args (FlatpakContext *context,
+                                  FlatpakBwrap   *bwrap,
+                                  GPtrArray      *dbus_proxy_argv,
+                                  gboolean        unrestricted)
+{
+  const char *dbus_address = g_getenv ("DBUS_SYSTEM_BUS_ADDRESS");
+  g_autofree char *real_dbus_address = NULL;
+  g_autofree char *dbus_system_socket = NULL;
+
+  if (dbus_address != NULL)
+    dbus_system_socket = extract_unix_path_from_dbus_address (dbus_address);
+  else if (g_file_test ("/var/run/dbus/system_bus_socket", G_FILE_TEST_EXISTS))
+    dbus_system_socket = g_strdup ("/var/run/dbus/system_bus_socket");
+
+  if (dbus_system_socket != NULL && unrestricted)
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", dbus_system_socket, "/run/dbus/system_bus_socket",
+                              NULL);
+      flatpak_bwrap_set_env (bwrap, "DBUS_SYSTEM_BUS_ADDRESS", "unix:path=/run/dbus/system_bus_socket", TRUE);
+
+      return TRUE;
+    }
+  else if (dbus_proxy_argv &&
+           g_hash_table_size (context->system_bus_policy) > 0)
+    {
+      g_autofree char *proxy_socket = create_proxy_socket ("system-bus-proxy-XXXXXX");
+
+      if (proxy_socket == NULL)
+        return FALSE;
+
+      if (dbus_address)
+        real_dbus_address = g_strdup (dbus_address);
+      else
+        real_dbus_address = g_strdup_printf ("unix:path=%s", dbus_system_socket);
+
+      g_ptr_array_add (dbus_proxy_argv, g_strdup (real_dbus_address));
+      g_ptr_array_add (dbus_proxy_argv, g_strdup (proxy_socket));
+
+
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", proxy_socket, "/run/dbus/system_bus_socket",
+                              NULL);
+      flatpak_bwrap_set_env (bwrap, "DBUS_SYSTEM_BUS_ADDRESS", "unix:path=/run/dbus/system_bus_socket", TRUE);
+
+      return TRUE;
+    }
+  return FALSE;
+}
+
+static gboolean
+flatpak_run_add_session_dbus_args (FlatpakBwrap *bwrap,
+                                   GPtrArray *dbus_proxy_argv,
+                                   gboolean   unrestricted)
+{
+  const char *dbus_address = g_getenv ("DBUS_SESSION_BUS_ADDRESS");
+  char *dbus_session_socket = NULL;
+  g_autofree char *sandbox_socket_path = g_strdup_printf ("/run/user/%d/bus", getuid ());
+  g_autofree char *sandbox_dbus_address = g_strdup_printf ("unix:path=/run/user/%d/bus", getuid ());
+
+  if (dbus_address == NULL)
+    return FALSE;
+
+  dbus_session_socket = extract_unix_path_from_dbus_address (dbus_address);
+  if (dbus_session_socket != NULL && unrestricted)
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", dbus_session_socket, sandbox_socket_path,
+                              NULL);
+      flatpak_bwrap_set_env (bwrap, "DBUS_SESSION_BUS_ADDRESS", sandbox_dbus_address, TRUE);
+
+      return TRUE;
+    }
+  else if (dbus_proxy_argv && dbus_address != NULL)
+    {
+      g_autofree char *proxy_socket = create_proxy_socket ("session-bus-proxy-XXXXXX");
+
+      if (proxy_socket == NULL)
+        return FALSE;
+
+      g_ptr_array_add (dbus_proxy_argv, g_strdup (dbus_address));
+      g_ptr_array_add (dbus_proxy_argv, g_strdup (proxy_socket));
+
+      flatpak_bwrap_add_args (bwrap,
+                              "--bind", proxy_socket, sandbox_socket_path,
+                              NULL);
+      flatpak_bwrap_set_env (bwrap, "DBUS_SESSION_BUS_ADDRESS", sandbox_dbus_address, TRUE);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+flatpak_add_bus_filters (GPtrArray      *dbus_proxy_argv,
+                         GHashTable     *ht,
+                         const char     *app_id,
+                         FlatpakContext *context)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+
+  g_ptr_array_add (dbus_proxy_argv, g_strdup ("--filter"));
+  if (app_id)
+    {
+      g_ptr_array_add (dbus_proxy_argv, g_strdup_printf ("--own=%s", app_id));
+      g_ptr_array_add (dbus_proxy_argv, g_strdup_printf ("--own=%s.*", app_id));
+    }
+
+  g_hash_table_iter_init (&iter, ht);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      FlatpakPolicy policy = GPOINTER_TO_INT (value);
+
+      if (policy > 0)
+        g_ptr_array_add (dbus_proxy_argv, g_strdup_printf ("--%s=%s", flatpak_policy_to_string (policy), (char *) key));
+    }
+}
+
+static int
+flatpak_extension_compare_by_path (gconstpointer  _a,
+                                   gconstpointer  _b)
+{
+  const FlatpakExtension *a = _a;
+  const FlatpakExtension *b = _b;
+
+  return g_strcmp0 (a->directory, b->directory);
+}
+
+gboolean
+flatpak_run_add_extension_args (FlatpakBwrap   *bwrap,
+                                GKeyFile     *metakey,
+                                const char   *full_ref,
+                                gboolean      use_ld_so_cache,
+                                char        **extensions_out,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  g_auto(GStrv) parts = NULL;
+  g_autoptr(GString) used_extensions = g_string_new ("");
+  gboolean is_app;
+  GList *extensions, *path_sorted_extensions, *l;
+  g_autoptr(GString) ld_library_path = g_string_new ("");
+  int count = 0;
+  g_autoptr(GHashTable) mounted_tmpfs =
+    g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  g_autoptr(GHashTable) created_symlink =
+    g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  parts = g_strsplit (full_ref, "/", 0);
+  if (g_strv_length (parts) != 4)
+    return flatpak_fail (error, "Failed to determine parts from ref: %s", full_ref);
+
+  is_app = strcmp (parts[0], "app") == 0;
+
+  extensions = flatpak_list_extensions (metakey,
+                                        parts[2], parts[3]);
+
+  /* First we apply all the bindings, they are sorted alphabetically in order for parent directory
+     to be mounted before child directories */
+  path_sorted_extensions = g_list_copy (extensions);
+  path_sorted_extensions = g_list_sort (path_sorted_extensions, flatpak_extension_compare_by_path);
+
+  for (l = path_sorted_extensions; l != NULL; l = l->next)
+    {
+      FlatpakExtension *ext = l->data;
+      g_autofree char *directory = g_build_filename (is_app ? "/app" : "/usr", ext->directory, NULL);
+      g_autofree char *full_directory = g_build_filename (directory, ext->subdir_suffix, NULL);
+      g_autofree char *ref = g_build_filename (full_directory, ".ref", NULL);
+      g_autofree char *real_ref = g_build_filename (ext->files_path, ext->directory, ".ref", NULL);
+
+      if (ext->needs_tmpfs)
+        {
+          g_autofree char *parent = g_path_get_dirname (directory);
+
+          if (g_hash_table_lookup (mounted_tmpfs, parent) == NULL)
+            {
+              flatpak_bwrap_add_args (bwrap,
+                                      "--tmpfs", parent,
+                                      NULL);
+              g_hash_table_insert (mounted_tmpfs, g_steal_pointer (&parent), "mounted");
+            }
+        }
+
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", ext->files_path, full_directory,
+                              NULL);
+
+      if (g_file_test (real_ref, G_FILE_TEST_EXISTS))
+        flatpak_bwrap_add_args (bwrap,
+                                "--lock-file", ref,
+                                NULL);
+    }
+
+  g_list_free (path_sorted_extensions);
+
+  /* Then apply library directories and file merging, in extension prio order */
+
+  for (l = extensions; l != NULL; l = l->next)
+    {
+      FlatpakExtension *ext = l->data;
+      g_autofree char *directory = g_build_filename (is_app ? "/app" : "/usr", ext->directory, NULL);
+      g_autofree char *full_directory = g_build_filename (directory, ext->subdir_suffix, NULL);
+      int i;
+
+      if (used_extensions->len > 0)
+        g_string_append (used_extensions, ";");
+      g_string_append (used_extensions, ext->installed_id);
+      g_string_append (used_extensions, "=");
+      if (ext->commit != NULL)
+        g_string_append (used_extensions, ext->commit);
+      else
+        g_string_append (used_extensions, "local");
+
+      if (ext->add_ld_path)
+        {
+          g_autofree char *ld_path = g_build_filename (full_directory, ext->add_ld_path, NULL);
+
+          if (use_ld_so_cache)
+            {
+              g_autofree char *contents = g_strconcat (ld_path, "\n", NULL);
+              /* We prepend app or runtime and a counter in order to get the include order correct for the conf files */
+              g_autofree char *ld_so_conf_file = g_strdup_printf ("%s-%03d-%s.conf", parts[0], ++count, ext->installed_id);
+              g_autofree char *ld_so_conf_file_path = g_build_filename ("/run/flatpak/ld.so.conf.d", ld_so_conf_file, NULL);
+
+              if (!flatpak_bwrap_add_args_data (bwrap, "ld-so-conf",
+                                                contents, -1, ld_so_conf_file_path, error))
+                return FALSE;
+            }
+          else
+            {
+              if (ld_library_path->len != 0)
+                g_string_append (ld_library_path, ":");
+              g_string_append (ld_library_path, ld_path);
+            }
+        }
+
+      for (i = 0; ext->merge_dirs != NULL && ext->merge_dirs[i] != NULL; i++)
+        {
+          g_autofree char *parent = g_path_get_dirname (directory);
+          g_autofree char *merge_dir = g_build_filename (parent, ext->merge_dirs[i], NULL);
+          g_autofree char *source_dir = g_build_filename (ext->files_path, ext->merge_dirs[i], NULL);
+          g_auto(GLnxDirFdIterator) source_iter = { 0 };
+          struct dirent *dent;
+
+          if (glnx_dirfd_iterator_init_at (AT_FDCWD, source_dir, TRUE, &source_iter, NULL))
+            {
+              while (glnx_dirfd_iterator_next_dent (&source_iter, &dent, NULL, NULL) && dent != NULL)
+                {
+                  g_autofree char *symlink_path = g_build_filename (merge_dir, dent->d_name, NULL);
+                  /* Only create the first, because extensions are listed in prio order */
+                  if (g_hash_table_lookup (created_symlink, symlink_path) == NULL)
+                    {
+                      g_autofree char *symlink = g_build_filename (directory, ext->merge_dirs[i], dent->d_name, NULL);
+                      flatpak_bwrap_add_args (bwrap,
+                                              "--symlink", symlink, symlink_path,
+                                              NULL);
+                      g_hash_table_insert (created_symlink, g_steal_pointer (&symlink_path), "created");
+                    }
+                }
+            }
+        }
+    }
+
+  g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
+
+  if (ld_library_path->len != 0)
+    {
+      const gchar *old_ld_path = g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH");
+
+      if (old_ld_path != NULL && *old_ld_path != 0)
+        {
+          if (is_app)
+            {
+              g_string_append (ld_library_path, ":");
+              g_string_append (ld_library_path, old_ld_path);
+            }
+          else
+            {
+              g_string_prepend (ld_library_path, ":");
+              g_string_prepend (ld_library_path, old_ld_path);
+            }
+        }
+
+      flatpak_bwrap_set_env (bwrap, "LD_LIBRARY_PATH", ld_library_path->str , TRUE);
+    }
+
+  if (extensions_out)
+    *extensions_out = g_string_free (g_steal_pointer (&used_extensions), FALSE);
+
+  return TRUE;
+}
+
+static char *
+make_relative (const char *base, const char *path)
+{
+  GString *s = g_string_new ("");
+
+  while (*base != 0)
+    {
+      while (*base == '/')
+        base++;
+
+      if (*base != 0)
+        g_string_append (s, "../");
+
+      while (*base != '/' && *base != 0)
+        base++;
+    }
+
+  while (*path == '/')
+    path++;
+
+  g_string_append (s, path);
+
+  return g_string_free (s, FALSE);
+}
+
+#define FAKE_MODE_DIR -1 /* Ensure a dir, either on tmpfs or mapped parent */
+#define FAKE_MODE_TMPFS 0
+#define FAKE_MODE_SYMLINK G_MAXINT
+
+typedef struct {
+  char *path;
+  gint mode;
+} ExportedPath;
+
+struct _FlatpakExports {
+  GHashTable *hash;
+  FlatpakFilesystemMode host_fs;
+};
+
+static void
+exported_path_free (ExportedPath *exported_path)
+{
+  g_free (exported_path->path);
+  g_free (exported_path);
+}
+
+static FlatpakExports *
+exports_new (void)
+{
+  FlatpakExports *exports = g_new0 (FlatpakExports, 1);
+  exports->hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GFreeFunc)exported_path_free);
+  return exports;
+}
+
+void
+flatpak_exports_free (FlatpakExports *exports)
+{
+  g_hash_table_destroy (exports->hash);
+  g_free (exports);
+}
+
+/* Returns TRUE if the location of this export
+   is not visible due to parents being exported */
+static gboolean
+path_parent_is_mapped (const char **keys,
+                       guint n_keys,
+                       GHashTable *hash_table,
+                       const char *path)
+{
+  guint i;
+  gboolean is_mapped = FALSE;
+
+  /* The keys are sorted so shorter (i.e. parents) are first */
+  for (i = 0; i < n_keys; i++)
+    {
+      const char *mounted_path = keys[i];
+      ExportedPath *ep = g_hash_table_lookup (hash_table, mounted_path);
+
+      if (flatpak_has_path_prefix (path, mounted_path) &&
+          (strcmp (path, mounted_path) != 0))
+        {
+          /* FAKE_MODE_DIR has same mapped value as parent */
+          if (ep->mode == FAKE_MODE_DIR)
+            continue;
+
+          is_mapped = ep->mode != FAKE_MODE_TMPFS;
+        }
+    }
+
+  return is_mapped;
+}
+
+static gboolean
+path_is_mapped (const char **keys,
+                guint n_keys,
+                GHashTable *hash_table,
+                const char *path)
+{
+  guint i;
+  gboolean is_mapped = FALSE;
+
+  /* The keys are sorted so shorter (i.e. parents) are first */
+  for (i = 0; i < n_keys; i++)
+    {
+      const char *mounted_path = keys[i];
+      ExportedPath *ep = g_hash_table_lookup (hash_table, mounted_path);
+
+      if (flatpak_has_path_prefix (path, mounted_path))
+        {
+          /* FAKE_MODE_DIR has same mapped value as parent */
+          if (ep->mode == FAKE_MODE_DIR)
+            continue;
+
+          if (ep->mode == FAKE_MODE_SYMLINK)
+            is_mapped = strcmp (path, mounted_path) == 0;
+          else
+            is_mapped = ep->mode != FAKE_MODE_TMPFS;
+        }
+    }
+
+  return is_mapped;
+}
+
+static gint
+compare_eps (const ExportedPath *a,
+             const ExportedPath *b)
+{
+  return g_strcmp0 (a->path, b->path);
+}
+
+/* This differs from g_file_test (path, G_FILE_TEST_IS_DIR) which
+   returns true if the path is a symlink to a dir */
+static gboolean
+path_is_dir (const char *path)
+{
+  struct stat s;
+
+  if (lstat (path, &s) != 0)
+    return FALSE;
+
+  return S_ISDIR (s.st_mode);
+}
+
+static gboolean
+path_is_symlink (const char *path)
+{
+  struct stat s;
+
+  if (lstat (path, &s) != 0)
+    return FALSE;
+
+  return S_ISLNK (s.st_mode);
+}
+
+static void
+exports_add_bwrap_args (FlatpakExports *exports,
+                        FlatpakBwrap *bwrap)
+{
+  guint n_keys;
+  g_autofree const char **keys = (const char **)g_hash_table_get_keys_as_array (exports->hash, &n_keys);
+  g_autoptr(GList) eps = NULL;
+  GList *l;
+
+  eps = g_hash_table_get_values (exports->hash);
+  eps = g_list_sort (eps, (GCompareFunc)compare_eps);
+
+  g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) flatpak_strcmp0_ptr, NULL);
+
+  for (l = eps; l != NULL; l = l->next)
+    {
+      ExportedPath *ep = l->data;
+      const char *path = ep->path;
+
+      if (ep->mode == FAKE_MODE_SYMLINK)
+        {
+          if (!path_parent_is_mapped (keys, n_keys, exports->hash, path))
+            {
+              g_autofree char *resolved = flatpak_resolve_link (path, NULL);
+              if (resolved)
+                {
+                  g_autofree char *parent = g_path_get_dirname (path);
+                  g_autofree char *relative = make_relative (parent, resolved);
+                  flatpak_bwrap_add_args (bwrap, "--symlink", relative, path,  NULL);
+                }
+            }
+        }
+      else if (ep->mode == FAKE_MODE_TMPFS)
+        {
+          /* Mount a tmpfs to hide the subdirectory, but only if there
+             is a pre-existing dir we can mount the path on. */
+          if (path_is_dir (path))
+            {
+              if (!path_parent_is_mapped (keys, n_keys, exports->hash, path))
+                /* If the parent is not mapped, it will be a tmpfs, no need to mount another one */
+                flatpak_bwrap_add_args (bwrap, "--dir", path, NULL);
+              else
+                flatpak_bwrap_add_args (bwrap, "--tmpfs", path, NULL);
+            }
+        }
+      else if (ep->mode == FAKE_MODE_DIR)
+        {
+          if (path_is_dir (path))
+            flatpak_bwrap_add_args (bwrap, "--dir", path, NULL);
+        }
+      else
+        {
+          flatpak_bwrap_add_args (bwrap,
+                                  (ep->mode == FLATPAK_FILESYSTEM_MODE_READ_ONLY) ? "--ro-bind" : "--bind",
+                                  path, path, NULL);
+        }
+    }
+
+  if (exports->host_fs != 0)
+    {
+      if (g_file_test ("/usr", G_FILE_TEST_IS_DIR))
+       flatpak_bwrap_add_args (bwrap,
+                               (exports->host_fs == FLATPAK_FILESYSTEM_MODE_READ_ONLY) ? "--ro-bind" : "--bind",
+                               "/usr", "/run/host/usr", NULL);
+      if (g_file_test ("/etc", G_FILE_TEST_IS_DIR))
+       flatpak_bwrap_add_args (bwrap,
+                               (exports->host_fs == FLATPAK_FILESYSTEM_MODE_READ_ONLY) ? "--ro-bind" : "--bind",
+                               "/etc", "/run/host/etc", NULL);
+    }
+}
+
+gboolean
+flatpak_exports_path_is_visible (FlatpakExports *exports,
+                                 const char *path)
+{
+  guint n_keys;
+  g_autofree const char **keys = (const char **)g_hash_table_get_keys_as_array (exports->hash, &n_keys);
+  g_autofree char *canonical = NULL;
+  g_auto(GStrv) parts = NULL;
+  int i;
+  g_autoptr(GString) path_builder = g_string_new ("");
+  struct stat st;
+
+  g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) flatpak_strcmp0_ptr, NULL);
+
+  path = canonical = flatpak_canonicalize_filename (path);
+
+  parts = g_strsplit (path+1, "/", -1);
+
+  /* A path is visible in the sandbox if no parent
+   * path element that is mapped in the sandbox is
+   * a symlink, and the final element is mapped.
+   * If any parent is a symlink we resolve that and
+   * continue with that instead.
+   */
+  for (i = 0; parts[i] != NULL; i++)
+    {
+      g_string_append (path_builder, "/");
+      g_string_append (path_builder, parts[i]);
+
+      if (path_is_mapped (keys, n_keys, exports->hash, path_builder->str))
+        {
+          if (lstat (path_builder->str, &st) != 0)
+            return FALSE;
+
+          if (S_ISLNK (st.st_mode))
+            {
+              g_autofree char *resolved = flatpak_resolve_link (path_builder->str, NULL);
+              g_autoptr(GString) path2_builder = NULL;
+              int j;
+
+              if (resolved == NULL)
+                return FALSE;
+              path2_builder = g_string_new (resolved);
+
+              for (j = i + 1; parts[j] != NULL; j++)
+                {
+                  g_string_append (path2_builder, "/");
+                  g_string_append (path2_builder, parts[j]);
+                }
+
+
+              return flatpak_exports_path_is_visible (exports, path2_builder->str);
+            }
+        }
+      else if (parts[i+1] == NULL)
+        return FALSE; /* Last part was not mapped */
+    }
+
+  return TRUE;
+}
+
+static gboolean
+never_export_as_symlink (const char *path)
+{
+  /* Don't export /tmp as a symlink even if it is on the host, because
+     that will fail with the pre-existing directory we created for /tmp,
+     and anyway, it being a symlink is not useful in the sandbox */
+  if (strcmp (path, "/tmp") == 0)
+    return TRUE;
+
+  return FALSE;
+}
+
+static void
+do_export_path (FlatpakExports *exports,
+                const char *path,
+                gint mode)
+{
+  ExportedPath *old_ep = g_hash_table_lookup (exports->hash, path);
+  ExportedPath *ep;
+
+  ep = g_new0 (ExportedPath, 1);
+  ep->path = g_strdup (path);
+
+  if (old_ep != NULL)
+    ep->mode = MAX (old_ep->mode, mode);
+  else
+    ep->mode = mode;
+
+  g_hash_table_replace (exports->hash, ep->path, ep);
+}
+
+
+/* We use level to avoid infinite recursion */
+static gboolean
+_exports_path_expose (FlatpakExports *exports,
+                      int mode,
+                      const char *path,
+                      int level)
+{
+  g_autofree char *canonical = NULL;
+  struct stat st;
+  char *slash;
+  int i;
+
+  if (level > 40) /* 40 is the current kernel ELOOP check */
+    {
+      g_debug ("Expose too deep, bail");
+      return FALSE;
+    }
+
+  if (!g_path_is_absolute (path))
+    {
+      g_debug ("Not exposing relative path %s", path);
+      return FALSE;
+    }
+
+  /* Check if it exists at all */
+  if (lstat (path, &st) != 0)
+    return FALSE;
+
+  /* Don't expose weird things */
+  if (!(S_ISDIR (st.st_mode) ||
+        S_ISREG (st.st_mode) ||
+        S_ISLNK (st.st_mode) ||
+        S_ISSOCK (st.st_mode)))
+    return FALSE;
+
+  path = canonical = flatpak_canonicalize_filename (path);
+
+  for (i = 0; dont_export_in[i] != NULL; i++)
+    {
+      /* Don't expose files in non-mounted dirs like /app or /usr, as
+         they are not the same as on the host, and we generally can't
+         create the parents for them anyway */
+      if (flatpak_has_path_prefix (path, dont_export_in[i]))
+        {
+          g_debug ("skipping export for path %s", path);
+          return FALSE;
+        }
+    }
+
+  /* Handle any symlinks prior to the target itself. This includes path itself,
+     because we expose the target of the symlink. */
+  slash = canonical;
+  do
+    {
+      slash = strchr (slash + 1, '/');
+      if (slash)
+        *slash = 0;
+
+      if (path_is_symlink (path) && !never_export_as_symlink (path))
+        {
+          g_autofree char *resolved = flatpak_resolve_link (path, NULL);
+          g_autofree char *new_target = NULL;
+
+          if (resolved)
+            {
+              if (slash)
+                new_target = g_build_filename (resolved, slash + 1, NULL);
+              else
+                new_target = g_strdup (resolved);
+
+              if (_exports_path_expose (exports, mode, new_target, level + 1))
+                {
+                  do_export_path (exports, path, FAKE_MODE_SYMLINK);
+                  return TRUE;
+                }
+            }
+
+          return FALSE;
+        }
+      if (slash)
+        *slash = '/';
+    }
+  while (slash != NULL);
+
+  do_export_path (exports, path, mode);
+  return TRUE;
+}
+
+static void
+exports_path_expose (FlatpakExports *exports,
+                     FlatpakFilesystemMode mode,
+                     const char *path)
+{
+  _exports_path_expose (exports, mode, path, 0);
+}
+
+static void
+exports_path_tmpfs (FlatpakExports *exports,
+                    const char *path)
+{
+  _exports_path_expose (exports, FAKE_MODE_TMPFS, path, 0);
+}
+
+static void
+exports_path_expose_or_hide (FlatpakExports *exports,
+                             FlatpakFilesystemMode mode,
+                             const char *path)
+{
+  if (mode == 0)
+    exports_path_tmpfs (exports, path);
+  else
+    exports_path_expose (exports, mode, path);
+}
+
+static void
+exports_path_dir (FlatpakExports *exports,
+                  const char *path)
+{
+  _exports_path_expose (exports, FAKE_MODE_DIR, path, 0);
+}
+
+static void
+export_paths_export_context (FlatpakContext *context,
+                             FlatpakExports *exports,
+                             GFile *app_id_dir,
+                             gboolean do_create,
+                             GString *xdg_dirs_conf,
+                             gboolean *home_access_out)
+{
+  gboolean home_access = FALSE;
+  FlatpakFilesystemMode fs_mode, home_mode;
+  GHashTableIter iter;
+  gpointer key, value;
+
+  fs_mode = (FlatpakFilesystemMode) g_hash_table_lookup (context->filesystems, "host");
+  if (fs_mode != 0)
+    {
+      DIR *dir;
+      struct dirent *dirent;
+
+      g_debug ("Allowing host-fs access");
+      home_access = TRUE;
+
+      /* Bind mount most dirs in / into the new root */
+      dir = opendir ("/");
+      if (dir != NULL)
+        {
+          while ((dirent = readdir (dir)))
+            {
+              g_autofree char *path = NULL;
+
+              if (g_strv_contains (dont_mount_in_root, dirent->d_name))
+                continue;
+
+              path = g_build_filename ("/", dirent->d_name, NULL);
+              exports_path_expose (exports, fs_mode, path);
+            }
+          closedir (dir);
+        }
+      exports_path_expose (exports, fs_mode, "/run/media");
+      exports->host_fs = fs_mode;
+    }
+
+  home_mode = (FlatpakFilesystemMode) g_hash_table_lookup (context->filesystems, "home");
+  if (home_mode != 0)
+    {
+      g_debug ("Allowing homedir access");
+      home_access = TRUE;
+
+      exports_path_expose (exports, MAX (home_mode, fs_mode), g_get_home_dir ());
+    }
+
+  g_hash_table_iter_init (&iter, context->filesystems);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *filesystem = key;
+      FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);
+
+      if (strcmp (filesystem, "host") == 0 ||
+          strcmp (filesystem, "home") == 0)
+        continue;
+
+      if (g_str_has_prefix (filesystem, "xdg-"))
+        {
+          const char *path, *rest = NULL;
+          const char *config_key = NULL;
+          g_autofree char *subpath = NULL;
+
+          if (!get_xdg_user_dir_from_string (filesystem, &config_key, &rest, &path))
+            {
+              g_warning ("Unsupported xdg dir %s", filesystem);
+              continue;
+            }
+
+          if (path == NULL)
+            continue; /* Unconfigured, ignore */
+
+          if (strcmp (path, g_get_home_dir ()) == 0)
+            {
+              /* xdg-user-dirs sets disabled dirs to $HOME, and its in general not a good
+                 idea to set full access to $HOME other than explicitly, so we ignore
+                 these */
+              g_debug ("Xdg dir %s is $HOME (i.e. disabled), ignoring", filesystem);
+              continue;
+            }
+
+          subpath = g_build_filename (path, rest, NULL);
+
+          if (mode == FLATPAK_FILESYSTEM_MODE_CREATE && do_create)
+            g_mkdir_with_parents (subpath, 0755);
+
+          if (g_file_test (subpath, G_FILE_TEST_EXISTS))
+            {
+              if (config_key && xdg_dirs_conf)
+                g_string_append_printf (xdg_dirs_conf, "%s=\"%s\"\n",
+                                        config_key, path);
+
+              exports_path_expose_or_hide (exports, mode, subpath);
+            }
+        }
+      else if (g_str_has_prefix (filesystem, "~/"))
+        {
+          g_autofree char *path = NULL;
+
+          path = g_build_filename (g_get_home_dir (), filesystem + 2, NULL);
+
+          if (mode == FLATPAK_FILESYSTEM_MODE_CREATE && do_create)
+            g_mkdir_with_parents (path, 0755);
+
+          if (g_file_test (path, G_FILE_TEST_EXISTS))
+            exports_path_expose_or_hide (exports, mode, path);
+        }
+      else if (g_str_has_prefix (filesystem, "/"))
+        {
+          if (mode == FLATPAK_FILESYSTEM_MODE_CREATE && do_create)
+            g_mkdir_with_parents (filesystem, 0755);
+
+          if (g_file_test (filesystem, G_FILE_TEST_EXISTS))
+            exports_path_expose_or_hide (exports, mode, filesystem);
+        }
+      else
+        {
+          g_warning ("Unexpected filesystem arg %s", filesystem);
+        }
+    }
+
+  if (app_id_dir)
+    {
+      g_autoptr(GFile) apps_dir = g_file_get_parent (app_id_dir);
+      /* Hide the .var/app dir by default (unless explicitly made visible) */
+      exports_path_tmpfs (exports, flatpak_file_get_path_cached (apps_dir));
+      /* But let the app write to the per-app dir in it */
+      exports_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_WRITE,
+                           flatpak_file_get_path_cached (app_id_dir));
+    }
+
+  if (home_access_out != NULL)
+    *home_access_out = home_access;
+}
+
+FlatpakExports *
+flatpak_exports_from_context (FlatpakContext *context,
+                              const char *app_id)
+{
+  g_autoptr(FlatpakExports) exports = exports_new ();
+  g_autoptr(GFile) app_id_dir = flatpak_get_data_dir (app_id);
+
+  export_paths_export_context (context, exports, app_id_dir, FALSE, NULL, NULL);
+  return g_steal_pointer (&exports);
+}
+
+gboolean
+flatpak_run_add_environment_args (FlatpakBwrap   *bwrap,
+                                  const char     *app_info_path,
+                                  FlatpakRunFlags flags,
+                                  const char     *app_id,
+                                  FlatpakContext *context,
+                                  GFile          *app_id_dir,
+                                  FlatpakExports **exports_out,
+                                  GCancellable   *cancellable,
+                                  GError        **error)
+{
+  gboolean home_access = FALSE;
+  GHashTableIter iter;
+  gpointer key, value;
+  gboolean unrestricted_session_bus;
+  gboolean unrestricted_system_bus;
+  g_autoptr(GString) xdg_dirs_conf = g_string_new ("");
+  g_autoptr(GError) my_error = NULL;
+  g_autoptr(GFile) user_flatpak_dir = NULL;
+  g_autoptr(FlatpakExports) exports = exports_new ();
+  g_autoptr(GPtrArray) session_bus_proxy_argv = NULL;
+  g_autoptr(GPtrArray) system_bus_proxy_argv = NULL;
+  g_autoptr(GPtrArray) a11y_bus_proxy_argv = NULL;
+  int sync_fds[2] = {-1, -1};
+
+  if ((flags & FLATPAK_RUN_FLAG_NO_SESSION_BUS_PROXY) == 0)
+    session_bus_proxy_argv = g_ptr_array_new_with_free_func (g_free);
+  if ((flags & FLATPAK_RUN_FLAG_NO_SYSTEM_BUS_PROXY) == 0)
+    system_bus_proxy_argv = g_ptr_array_new_with_free_func (g_free);
+
+ if ((context->shares & FLATPAK_CONTEXT_SHARED_IPC) == 0)
+    {
+      g_debug ("Disallowing ipc access");
+      flatpak_bwrap_add_args (bwrap, "--unshare-ipc", NULL);
+    }
+
+  if ((context->shares & FLATPAK_CONTEXT_SHARED_NETWORK) == 0)
+    {
+      g_debug ("Disallowing network access");
+      flatpak_bwrap_add_args (bwrap, "--unshare-net", NULL);
+    }
+
+  if (context->devices & FLATPAK_CONTEXT_DEVICE_ALL)
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--dev-bind", "/dev", "/dev",
+                              NULL);
+    }
+  else
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--dev", "/dev",
+                              NULL);
+      if (context->devices & FLATPAK_CONTEXT_DEVICE_DRI)
+        {
+          g_debug ("Allowing dri access");
+          int i;
+          char *dri_devices[] = {
+            "/dev/dri",
+            /* mali */
+            "/dev/mali",
+            "/dev/mali0",
+            "/dev/umplock",
+            /* nvidia */
+            "/dev/nvidiactl",
+            "/dev/nvidia0",
+            "/dev/nvidia-modeset",
+          };
+
+          for (i = 0; i < G_N_ELEMENTS(dri_devices); i++)
+            {
+              if (g_file_test (dri_devices[i], G_FILE_TEST_EXISTS))
+                flatpak_bwrap_add_args (bwrap, "--dev-bind", dri_devices[i], dri_devices[i], NULL);
+            }
+        }
+
+      if (context->devices & FLATPAK_CONTEXT_DEVICE_KVM)
+        {
+          g_debug ("Allowing kvm access");
+          if (g_file_test ("/dev/kvm", G_FILE_TEST_EXISTS))
+            flatpak_bwrap_add_args (bwrap, "--dev-bind", "/dev/kvm", "/dev/kvm", NULL);
+        }
+    }
+
+  export_paths_export_context (context, exports, app_id_dir, TRUE, xdg_dirs_conf, &home_access);
+  if (app_id_dir != NULL)
+    flatpak_run_apply_env_appid (bwrap, app_id_dir);
+
+  if (!home_access)
+    {
+      /* Enable persistent mapping only if no access to real home dir */
+
+      g_hash_table_iter_init (&iter, context->persistent);
+      while (g_hash_table_iter_next (&iter, &key, NULL))
+        {
+          const char *persist = key;
+          g_autofree char *src = g_build_filename (g_get_home_dir (), ".var/app", app_id, persist, NULL);
+          g_autofree char *dest = g_build_filename (g_get_home_dir (), persist, NULL);
+
+          g_mkdir_with_parents (src, 0755);
+
+          /* We stick to flatpak_bwrap_add_args instead of flatpak_bwrap_add_bind_arg because persisted
+           * folders don't need to exist outside the chroot.
+           */
+          flatpak_bwrap_add_args (bwrap, "--bind", src, dest, NULL);
+        }
+    }
+
+  {
+    g_autofree char *run_user_app_dst = g_strdup_printf ("/run/user/%d/app/%s", getuid (), app_id);
+    g_autofree char *run_user_app_src = g_build_filename (g_get_user_runtime_dir (), "app", app_id, NULL);
+
+    if (glnx_shutil_mkdir_p_at (AT_FDCWD,
+                                run_user_app_src,
+                                0700,
+                                NULL,
+                                NULL))
+        flatpak_bwrap_add_args (bwrap,
+                                "--bind", run_user_app_src, run_user_app_dst,
+                                NULL);
+  }
+
+  /* Hide the flatpak dir by default (unless explicitly made visible) */
+  user_flatpak_dir = flatpak_get_user_base_dir_location ();
+  exports_path_tmpfs (exports, flatpak_file_get_path_cached (user_flatpak_dir));
+
+  /* Ensure we always have a homedir */
+  exports_path_dir (exports, g_get_home_dir ());
+
+  /* This actually outputs the args for the hide/expose operations above */
+  exports_add_bwrap_args (exports, bwrap);
+
+  /* Special case subdirectories of the cache, config and data xdg
+   * dirs.  If these are accessible explicilty, then we bind-mount
+   * these in the app-id dir. This allows applications to explicitly
+   * opt out of keeping some config/cache/data in the app-specific
+   * directory.
+   */
+  if (app_id_dir)
+    {
+      g_hash_table_iter_init (&iter, context->filesystems);
+      while (g_hash_table_iter_next (&iter, &key, &value))
+        {
+          const char *filesystem = key;
+          FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);
+          g_autofree char *xdg_path = NULL;
+          const char *rest, *where;
+
+          xdg_path = get_xdg_dir_from_string (filesystem, &rest, &where);
+
+          if (xdg_path != NULL && *rest != 0 &&
+              mode >= FLATPAK_FILESYSTEM_MODE_READ_ONLY)
+            {
+              g_autoptr(GFile) app_version = g_file_get_child (app_id_dir, where);
+              g_autoptr(GFile) app_version_subdir = g_file_resolve_relative_path (app_version, rest);
+
+              if (g_file_test (xdg_path, G_FILE_TEST_IS_DIR) ||
+                  g_file_test (xdg_path, G_FILE_TEST_IS_REGULAR))
+                {
+                  g_autofree char *xdg_path_in_app = g_file_get_path (app_version_subdir);
+                  flatpak_bwrap_add_bind_arg (bwrap,
+                                              mode == FLATPAK_FILESYSTEM_MODE_READ_ONLY ? "--ro-bind" : "--bind",
+                                              xdg_path, xdg_path_in_app);
+                }
+            }
+        }
+    }
+
+  if (home_access  && app_id_dir != NULL)
+    {
+      g_autofree char *src_path = g_build_filename (g_get_user_config_dir (),
+                                                    "user-dirs.dirs",
+                                                    NULL);
+      g_autofree char *path = g_build_filename (flatpak_file_get_path_cached (app_id_dir),
+                                                "config/user-dirs.dirs", NULL);
+      if (g_file_test (src_path, G_FILE_TEST_EXISTS))
+        flatpak_bwrap_add_bind_arg (bwrap, "--ro-bind", src_path, path);
+    }
+  else if (xdg_dirs_conf->len > 0 && app_id_dir != NULL)
+    {
+      g_autofree char *path =
+        g_build_filename (flatpak_file_get_path_cached (app_id_dir),
+                          "config/user-dirs.dirs", NULL);
+
+      flatpak_bwrap_add_args_data (bwrap, "xdg-config-dirs",
+                                   xdg_dirs_conf->str, xdg_dirs_conf->len, path, NULL);
+    }
+
+  flatpak_run_add_x11_args (bwrap,
+                            (context->sockets & FLATPAK_CONTEXT_SOCKET_X11) != 0);
+
+  if (context->sockets & FLATPAK_CONTEXT_SOCKET_WAYLAND)
+    {
+      g_debug ("Allowing wayland access");
+      flatpak_run_add_wayland_args (bwrap);
+    }
+
+  if (context->sockets & FLATPAK_CONTEXT_SOCKET_PULSEAUDIO)
+    {
+      g_debug ("Allowing pulseaudio access");
+      flatpak_run_add_pulseaudio_args (bwrap);
+    }
+
+  unrestricted_session_bus = (context->sockets & FLATPAK_CONTEXT_SOCKET_SESSION_BUS) != 0;
+  if (unrestricted_session_bus)
+    g_debug ("Allowing session-dbus access");
+  if (flatpak_run_add_session_dbus_args (bwrap, session_bus_proxy_argv, unrestricted_session_bus) &&
+      !unrestricted_session_bus && session_bus_proxy_argv)
+    flatpak_add_bus_filters (session_bus_proxy_argv, context->session_bus_policy, app_id, context);
+
+  unrestricted_system_bus = (context->sockets & FLATPAK_CONTEXT_SOCKET_SYSTEM_BUS) != 0;
+  if (unrestricted_system_bus)
+    g_debug ("Allowing system-dbus access");
+  if (flatpak_run_add_system_dbus_args (context, bwrap, system_bus_proxy_argv,
+                                        unrestricted_system_bus) &&
+      !unrestricted_system_bus && system_bus_proxy_argv)
+    flatpak_add_bus_filters (system_bus_proxy_argv, context->system_bus_policy, NULL, context);
+
+  if ((flags & FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY) == 0)
+    {
+      g_autoptr(GDBusConnection) session_bus = NULL;
+      g_autofree char *a11y_address = NULL;
+
+      session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+      if (session_bus)
+        {
+          g_autoptr(GError) local_error = NULL;
+          g_autoptr(GDBusMessage) reply = NULL;
+          g_autoptr(GDBusMessage) msg =
+            g_dbus_message_new_method_call ("org.a11y.Bus",
+                                            "/org/a11y/bus",
+                                            "org.a11y.Bus",
+                                            "GetAddress");
+          g_dbus_message_set_body (msg, g_variant_new ("()"));
+          reply =
+            g_dbus_connection_send_message_with_reply_sync (session_bus, msg,
+                                                            G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+                                                            30000,
+                                                            NULL,
+                                                            NULL,
+                                                            NULL);
+          if (reply)
+            {
+              if (g_dbus_message_to_gerror (reply, &local_error))
+                {
+                  if (!g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
+                    g_message ("Can't find a11y bus: %s", local_error->message);
+                }
+              else
+                {
+                  g_variant_get (g_dbus_message_get_body (reply),
+                                 "(s)", &a11y_address);
+                }
+            }
+        }
+
+      if (a11y_address)
+        {
+          g_autofree char *proxy_socket = create_proxy_socket ("a11y-bus-proxy-XXXXXX");
+          if (proxy_socket)
+            {
+              g_autofree char *sandbox_socket_path = g_strdup_printf ("/run/user/%d/at-spi-bus", getuid ());
+              g_autofree char *sandbox_dbus_address = g_strdup_printf ("unix:path=/run/user/%d/at-spi-bus", getuid ());
+
+              a11y_bus_proxy_argv = g_ptr_array_new_with_free_func (g_free);
+
+              g_ptr_array_add (a11y_bus_proxy_argv, g_strdup (a11y_address));
+              g_ptr_array_add (a11y_bus_proxy_argv, g_strdup (proxy_socket));
+              g_ptr_array_add (a11y_bus_proxy_argv, g_strdup ("--filter"));
+              g_ptr_array_add (a11y_bus_proxy_argv, g_strdup ("--sloppy-names"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.Socket.Embed@/org/a11y/atspi/accessible/root"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.Socket.Unembed@/org/a11y/atspi/accessible/root"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.Registry.GetRegisteredEvents@/org/a11y/atspi/registry"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.DeviceEventController.GetKeystrokeListeners@/org/a11y/atspi/registry/deviceeventcontroller"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.DeviceEventController.GetDeviceEventListeners@/org/a11y/atspi/registry/deviceeventcontroller"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.DeviceEventController.NotifyListenersSync@/org/a11y/atspi/registry/deviceeventcontroller"));
+              g_ptr_array_add (a11y_bus_proxy_argv,
+                               g_strdup ("--filter=org.a11y.atspi.Registry=org.a11y.atspi.DeviceEventController.NotifyListenersAsync@/org/a11y/atspi/registry/deviceeventcontroller"));
+
+              flatpak_bwrap_add_args (bwrap,
+                                      "--bind", proxy_socket, sandbox_socket_path,
+                                      NULL);
+              flatpak_bwrap_set_env (bwrap, "AT_SPI_BUS_ADDRESS", sandbox_dbus_address, TRUE);
+            }
+        }
+    }
+
+  if (g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH") != NULL)
+    {
+      /* LD_LIBRARY_PATH is overridden for setuid helper, so pass it as cmdline arg */
+      flatpak_bwrap_add_args (bwrap,
+                              "--setenv", "LD_LIBRARY_PATH", g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH"),
+                              NULL);
+      flatpak_bwrap_unset_env (bwrap, "LD_LIBRARY_PATH");
+    }
+
+  /* Must run this before spawning the dbus proxy, to ensure it
+     ends up in the app cgroup */
+  if (!flatpak_run_in_transient_unit (app_id, &my_error))
+    {
+      /* We still run along even if we don't get a cgroup, as nothing
+         really depends on it. Its just nice to have */
+      g_debug ("Failed to run in transient scope: %s", my_error->message);
+      g_clear_error (&my_error);
+    }
+
+  if (!add_dbus_proxy_args (bwrap->argv,
+                            session_bus_proxy_argv, (flags & FLATPAK_RUN_FLAG_LOG_SESSION_BUS) != 0,
+                            system_bus_proxy_argv, (flags & FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS) != 0,
+                            a11y_bus_proxy_argv, (flags & FLATPAK_RUN_FLAG_LOG_A11Y_BUS) != 0,
+                            sync_fds, app_info_path, error))
+    return FALSE;
+
+  if (sync_fds[1] != -1)
+    close (sync_fds[1]);
+
+  if (exports_out)
+    *exports_out = g_steal_pointer (&exports);
+
+  return TRUE;
+}
+
+typedef struct {
+  const char *env;
+  const char *val;
+} ExportData;
+
+static const ExportData default_exports[] = {
+  {"PATH", "/app/bin:/usr/bin"},
+  /* We always want to unset LD_LIBRARY_PATH to avoid inheriting weird
+   * dependencies from the host. But if not using ld.so.cache this is
+   * later set. */
+  {"LD_LIBRARY_PATH", NULL},
+  {"XDG_CONFIG_DIRS", "/app/etc/xdg:/etc/xdg"},
+  {"XDG_DATA_DIRS", "/app/share:/usr/share"},
+  {"SHELL", "/bin/sh"},
+  {"TMPDIR", NULL}, /* Unset TMPDIR as it may not exist in the sandbox */
+
+  /* Some env vars are common enough and will affect the sandbox badly
+     if set on the host. We clear these always. */
+  {"PYTHONPATH", NULL},
+  {"PERLLIB", NULL},
+  {"PERL5LIB", NULL},
+  {"XCURSOR_PATH", NULL},
+};
+
+static const ExportData no_ld_so_cache_exports[] = {
+  {"LD_LIBRARY_PATH", "/app/lib"},
+};
+
+static const ExportData devel_exports[] = {
+  {"ACLOCAL_PATH", "/app/share/aclocal"},
+  {"C_INCLUDE_PATH", "/app/include"},
+  {"CPLUS_INCLUDE_PATH", "/app/include"},
+  {"LDFLAGS", "-L/app/lib "},
+  {"PKG_CONFIG_PATH", "/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"},
+  {"LC_ALL", "en_US.utf8"},
+};
+
+static void
+add_exports (GPtrArray *env_array,
+             const ExportData *exports,
+             gsize n_exports)
+{
+  int i;
+
+  for (i = 0; i < n_exports; i++)
+    {
+      if (exports[i].val)
+        g_ptr_array_add (env_array, g_strdup_printf ("%s=%s", exports[i].env, exports[i].val));
+    }
+}
+
+char **
+flatpak_run_get_minimal_env (gboolean devel, gboolean use_ld_so_cache)
+{
+  GPtrArray *env_array;
+  static const char * const copy[] = {
+    "PWD",
+    "GDMSESSION",
+    "XDG_CURRENT_DESKTOP",
+    "XDG_SESSION_DESKTOP",
+    "DESKTOP_SESSION",
+    "EMAIL_ADDRESS",
+    "HOME",
+    "HOSTNAME",
+    "LOGNAME",
+    "REAL_NAME",
+    "TERM",
+    "USER",
+    "USERNAME",
+  };
+  static const char * const copy_nodevel[] = {
+    "LANG",
+    "LANGUAGE",
+    "LC_ALL",
+    "LC_ADDRESS",
+    "LC_COLLATE",
+    "LC_CTYPE",
+    "LC_IDENTIFICATION",
+    "LC_MEASUREMENT",
+    "LC_MESSAGES",
+    "LC_MONETARY",
+    "LC_NAME",
+    "LC_NUMERIC",
+    "LC_PAPER",
+    "LC_TELEPHONE",
+    "LC_TIME",
+  };
+  int i;
+
+  env_array = g_ptr_array_new_with_free_func (g_free);
+
+  add_exports (env_array, default_exports, G_N_ELEMENTS (default_exports));
+
+  if (!use_ld_so_cache)
+    add_exports (env_array, no_ld_so_cache_exports, G_N_ELEMENTS (no_ld_so_cache_exports));
+
+  if (devel)
+    add_exports (env_array, devel_exports, G_N_ELEMENTS (devel_exports));
+
+  for (i = 0; i < G_N_ELEMENTS (copy); i++)
+    {
+      const char *current = g_getenv (copy[i]);
+      if (current)
+        g_ptr_array_add (env_array, g_strdup_printf ("%s=%s", copy[i], current));
+    }
+
+  if (!devel)
+    {
+      for (i = 0; i < G_N_ELEMENTS (copy_nodevel); i++)
+        {
+          const char *current = g_getenv (copy_nodevel[i]);
+          if (current)
+            g_ptr_array_add (env_array, g_strdup_printf ("%s=%s", copy_nodevel[i], current));
+        }
+    }
+
+  g_ptr_array_add (env_array, NULL);
+  return (char **) g_ptr_array_free (env_array, FALSE);
+}
+
+static char **
+apply_exports (char **envp,
+               const ExportData *exports,
+               gsize n_exports)
+{
+  int i;
+
+  for (i = 0; i < n_exports; i++)
+    {
+      const char *value = exports[i].val;
+
+      if (value)
+        envp = g_environ_setenv (envp, exports[i].env, value, TRUE);
+      else
+        envp = g_environ_unsetenv (envp, exports[i].env);
+    }
+
+  return envp;
+}
+
+void
+flatpak_run_apply_env_default (FlatpakBwrap *bwrap, gboolean use_ld_so_cache)
+{
+  bwrap->envp = apply_exports (bwrap->envp, default_exports, G_N_ELEMENTS (default_exports));
+
+  if (!use_ld_so_cache)
+    bwrap->envp = apply_exports (bwrap->envp, no_ld_so_cache_exports, G_N_ELEMENTS (no_ld_so_cache_exports));
+}
+
+void
+flatpak_run_apply_env_appid (FlatpakBwrap *bwrap,
+                             GFile *app_dir)
+{
+  g_autoptr(GFile) app_dir_data = NULL;
+  g_autoptr(GFile) app_dir_config = NULL;
+  g_autoptr(GFile) app_dir_cache = NULL;
+
+  app_dir_data = g_file_get_child (app_dir, "data");
+  app_dir_config = g_file_get_child (app_dir, "config");
+  app_dir_cache = g_file_get_child (app_dir, "cache");
+  flatpak_bwrap_set_env (bwrap, "XDG_DATA_HOME", flatpak_file_get_path_cached (app_dir_data), TRUE);
+  flatpak_bwrap_set_env (bwrap, "XDG_CONFIG_HOME", flatpak_file_get_path_cached (app_dir_config), TRUE);
+  flatpak_bwrap_set_env (bwrap, "XDG_CACHE_HOME", flatpak_file_get_path_cached (app_dir_cache), TRUE);
+}
+
+void
+flatpak_run_apply_env_vars (FlatpakBwrap *bwrap, FlatpakContext *context)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+
+  g_hash_table_iter_init (&iter, context->env_vars);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *var = key;
+      const char *val = value;
+
+      if (val && val[0] != 0)
+        flatpak_bwrap_set_env (bwrap, var, val, TRUE);
+      else
+        flatpak_bwrap_unset_env (bwrap, var);
+    }
+}
+
+GFile *
+flatpak_get_data_dir (const char *app_id)
+{
+  g_autoptr(GFile) home = g_file_new_for_path (g_get_home_dir ());
+  g_autoptr(GFile) var_app = g_file_resolve_relative_path (home, ".var/app");
+
+  return g_file_get_child (var_app, app_id);
+}
+
+GFile *
+flatpak_ensure_data_dir (const char   *app_id,
+                         GCancellable *cancellable,
+                         GError      **error)
+{
+  g_autoptr(GFile) dir = flatpak_get_data_dir (app_id);
+  g_autoptr(GFile) data_dir = g_file_get_child (dir, "data");
+  g_autoptr(GFile) cache_dir = g_file_get_child (dir, "cache");
+  g_autoptr(GFile) fontconfig_cache_dir = g_file_get_child (cache_dir, "fontconfig");
+  g_autoptr(GFile) tmp_dir = g_file_get_child (cache_dir, "tmp");
+  g_autoptr(GFile) config_dir = g_file_get_child (dir, "config");
+
+  if (!flatpak_mkdir_p (data_dir, cancellable, error))
+    return NULL;
+
+  if (!flatpak_mkdir_p (cache_dir, cancellable, error))
+    return NULL;
+
+  if (!flatpak_mkdir_p (fontconfig_cache_dir, cancellable, error))
+    return NULL;
+
+  if (!flatpak_mkdir_p (tmp_dir, cancellable, error))
+    return NULL;
+
+  if (!flatpak_mkdir_p (config_dir, cancellable, error))
+    return NULL;
+
+  return g_object_ref (dir);
+}
+
+struct JobData
+{
+  char      *job;
+  GMainLoop *main_loop;
+};
+
+static void
+job_removed_cb (SystemdManager *manager,
+                guint32         id,
+                char           *job,
+                char           *unit,
+                char           *result,
+                struct JobData *data)
+{
+  if (strcmp (job, data->job) == 0)
+    g_main_loop_quit (data->main_loop);
+}
+
+gboolean
+flatpak_run_in_transient_unit (const char *appid, GError **error)
+{
+  g_autoptr(GDBusConnection) conn = NULL;
+  g_autofree char *path = NULL;
+  g_autofree char *address = NULL;
+  g_autofree char *name = NULL;
+  g_autofree char *job = NULL;
+  SystemdManager *manager = NULL;
+  GVariantBuilder builder;
+  GVariant *properties = NULL;
+  GVariant *aux = NULL;
+  guint32 pid;
+  GMainContext *main_context = NULL;
+  GMainLoop *main_loop = NULL;
+  struct JobData data;
+  gboolean res = FALSE;
+
+  path = g_strdup_printf ("/run/user/%d/systemd/private", getuid ());
+
+  if (!g_file_test (path, G_FILE_TEST_EXISTS))
+    return flatpak_fail (error,
+                         "No systemd user session available, cgroups not available");
+
+  main_context = g_main_context_new ();
+  main_loop = g_main_loop_new (main_context, FALSE);
+
+  g_main_context_push_thread_default (main_context);
+
+  address = g_strconcat ("unix:path=", path, NULL);
+
+  conn = g_dbus_connection_new_for_address_sync (address,
+                                                 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                                 NULL,
+                                                 NULL, error);
+  if (!conn)
+    goto out;
+
+  manager = systemd_manager_proxy_new_sync (conn,
+                                            G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+                                            NULL,
+                                            "/org/freedesktop/systemd1",
+                                            NULL, error);
+  if (!manager)
+    goto out;
+
+  name = g_strdup_printf ("flatpak-%s-%d.scope", appid, getpid ());
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sv)"));
+
+  pid = getpid ();
+  g_variant_builder_add (&builder, "(sv)",
+                         "PIDs",
+                         g_variant_new_fixed_array (G_VARIANT_TYPE ("u"),
+                                                    &pid, 1, sizeof (guint32))
+                        );
+
+  properties = g_variant_builder_end (&builder);
+
+  aux = g_variant_new_array (G_VARIANT_TYPE ("(sa(sv))"), NULL, 0);
+
+  if (!systemd_manager_call_start_transient_unit_sync (manager,
+                                                       name,
+                                                       "fail",
+                                                       properties,
+                                                       aux,
+                                                       &job,
+                                                       NULL,
+                                                       error))
+    goto out;
+
+  data.job = job;
+  data.main_loop = main_loop;
+  g_signal_connect (manager, "job-removed", G_CALLBACK (job_removed_cb), &data);
+
+  g_main_loop_run (main_loop);
+
+  res = TRUE;
+
+out:
+  if (main_context)
+    {
+      g_main_context_pop_thread_default (main_context);
+      g_main_context_unref (main_context);
+    }
+  if (main_loop)
+    g_main_loop_unref (main_loop);
+  if (manager)
+    g_object_unref (manager);
+
+  return res;
+}
+
+static void
+add_font_path_args (FlatpakBwrap *bwrap)
+{
+  g_autoptr(GFile) home = NULL;
+  g_autoptr(GFile) user_font1 = NULL;
+  g_autoptr(GFile) user_font2 = NULL;
+  g_autoptr(GFile) user_font_cache = NULL;
+  g_auto(GStrv) system_cache_dirs = NULL;
+  gboolean found_cache = FALSE;
+  int i;
+
+  if (g_file_test (SYSTEM_FONTS_DIR, G_FILE_TEST_EXISTS))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", SYSTEM_FONTS_DIR, "/run/host/fonts",
+                              NULL);
+    }
+
+  system_cache_dirs = g_strsplit (SYSTEM_FONT_CACHE_DIRS, ":", 0);
+  for (i = 0; system_cache_dirs[i] != NULL; i++)
+    {
+      if (g_file_test (system_cache_dirs[i], G_FILE_TEST_EXISTS))
+        {
+          flatpak_bwrap_add_args (bwrap,
+                                  "--ro-bind", system_cache_dirs[i], "/run/host/fonts-cache",
+                                  NULL);
+          found_cache = TRUE;
+          break;
+        }
+    }
+
+  if (!found_cache)
+    {
+      /* We ensure these directories are never writable, or fontconfig
+         will use them to write the default cache */
+      flatpak_bwrap_add_args (bwrap,
+                              "--tmpfs", "/run/host/fonts-cache",
+                              "--remount-ro", "/run/host/fonts-cache",
+                              NULL);
+    }
+
+  home = g_file_new_for_path (g_get_home_dir ());
+  user_font1 = g_file_resolve_relative_path (home, ".local/share/fonts");
+  user_font2 = g_file_resolve_relative_path (home, ".fonts");
+
+  if (g_file_query_exists (user_font1, NULL))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", flatpak_file_get_path_cached (user_font1), "/run/host/user-fonts",
+                              NULL);
+    }
+  else if (g_file_query_exists (user_font2, NULL))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", flatpak_file_get_path_cached (user_font2), "/run/host/user-fonts",
+                              NULL);
+    }
+
+  user_font_cache = g_file_resolve_relative_path (home, ".cache/fontconfig");
+  if (g_file_query_exists (user_font_cache, NULL))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", flatpak_file_get_path_cached (user_font_cache), "/run/host/user-fonts-cache",
+                              NULL);
+    }
+  else
+    {
+      /* We ensure these directories are never writable, or fontconfig
+         will use them to write the default cache */
+      flatpak_bwrap_add_args (bwrap,
+                              "--tmpfs", "/run/host/user-fonts-cache",
+                              "--remount-ro", "/run/host/user-fonts-cache",
+                              NULL);
+    }
+}
+
+static void
+add_icon_path_args (FlatpakBwrap *bwrap)
+{
+  if (g_file_test ("/usr/share/icons", G_FILE_TEST_IS_DIR))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", "/usr/share/icons", "/run/host/share/icons",
+                              NULL);
+    }
+}
+
+static void
+add_default_permissions (FlatpakContext *app_context)
+{
+  flatpak_context_set_session_bus_policy (app_context,
+                                          "org.freedesktop.portal.*",
+                                          FLATPAK_POLICY_TALK);
+}
+
+FlatpakContext *
+flatpak_app_compute_permissions (GKeyFile *app_metadata,
+                                 GKeyFile *runtime_metadata,
+                                 GError  **error)
+{
+  g_autoptr(FlatpakContext) app_context = NULL;
+
+  app_context = flatpak_context_new ();
+
+  add_default_permissions (app_context);
+
+  if (runtime_metadata != NULL &&
+      !flatpak_context_load_metadata (app_context, runtime_metadata, error))
+    return NULL;
+
+  if (app_metadata != NULL &&
+      !flatpak_context_load_metadata (app_context, app_metadata, error))
+    return NULL;
+
+  return g_steal_pointer (&app_context);
+}
+
+gboolean
+flatpak_run_add_app_info_args (FlatpakBwrap   *bwrap,
+                               GFile          *app_files,
+                               GVariant       *app_deploy_data,
+                               const char     *app_extensions,
+                               GFile          *runtime_files,
+                               GVariant       *runtime_deploy_data,
+                               const char     *runtime_extensions,
+                               const char     *app_id,
+                               const char     *app_branch,
+                               const char     *runtime_ref,
+                               FlatpakContext *final_app_context,
+                               char          **app_info_path_out,
+                               GError        **error)
+{
+  g_autofree char *tmp_path = NULL;
+  int fd, fd2;
+  g_autoptr(GKeyFile) keyfile = NULL;
+  g_autofree char *runtime_path = NULL;
+  g_autofree char *old_dest = g_strdup_printf ("/run/user/%d/flatpak-info", getuid ());
+  const char *group;
+
+  fd = g_file_open_tmp ("flatpak-context-XXXXXX", &tmp_path, NULL);
+  if (fd < 0)
+    {
+      int errsv = errno;
+      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
+                   _("Failed to open flatpak-info temp file: %s"), g_strerror (errsv));
+      return FALSE;
+    }
+
+  close (fd);
+
+  keyfile = g_key_file_new ();
+
+  if (app_files)
+    group = FLATPAK_METADATA_GROUP_APPLICATION;
+  else
+    group = FLATPAK_METADATA_GROUP_RUNTIME;
+
+  g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_NAME, app_id);
+  g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_RUNTIME,
+                         runtime_ref);
+
+  if (app_files)
+    {
+      g_autofree char *app_path = g_file_get_path (app_files);
+      g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                             FLATPAK_METADATA_KEY_APP_PATH, app_path);
+    }
+  if (app_deploy_data)
+    g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                           FLATPAK_METADATA_KEY_APP_COMMIT, flatpak_deploy_data_get_commit (app_deploy_data));
+  if (app_extensions && *app_extensions != 0)
+    g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                           FLATPAK_METADATA_KEY_APP_EXTENSIONS, app_extensions);
+  runtime_path = g_file_get_path (runtime_files);
+  g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                         FLATPAK_METADATA_KEY_RUNTIME_PATH, runtime_path);
+  if (runtime_deploy_data)
+    g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                           FLATPAK_METADATA_KEY_RUNTIME_COMMIT, flatpak_deploy_data_get_commit (runtime_deploy_data));
+  if (runtime_extensions && *runtime_extensions != 0)
+    g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                           FLATPAK_METADATA_KEY_RUNTIME_EXTENSIONS, runtime_extensions);
+  if (app_branch != NULL)
+    g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                           FLATPAK_METADATA_KEY_BRANCH, app_branch);
+
+  g_key_file_set_string (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                         FLATPAK_METADATA_KEY_FLATPAK_VERSION, PACKAGE_VERSION);
+
+  if ((final_app_context->sockets & FLATPAK_CONTEXT_SOCKET_SESSION_BUS) == 0)
+    g_key_file_set_boolean (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                            FLATPAK_METADATA_KEY_SESSION_BUS_PROXY, TRUE);
+
+  if ((final_app_context->sockets & FLATPAK_CONTEXT_SOCKET_SYSTEM_BUS) == 0)
+    g_key_file_set_boolean (keyfile, FLATPAK_METADATA_GROUP_INSTANCE,
+                            FLATPAK_METADATA_KEY_SYSTEM_BUS_PROXY, TRUE);
+
+  flatpak_context_save_metadata (final_app_context, TRUE, keyfile);
+
+  if (!g_key_file_save_to_file (keyfile, tmp_path, error))
+    return FALSE;
+
+  /* We want to create a file on /.flatpak-info that the app cannot modify, which
+     we do by creating a read-only bind mount. This way one can openat()
+     /proc/$pid/root, and if that succeeds use openat via that to find the
+     unfakable .flatpak-info file. However, there is a tiny race in that if
+     you manage to open /proc/$pid/root, but then the pid dies, then
+     every mount but the root is unmounted in the namespace, so the
+     .flatpak-info will be empty. We fix this by first creating a real file
+     with the real info in, then bind-mounting on top of that, the same info.
+     This way even if the bind-mount is unmounted we can find the real data.
+  */
+
+  fd = open (tmp_path, O_RDONLY);
+  if (fd == -1)
+    {
+      int errsv = errno;
+      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
+                   _("Failed to open temp file: %s"), g_strerror (errsv));
+      return FALSE;
+    }
+
+  fd2 = open (tmp_path, O_RDONLY);
+  if (fd2 == -1)
+    {
+      close (fd);
+      int errsv = errno;
+      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
+                   _("Failed to open temp file: %s"), g_strerror (errsv));
+      return FALSE;
+    }
+
+  unlink (tmp_path);
+
+  flatpak_bwrap_add_args_data_fd (bwrap,
+                                  "--file", fd, "/.flatpak-info");
+  flatpak_bwrap_add_args_data_fd (bwrap,
+                                  "--ro-bind-data", fd2, "/.flatpak-info");
+  flatpak_bwrap_add_args (bwrap,
+                          "--symlink", "../../../.flatpak-info", old_dest,
+                          NULL);
+
+  if (app_info_path_out != NULL)
+    *app_info_path_out = g_strdup_printf ("/proc/self/fd/%d", fd);
+
+  return TRUE;
+}
+
+static void
+add_monitor_path_args (gboolean use_session_helper,
+                       FlatpakBwrap *bwrap)
+{
+  g_autoptr(AutoFlatpakSessionHelper) session_helper = NULL;
+  g_autofree char *monitor_path = NULL;
+
+  if (use_session_helper)
+    {
+      session_helper =
+        flatpak_session_helper_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+                                                       G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+                                                       "org.freedesktop.Flatpak",
+                                                       "/org/freedesktop/Flatpak/SessionHelper",
+                                                       NULL, NULL);
+    }
+
+  if (session_helper &&
+      flatpak_session_helper_call_request_monitor_sync (session_helper,
+                                                        &monitor_path,
+                                                        NULL, NULL))
+    {
+      flatpak_bwrap_add_args (bwrap,
+                              "--ro-bind", monitor_path, "/run/host/monitor",
+                              "--symlink", "/run/host/monitor/localtime", "/etc/localtime",
+                              "--symlink", "/run/host/monitor/resolv.conf", "/etc/resolv.conf",
+                              "--symlink", "/run/host/monitor/host.conf", "/etc/host.conf",
+                              "--symlink", "/run/host/monitor/hosts", "/etc/hosts",
+                              NULL);
+    }
+  else
+    {
+      /* /etc/localtime and /etc/resolv.conf can not exist (or be symlinks to
+       * non-existing targets), in which case we don't want to attempt to create
+       * bogus symlinks or bind mounts, as that will cause flatpak run to fail.
+       */
+      if (g_file_test ("/etc/localtime", G_FILE_TEST_EXISTS))
+        {
+          char localtime[PATH_MAX + 1];
+          ssize_t symlink_size;
+          gboolean is_reachable = FALSE;
+
+          symlink_size = readlink ("/etc/localtime", localtime, sizeof (localtime) - 1);
+          if (symlink_size > 0)
+            {
+              g_autoptr(GFile) base_file = NULL;
+              g_autoptr(GFile) target_file = NULL;
+              g_autofree char *target_canonical = NULL;
+
+              /* readlink() does not append a null byte to the buffer. */
+              localtime[symlink_size] = 0;
+
+              base_file = g_file_new_for_path ("/etc");
+              target_file = g_file_resolve_relative_path (base_file, localtime);
+              target_canonical = g_file_get_path (target_file);
+
+              is_reachable = g_str_has_prefix (target_canonical, "/usr/");
+            }
+
+          if (is_reachable)
+            {
+              flatpak_bwrap_add_args (bwrap,
+                                      "--symlink", localtime, "/etc/localtime",
+                                      NULL);
+            }
+          else
+            {
+              flatpak_bwrap_add_args (bwrap,
+                                      "--ro-bind", "/etc/localtime", "/etc/localtime",
+                                      NULL);
+            }
+        }
+
+      if (g_file_test ("/etc/resolv.conf", G_FILE_TEST_EXISTS))
+        flatpak_bwrap_add_args (bwrap,
+                                "--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf",
+                                NULL);
+      if (g_file_test ("/etc/host.conf", G_FILE_TEST_EXISTS))
+        flatpak_bwrap_add_args (bwrap,
+                                "--ro-bind", "/etc/host.conf", "/etc/host.conf",
+                                NULL);
+      if (g_file_test ("/etc/hosts", G_FILE_TEST_EXISTS))
+        flatpak_bwrap_add_args (bwrap,
+                                "--ro-bind", "/etc/hosts", "/etc/hosts",
+                                NULL);
+    }
+}
+
+static void
+add_document_portal_args (FlatpakBwrap *bwrap,
+                          const char  *app_id,
+                          char       **out_mount_path)
+{
+  g_autoptr(GDBusConnection) session_bus = NULL;
+  g_autofree char *doc_mount_path = NULL;
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+  if (session_bus)
+    {
+      g_autoptr(GError) local_error = NULL;
+      g_autoptr(GDBusMessage) reply = NULL;
+      g_autoptr(GDBusMessage) msg =
+        g_dbus_message_new_method_call ("org.freedesktop.portal.Documents",
+                                        "/org/freedesktop/portal/documents",
+                                        "org.freedesktop.portal.Documents",
+                                        "GetMountPoint");
+      g_dbus_message_set_body (msg, g_variant_new ("()"));
+      reply =
+        g_dbus_connection_send_message_with_reply_sync (session_bus, msg,
+                                                        G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+                                                        30000,
+                                                        NULL,
+                                                        NULL,
+                                                        NULL);
+      if (reply)
+        {
+          if (g_dbus_message_to_gerror (reply, &local_error))
+            {
+              g_message ("Can't get document portal: %s", local_error->message);
+            }
+          else
+            {
+              g_autofree char *src_path = NULL;
+              g_autofree char *dst_path = NULL;
+              g_variant_get (g_dbus_message_get_body (reply),
+                             "(^ay)", &doc_mount_path);
+
+              src_path = g_strdup_printf ("%s/by-app/%s",
+                                          doc_mount_path, app_id);
+              dst_path = g_strdup_printf ("/run/user/%d/doc", getuid ());
+              flatpak_bwrap_add_args (bwrap, "--bind", src_path, dst_path, NULL);
+            }
+        }
+    }
+
+  *out_mount_path = g_steal_pointer (&doc_mount_path);
+}
+
+static gchar *
+join_args (GPtrArray *argv_array, gsize *len_out)
+{
+  gchar *string;
+  gchar *ptr;
+  gint i;
+  gsize len = 0;
+
+  for (i = 0; i < argv_array->len && argv_array->pdata[i] != NULL; i++)
+    len +=  strlen (argv_array->pdata[i]) + 1;
+
+  string = g_new (gchar, len);
+  *string = 0;
+  ptr = string;
+  for (i = 0; i < argv_array->len && argv_array->pdata[i] != NULL; i++)
+    ptr = g_stpcpy (ptr, argv_array->pdata[i]) + 1;
+
+  *len_out = len;
+  return string;
+}
+
+typedef struct {
+  int sync_fd;
+  int app_info_fd;
+  int bwrap_args_fd;
+} DbusProxySpawnData;
+
+static void
+dbus_spawn_child_setup (gpointer user_data)
+{
+  DbusProxySpawnData *data = user_data;
+
+  /* Unset CLOEXEC */
+  fcntl (data->sync_fd, F_SETFD, 0);
+  fcntl (data->app_info_fd, F_SETFD, 0);
+  fcntl (data->bwrap_args_fd, F_SETFD, 0);
+}
+
+/* This wraps the argv in a bwrap call, primary to allow the
+   command to be run with a proper /.flatpak-info with data
+   taken from app_info_fd */
+static gboolean
+prepend_bwrap_argv_wrapper (GPtrArray *argv,
+                            int app_info_fd,
+                            int *bwrap_fd_out,
+                            GError **error)
+{
+  int i = 0;
+  g_auto(GLnxDirFdIterator) dir_iter = { 0 };
+  struct dirent *dent;
+  g_autoptr(GPtrArray) bwrap_args = g_ptr_array_new_with_free_func (g_free);
+  gsize bwrap_args_len;
+  g_auto(GLnxTmpfile) args_tmpf  = { 0, };
+  g_autofree char *bwrap_args_data = NULL;
+  g_autofree char *proxy_socket_dir = g_build_filename (g_get_user_runtime_dir (), ".dbus-proxy/", NULL);
+
+  if (!glnx_dirfd_iterator_init_at (AT_FDCWD, "/", FALSE, &dir_iter, error))
+    return FALSE;
+
+  while (TRUE)
+    {
+      if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dir_iter, &dent, NULL, error))
+        return FALSE;
+
+      if (dent == NULL)
+        break;
+
+      if (strcmp (dent->d_name, ".flatpak-info") == 0)
+        continue;
+
+      if (dent->d_type == DT_DIR)
+        {
+          if (strcmp (dent->d_name, "tmp") == 0 ||
+              strcmp (dent->d_name, "var") == 0 ||
+              strcmp (dent->d_name, "run") == 0)
+            g_ptr_array_add (bwrap_args, g_strdup ("--bind"));
+          else
+            g_ptr_array_add (bwrap_args, g_strdup ("--ro-bind"));
+          g_ptr_array_add (bwrap_args, g_strconcat ("/", dent->d_name, NULL));
+          g_ptr_array_add (bwrap_args, g_strconcat ("/", dent->d_name, NULL));
+        }
+      else if (dent->d_type == DT_LNK)
+        {
+          ssize_t symlink_size;
+          char path_buffer[PATH_MAX + 1];
+
+          symlink_size = readlinkat (dir_iter.fd, dent->d_name, path_buffer, sizeof (path_buffer) - 1);
+          if (symlink_size < 0)
+            {
+              glnx_set_error_from_errno (error);
+              return FALSE;
+            }
+          path_buffer[symlink_size] = 0;
+
+          g_ptr_array_add (bwrap_args, g_strdup ("--symlink"));
+          g_ptr_array_add (bwrap_args, g_strdup (path_buffer));
+          g_ptr_array_add (bwrap_args, g_strconcat ("/", dent->d_name, NULL));
+        }
+    }
+
+  g_ptr_array_add (bwrap_args, g_strdup ("--bind"));
+  g_ptr_array_add (bwrap_args, g_strdup (proxy_socket_dir));
+  g_ptr_array_add (bwrap_args, g_strdup (proxy_socket_dir));
+
+  /* This is a file rather than a bind mount, because it will then
+     not be unmounted from the namespace when the namespace dies. */
+  g_ptr_array_add (bwrap_args, g_strdup ("--file"));
+  g_ptr_array_add (bwrap_args, g_strdup_printf ("%d", app_info_fd));
+  g_ptr_array_add (bwrap_args, g_strdup ("/.flatpak-info"));
+  g_ptr_array_add (bwrap_args, NULL);
+
+  {
+    g_autofree char *commandline = flatpak_quote_argv ((const char **) bwrap_args->pdata);
+    flatpak_debug2 ("bwrap args '%s'", commandline);
+  }
+
+  bwrap_args_data = join_args (bwrap_args, &bwrap_args_len);
+  if (!buffer_to_sealed_memfd_or_tmpfile (&args_tmpf, "bwrap-args", bwrap_args_data, bwrap_args_len, error))
+    return FALSE;
+
+  g_ptr_array_insert (argv, i++, g_strdup (flatpak_get_bwrap ()));
+  g_ptr_array_insert (argv, i++, g_strdup ("--args"));
+  g_ptr_array_insert (argv, i++, g_strdup_printf ("%d", args_tmpf.fd));
+
+  *bwrap_fd_out = glnx_steal_fd (&args_tmpf.fd);
+  return TRUE;
+}
+
+static gboolean
+has_args (GPtrArray *args)
+{
+  return args != NULL && args->len > 0;
+}
+
+static void
+append_proxy_args (GPtrArray *dbus_proxy_argv,
+                   GPtrArray *args,
+                   gboolean   enable_logging)
+{
+  if (has_args (args))
+    {
+      int i;
+
+      for (i = 0; i < args->len; i++)
+        g_ptr_array_add (dbus_proxy_argv, g_strdup (args->pdata[i]));
+
+      if (enable_logging)
+        g_ptr_array_add (dbus_proxy_argv, g_strdup ("--log"));
+    }
+}
+
+static gboolean
+add_dbus_proxy_args (GPtrArray *argv_array,
+                     GPtrArray *session_dbus_proxy_argv,
+                     gboolean   enable_session_logging,
+                     GPtrArray *system_dbus_proxy_argv,
+                     gboolean   enable_system_logging,
+                     GPtrArray *a11y_dbus_proxy_argv,
+                     gboolean   enable_a11y_logging,
+                     int        sync_fds[2],
+                     const char *app_info_path,
+                     GError   **error)
+{
+  char x = 'x';
+  const char *proxy;
+  g_autofree char *commandline = NULL;
+  DbusProxySpawnData spawn_data;
+  glnx_autofd int app_info_fd = -1;
+  glnx_autofd int bwrap_args_fd = -1;
+  g_autoptr(GPtrArray) dbus_proxy_argv = NULL;
+
+  if (!has_args (session_dbus_proxy_argv) &&
+      !has_args (system_dbus_proxy_argv) &&
+      !has_args (a11y_dbus_proxy_argv))
+    return TRUE;
+
+  if (sync_fds[0] == -1)
+    {
+      access ("sync_fds", 0);
+      if (pipe (sync_fds) < 0)
+        {
+          g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno),
+                               _("Unable to create sync pipe"));
+          return FALSE;
+        }
+
+      add_args_data_fd (argv_array, NULL,
+                        "--sync-fd", sync_fds[0], NULL);
+    }
+
+  proxy = g_getenv ("FLATPAK_DBUSPROXY");
+  if (proxy == NULL)
+    proxy = DBUSPROXY;
+
+  dbus_proxy_argv = g_ptr_array_new_with_free_func (g_free);
+  g_ptr_array_add (dbus_proxy_argv, g_strdup (proxy));
+  g_ptr_array_add (dbus_proxy_argv, g_strdup_printf ("--fd=%d", sync_fds[1]));
+
+  append_proxy_args (dbus_proxy_argv, session_dbus_proxy_argv, enable_session_logging);
+  append_proxy_args (dbus_proxy_argv, system_dbus_proxy_argv, enable_system_logging);
+  append_proxy_args (dbus_proxy_argv, a11y_dbus_proxy_argv, enable_a11y_logging);
+
+  g_ptr_array_add (dbus_proxy_argv, NULL); /* NULL terminate */
+
+  app_info_fd = open (app_info_path, O_RDONLY);
+  if (app_info_fd == -1)
+    {
+      int errsv = errno;
+      g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
+                   _("Failed to open app info file: %s"), g_strerror (errsv));
+      return FALSE;
+    }
+
+  if (!prepend_bwrap_argv_wrapper (dbus_proxy_argv, app_info_fd, &bwrap_args_fd, error))
+    return FALSE;
+
+  commandline = flatpak_quote_argv ((const char **) dbus_proxy_argv->pdata);
+  flatpak_debug2 ("Running '%s'", commandline);
+
+  spawn_data.sync_fd = sync_fds[1];
+  spawn_data.app_info_fd = app_info_fd;
+  spawn_data.bwrap_args_fd = bwrap_args_fd;
+  if (!g_spawn_async (NULL,
+                      (char **) dbus_proxy_argv->pdata,
+                      NULL,
+                      G_SPAWN_SEARCH_PATH,
+                      dbus_spawn_child_setup,
+                      &spawn_data,
+                      NULL, error))
+    {
+      close (sync_fds[0]);
+      close (sync_fds[1]);
+      return FALSE;
+    }
+
+  /* Sync with proxy, i.e. wait until its listening on the sockets */
+  if (read (sync_fds[0], &x, 1) != 1)
+    {
+      g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno),
+                           _("Failed to sync with dbus proxy"));
+
+      close (sync_fds[0]);
+      close (sync_fds[1]);
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+#ifdef ENABLE_SECCOMP
+static const uint32_t seccomp_x86_64_extra_arches[] = { SCMP_ARCH_X86, 0, };
+
+#ifdef SCMP_ARCH_AARCH64
+static const uint32_t seccomp_aarch64_extra_arches[] = { SCMP_ARCH_ARM, 0 };
+#endif
+
+static inline void
+cleanup_seccomp (void *p)
+{
+  scmp_filter_ctx *pp = (scmp_filter_ctx *) p;
+
+  if (*pp)
+    seccomp_release (*pp);
+}
+
+static gboolean
+setup_seccomp (FlatpakBwrap *bwrap,
+               const char *arch,
+               gulong      allowed_personality,
+               gboolean    multiarch,
+               gboolean    devel,
+               GError    **error)
+{
+  __attribute__((cleanup (cleanup_seccomp))) scmp_filter_ctx seccomp = NULL;
+
+  /**** BEGIN NOTE ON CODE SHARING
+   *
+   * There are today a number of different Linux container
+   * implementations.  That will likely continue for long into the
+   * future.  But we can still try to share code, and it's important
+   * to do so because it affects what library and application writers
+   * can do, and we should support code portability between different
+   * container tools.
+   *
+   * This syscall blacklist is copied from linux-user-chroot, which was in turn
+   * clearly influenced by the Sandstorm.io blacklist.
+   *
+   * If you make any changes here, I suggest sending the changes along
+   * to other sandbox maintainers.  Using the libseccomp list is also
+   * an appropriate venue:
+   * https://groups.google.com/forum/#!topic/libseccomp
+   *
+   * A non-exhaustive list of links to container tooling that might
+   * want to share this blacklist:
+   *
+   *  https://github.com/sandstorm-io/sandstorm
+   *    in src/sandstorm/supervisor.c++
+   *  http://cgit.freedesktop.org/xdg-app/xdg-app/
+   *    in common/flatpak-run.c
+   *  https://git.gnome.org/browse/linux-user-chroot
+   *    in src/setup-seccomp.c
+   *
+   **** END NOTE ON CODE SHARING
+   */
+  struct
+  {
+    int                  scall;
+    struct scmp_arg_cmp *arg;
+  } syscall_blacklist[] = {
+    /* Block dmesg */
+    {SCMP_SYS (syslog)},
+    /* Useless old syscall */
+    {SCMP_SYS (uselib)},
+    /* Don't allow you to switch to bsd emulation or whatnot */
+    {SCMP_SYS (personality), &SCMP_A0(SCMP_CMP_NE, allowed_personality)},
+    /* Don't allow disabling accounting */
+    {SCMP_SYS (acct)},
+    /* 16-bit code is unnecessary in the sandbox, and modify_ldt is a
+       historic source of interesting information leaks. */
+    {SCMP_SYS (modify_ldt)},
+    /* Don't allow reading current quota use */
+    {SCMP_SYS (quotactl)},
+
+    /* Don't allow access to the kernel keyring */
+    {SCMP_SYS (add_key)},
+    {SCMP_SYS (keyctl)},
+    {SCMP_SYS (request_key)},
+
+    /* Scary VM/NUMA ops */
+    {SCMP_SYS (move_pages)},
+    {SCMP_SYS (mbind)},
+    {SCMP_SYS (get_mempolicy)},
+    {SCMP_SYS (set_mempolicy)},
+    {SCMP_SYS (migrate_pages)},
+
+    /* Don't allow subnamespace setups: */
+    {SCMP_SYS (unshare)},
+    {SCMP_SYS (mount)},
+    {SCMP_SYS (pivot_root)},
+    {SCMP_SYS (clone), &SCMP_A0 (SCMP_CMP_MASKED_EQ, CLONE_NEWUSER, CLONE_NEWUSER)},
+
+    /* Don't allow faking input to the controlling tty (CVE-2017-5226) */
+    {SCMP_SYS (ioctl), &SCMP_A1(SCMP_CMP_EQ, (int)TIOCSTI)},
+  };
+
+  struct
+  {
+    int                  scall;
+    struct scmp_arg_cmp *arg;
+  } syscall_nondevel_blacklist[] = {
+    /* Profiling operations; we expect these to be done by tools from outside
+     * the sandbox.  In particular perf has been the source of many CVEs.
+     */
+    {SCMP_SYS (perf_event_open)},
+    {SCMP_SYS (ptrace)}
+  };
+  /* Blacklist all but unix, inet, inet6 and netlink */
+  int socket_family_blacklist[] = {
+    AF_AX25,
+    AF_IPX,
+    AF_APPLETALK,
+    AF_NETROM,
+    AF_BRIDGE,
+    AF_ATMPVC,
+    AF_X25,
+    AF_ROSE,
+    AF_DECnet,
+    AF_NETBEUI,
+    AF_SECURITY,
+    AF_KEY,
+    AF_NETLINK + 1, /* Last gets CMP_GE, so order is important */
+  };
+  int i, r;
+  g_auto(GLnxTmpfile) seccomp_tmpf  = { 0, };
+
+  seccomp = seccomp_init (SCMP_ACT_ALLOW);
+  if (!seccomp)
+    return flatpak_fail (error, "Initialize seccomp failed");
+
+  if (arch != NULL)
+    {
+      uint32_t arch_id = 0;
+      const uint32_t *extra_arches = NULL;
+
+      if (strcmp (arch, "i386") == 0)
+        {
+          arch_id = SCMP_ARCH_X86;
+        }
+      else if (strcmp (arch, "x86_64") == 0)
+        {
+          arch_id = SCMP_ARCH_X86_64;
+          extra_arches = seccomp_x86_64_extra_arches;
+        }
+      else if (strcmp (arch, "arm") == 0)
+        {
+          arch_id = SCMP_ARCH_ARM;
+        }
+#ifdef SCMP_ARCH_AARCH64
+      else if (strcmp (arch, "aarch64") == 0)
+        {
+          arch_id = SCMP_ARCH_AARCH64;
+          extra_arches = seccomp_aarch64_extra_arches;
+        }
+#endif
+
+      /* We only really need to handle arches on multiarch systems.
+       * If only one arch is supported the default is fine */
+      if (arch_id != 0)
+        {
+          /* This *adds* the target arch, instead of replacing the
+             native one. This is not ideal, because we'd like to only
+             allow the target arch, but we can't really disallow the
+             native arch at this point, because then bubblewrap
+             couldn't continue running. */
+          r = seccomp_arch_add (seccomp, arch_id);
+          if (r < 0 && r != -EEXIST)
+            return flatpak_fail (error, "Failed to add architecture to seccomp filter");
+
+          if (multiarch && extra_arches != NULL)
+            {
+              unsigned i;
+              for (i = 0; extra_arches[i] != 0; i++)
+                {
+                  r = seccomp_arch_add (seccomp, extra_arches[i]);
+                  if (r < 0 && r != -EEXIST)
+                    return flatpak_fail (error, "Failed to add multiarch architecture to seccomp filter");
+                }
+            }
+        }
+    }
+
+  /* TODO: Should we filter the kernel keyring syscalls in some way?
+   * We do want them to be used by desktop apps, but they could also perhaps
+   * leak system stuff or secrets from other apps.
+   */
+
+  for (i = 0; i < G_N_ELEMENTS (syscall_blacklist); i++)
+    {
+      int scall = syscall_blacklist[i].scall;
+      if (syscall_blacklist[i].arg)
+        r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_blacklist[i].arg);
+      else
+        r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0);
+      if (r < 0 && r == -EFAULT /* unknown syscall */)
+        return flatpak_fail (error, "Failed to block syscall %d", scall);
+    }
+
+  if (!devel)
+    {
+      for (i = 0; i < G_N_ELEMENTS (syscall_nondevel_blacklist); i++)
+        {
+          int scall = syscall_nondevel_blacklist[i].scall;
+          if (syscall_nondevel_blacklist[i].arg)
+            r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_nondevel_blacklist[i].arg);
+          else
+            r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0);
+
+          if (r < 0 && r == -EFAULT /* unknown syscall */)
+            return flatpak_fail (error, "Failed to block syscall %d", scall);
+        }
+    }
+
+  /* Socket filtering doesn't work on e.g. i386, so ignore failures here
+   * However, we need to user seccomp_rule_add_exact to avoid libseccomp doing
+   * something else: https://github.com/seccomp/libseccomp/issues/8 */
+  for (i = 0; i < G_N_ELEMENTS (socket_family_blacklist); i++)
+    {
+      int family = socket_family_blacklist[i];
+      if (i == G_N_ELEMENTS (socket_family_blacklist) - 1)
+        seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_GE, family));
+      else
+        seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_EQ, family));
+    }
+
+  if (!glnx_open_anonymous_tmpfile (O_RDWR | O_CLOEXEC, &seccomp_tmpf, error))
+    return FALSE;
+
+  if (seccomp_export_bpf (seccomp, seccomp_tmpf.fd) != 0)
+    return flatpak_fail (error, "Failed to export bpf");
+
+  lseek (seccomp_tmpf.fd, 0, SEEK_SET);
+
+  flatpak_bwrap_add_args_data_fd (bwrap,
+                                  "--seccomp", glnx_steal_fd (&seccomp_tmpf.fd), NULL);
+
+  return TRUE;
+}
+#endif
+
+static void
+flatpak_run_setup_usr_links (FlatpakBwrap *bwrap,
+                             GFile          *runtime_files)
+{
+  const char *usr_links[] = {"lib", "lib32", "lib64", "bin", "sbin"};
+  int i;
+
+  if (runtime_files == NULL)
+    return;
+
+  for (i = 0; i < G_N_ELEMENTS (usr_links); i++)
+    {
+      const char *subdir = usr_links[i];
+      g_autoptr(GFile) runtime_subdir = g_file_get_child (runtime_files, subdir);
+      if (g_file_query_exists (runtime_subdir, NULL))
+        {
+          g_autofree char *link = g_strconcat ("usr/", subdir, NULL);
+          g_autofree char *dest = g_strconcat ("/", subdir, NULL);
+          flatpak_bwrap_add_args (bwrap,
+                                  "--symlink", link, dest,
+                                  NULL);
+        }
+    }
+}
+
+gboolean
+flatpak_run_setup_base_argv (FlatpakBwrap   *bwrap,
+                             GFile          *runtime_files,
+                             GFile          *app_id_dir,
+                             const char     *arch,
+                             FlatpakRunFlags flags,
+                             GError        **error)
+{
+  g_autofree char *run_dir = g_strdup_printf ("/run/user/%d", getuid ());
+  g_autofree char *passwd_contents = NULL;
+  g_autofree char *group_contents = NULL;
+  struct group *g = getgrgid (getgid ());
+  gulong pers;
+
+  g_autoptr(GFile) etc = NULL;
+
+  passwd_contents = g_strdup_printf ("%s:x:%d:%d:%s:%s:%s\n"
+                                     "nfsnobody:x:65534:65534:Unmapped user:/:/sbin/nologin\n",
+                                     g_get_user_name (),
+                                     getuid (), getgid (),
+                                     g_get_real_name (),
+                                     g_get_home_dir (),
+                                     DEFAULT_SHELL);
+
+  group_contents = g_strdup_printf ("%s:x:%d:%s\n"
+                                    "nfsnobody:x:65534:\n",
+                                    g->gr_name,
+                                    getgid (), g_get_user_name ());
+
+  flatpak_bwrap_add_args (bwrap,
+                          "--unshare-pid",
+                          "--proc", "/proc",
+                          "--dir", "/tmp",
+                          "--dir", "/var/tmp",
+                          "--dir", "/run/host",
+                          "--dir", run_dir,
+                          "--setenv", "XDG_RUNTIME_DIR", run_dir,
+                          "--symlink", "../run", "/var/run",
+                          "--ro-bind", "/sys/block", "/sys/block",
+                          "--ro-bind", "/sys/bus", "/sys/bus",
+                          "--ro-bind", "/sys/class", "/sys/class",
+                          "--ro-bind", "/sys/dev", "/sys/dev",
+                          "--ro-bind", "/sys/devices", "/sys/devices",
+                          NULL);
+
+  if (flags & FLATPAK_RUN_FLAG_DIE_WITH_PARENT)
+    flatpak_bwrap_add_args (bwrap,
+                            "--die-with-parent",
+                            NULL);
+
+  if (flags & FLATPAK_RUN_FLAG_WRITABLE_ETC)
+    flatpak_bwrap_add_args (bwrap,
+                            "--dir", "/usr/etc",
+                            "--symlink", "usr/etc", "/etc",
+                            NULL);
+
+  if (!flatpak_bwrap_add_args_data (bwrap, "passwd", passwd_contents, -1, "/etc/passwd", error))
+    return FALSE;
+
+  if (!flatpak_bwrap_add_args_data (bwrap, "group", group_contents, -1, "/etc/group", error))
+    return FALSE;
+
+  if (g_file_test ("/etc/machine-id", G_FILE_TEST_EXISTS))
+    flatpak_bwrap_add_args (bwrap, "--ro-bind", "/etc/machine-id", "/etc/machine-id", NULL);
+  else if (g_file_test ("/var/lib/dbus/machine-id", G_FILE_TEST_EXISTS))
+    flatpak_bwrap_add_args (bwrap, "--ro-bind", "/var/lib/dbus/machine-id", "/etc/machine-id", NULL);
+
+  if (runtime_files)
+    etc = g_file_get_child (runtime_files, "etc");
+  if (etc != NULL &&
+      (flags & FLATPAK_RUN_FLAG_WRITABLE_ETC) == 0 &&
+      g_file_query_exists (etc, NULL))
+    {
+      g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
+      struct dirent *dent;
+      char path_buffer[PATH_MAX + 1];
+      ssize_t symlink_size;
+      gboolean inited;
+
+      inited = glnx_dirfd_iterator_init_at (AT_FDCWD, flatpak_file_get_path_cached (etc), FALSE, &dfd_iter, NULL);
+
+      while (inited)
+        {
+          g_autofree char *src = NULL;
+          g_autofree char *dest = NULL;
+
+          if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent, NULL, NULL) || dent == NULL)
+            break;
+
+          if (strcmp (dent->d_name, "passwd") == 0 ||
+              strcmp (dent->d_name, "group") == 0 ||
+              strcmp (dent->d_name, "machine-id") == 0 ||
+              strcmp (dent->d_name, "resolv.conf") == 0 ||
+              strcmp (dent->d_name, "host.conf") == 0 ||
+              strcmp (dent->d_name, "hosts") == 0 ||
+              strcmp (dent->d_name, "localtime") == 0)
+            continue;
+
+          src = g_build_filename (flatpak_file_get_path_cached (etc), dent->d_name, NULL);
+          dest = g_build_filename ("/etc", dent->d_name, NULL);
+          if (dent->d_type == DT_LNK)
+            {
+              symlink_size = readlinkat (dfd_iter.fd, dent->d_name, path_buffer, sizeof (path_buffer) - 1);
+              if (symlink_size < 0)
+                {
+                  glnx_set_error_from_errno (error);
+                  return FALSE;
+                }
+              path_buffer[symlink_size] = 0;
+              flatpak_bwrap_add_args (bwrap, "--symlink", path_buffer, dest, NULL);
+            }
+          else
+            {
+              flatpak_bwrap_add_args (bwrap, "--bind", src, dest, NULL);
+            }
+        }
+    }
+
+  if (app_id_dir != NULL)
+    {
+      g_autoptr(GFile) app_cache_dir = g_file_get_child (app_id_dir, "cache");
+      g_autoptr(GFile) app_tmp_dir = g_file_get_child (app_cache_dir, "tmp");
+      g_autoptr(GFile) app_data_dir = g_file_get_child (app_id_dir, "data");
+      g_autoptr(GFile) app_config_dir = g_file_get_child (app_id_dir, "config");
+
+      flatpak_bwrap_add_args (bwrap,
+                              /* These are nice to have as a fixed path */
+                              "--bind", flatpak_file_get_path_cached (app_cache_dir), "/var/cache",
+                              "--bind", flatpak_file_get_path_cached (app_data_dir), "/var/data",
+                              "--bind", flatpak_file_get_path_cached (app_config_dir), "/var/config",
+                              "--bind", flatpak_file_get_path_cached (app_tmp_dir), "/var/tmp",
+                              NULL);
+    }
+
+  flatpak_run_setup_usr_links (bwrap, runtime_files);
+
+  pers = PER_LINUX;
+
+  if ((flags & FLATPAK_RUN_FLAG_SET_PERSONALITY) &&
+      flatpak_is_linux32_arch (arch))
+    {
+      g_debug ("Setting personality linux32");
+      pers = PER_LINUX32;
+    }
+
+  /* Always set the personallity, and clear all weird flags */
+  personality (pers);
+
+#ifdef ENABLE_SECCOMP
+  if (!setup_seccomp (bwrap,
+                      arch,
+                      pers,
+                      (flags & FLATPAK_RUN_FLAG_MULTIARCH) != 0,
+                      (flags & FLATPAK_RUN_FLAG_DEVEL) != 0,
+                      error))
+    return FALSE;
+#endif
+
+  if ((flags & FLATPAK_RUN_FLAG_WRITABLE_ETC) == 0)
+    add_monitor_path_args ((flags & FLATPAK_RUN_FLAG_NO_SESSION_HELPER) == 0, bwrap);
+
+  return TRUE;
+}
+
+static void
+clear_fd (gpointer data)
+{
+  int *fd_p = data;
+  if (fd_p != NULL && *fd_p != -1)
+    close (*fd_p);
+}
+
+/* Unset FD_CLOEXEC on the array of fds passed in @user_data */
+static void
+child_setup (gpointer user_data)
+{
+  GArray *fd_array = user_data;
+  int i;
+
+  /* If no fd_array was specified, don't care. */
+  if (fd_array == NULL)
+    return;
+
+  /* Otherwise, mark not - close-on-exec all the fds in the array */
+  for (i = 0; i < fd_array->len; i++)
+    {
+      int fd = g_array_index (fd_array, int, i);
+
+      /* We also seek all fds to the start, because this lets
+         us use the same fd_array multiple times */
+      if (lseek (fd, 0, SEEK_SET) < 0)
+        g_printerr ("lseek error in child setup");
+
+      fcntl (fd, F_SETFD, 0);
+    }
+}
+
+static gboolean
+forward_file (XdpDbusDocuments  *documents,
+              const char        *app_id,
+              const char        *file,
+              char             **out_doc_id,
+              GError           **error)
+{
+  int fd, fd_id;
+  g_autofree char *doc_id = NULL;
+  g_autoptr(GUnixFDList) fd_list = NULL;
+  const char *perms[] = { "read", "write", NULL };
+
+  fd = open (file, O_PATH | O_CLOEXEC);
+  if (fd == -1)
+    return flatpak_fail (error, "Failed to open '%s'", file);
+
+  fd_list = g_unix_fd_list_new ();
+  fd_id = g_unix_fd_list_append (fd_list, fd, error);
+  close (fd);
+
+  if (!xdp_dbus_documents_call_add_sync (documents,
+                                         g_variant_new ("h", fd_id),
+                                         TRUE, /* reuse */
+                                         FALSE, /* not persistent */
+                                         fd_list,
+                                         &doc_id,
+                                         NULL,
+                                         NULL,
+                                         error))
+    return FALSE;
+
+  if (!xdp_dbus_documents_call_grant_permissions_sync (documents,
+                                                       doc_id,
+                                                       app_id,
+                                                       perms,
+                                                       NULL,
+                                                       error))
+    return FALSE;
+
+  *out_doc_id = g_steal_pointer (&doc_id);
+
+  return TRUE;
+}
+
+static gboolean
+add_rest_args (const char  *app_id,
+               FlatpakExports *exports,
+               gboolean     file_forwarding,
+               const char  *doc_mount_path,
+               GPtrArray   *argv_array,
+               char        *args[],
+               int          n_args,
+               GError     **error)
+{
+  g_autoptr(XdpDbusDocuments) documents = NULL;
+  gboolean forwarding = FALSE;
+  gboolean forwarding_uri = FALSE;
+  gboolean can_forward = TRUE;
+  int i;
+
+  if (file_forwarding && doc_mount_path == NULL)
+    {
+      g_message ("Can't get document portal mount path");
+      can_forward = FALSE;
+    }
+  else if (file_forwarding)
+    {
+      g_autoptr(GError) local_error = NULL;
+
+      documents = xdp_dbus_documents_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, 0,
+                                                             "org.freedesktop.portal.Documents",
+                                                             "/org/freedesktop/portal/documents",
+                                                             NULL,
+                                                             &local_error);
+      if (documents == NULL)
+        {
+          g_message ("Can't get document portal: %s", local_error->message);
+          can_forward = FALSE;
+        }
+    }
+
+  for (i = 0; i < n_args; i++)
+    {
+      g_autoptr(GFile) file = NULL;
+
+      if (file_forwarding &&
+          (strcmp (args[i], "@@") == 0 ||
+           strcmp (args[i], "@@u") == 0))
+        {
+          forwarding_uri = strcmp (args[i], "@@u") == 0;
+          forwarding = !forwarding;
+          continue;
+        }
+
+      if (can_forward && forwarding)
+        {
+          if (forwarding_uri)
+            {
+              if (g_str_has_prefix (args[i], "file:"))
+                file = g_file_new_for_uri (args[i]);
+              else if (G_IS_DIR_SEPARATOR(args[i][0]))
+                file = g_file_new_for_path (args[i]);
+            }
+          else
+            file = g_file_new_for_path (args[i]);
+        }
+
+      if (file && !flatpak_exports_path_is_visible (exports,
+                                                    flatpak_file_get_path_cached (file)))
+        {
+          g_autofree char *doc_id = NULL;
+          g_autofree char *basename = NULL;
+          char *doc_path;
+          if (!forward_file (documents, app_id, flatpak_file_get_path_cached (file),
+                             &doc_id, error))
+            return FALSE;
+
+          basename = g_file_get_basename (file);
+          doc_path = g_build_filename (doc_mount_path, doc_id, basename, NULL);
+
+          if (forwarding_uri)
+            {
+              g_autofree char *path = doc_path;
+              doc_path = g_filename_to_uri (path, NULL, NULL);
+              /* This should never fail */
+              g_assert (doc_path != NULL);
+            }
+
+          g_debug ("Forwarding file '%s' as '%s' to %s", args[i], doc_path, app_id);
+          g_ptr_array_add (argv_array, doc_path);
+        }
+      else
+        g_ptr_array_add (argv_array, g_strdup (args[i]));
+    }
+
+  return TRUE;
+}
+
+FlatpakContext *
+flatpak_context_load_for_app (const char     *app_id,
+                              GError        **error)
+{
+  g_autofree char *app_ref = NULL;
+  g_autoptr(FlatpakContext) app_context = NULL;
+  g_autoptr(FlatpakDeploy) app_deploy = NULL;
+  g_autoptr(FlatpakContext) overrides = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+
+  app_ref = flatpak_find_current_ref (app_id, NULL, error);
+  if (app_ref == NULL)
+    return NULL;
+
+  app_deploy = flatpak_find_deploy_for_ref (app_ref, NULL, error);
+  if (app_deploy == NULL)
+    return NULL;
+
+  metakey = flatpak_deploy_get_metadata (app_deploy);
+  app_context = flatpak_app_compute_permissions (metakey, NULL, error);
+  if (app_context == NULL)
+    return NULL;
+
+  overrides = flatpak_deploy_get_overrides (app_deploy);
+  flatpak_context_merge (app_context, overrides);
+
+  return g_steal_pointer (&app_context);
+}
+
+FlatpakBwrap *
+flatpak_bwrap_new (char **env)
+{
+  FlatpakBwrap *bwrap = g_new0 (FlatpakBwrap, 1);
+
+  bwrap->argv = g_ptr_array_new_with_free_func (g_free);
+  bwrap->fds = g_array_new (FALSE, TRUE, sizeof (int));
+  g_array_set_clear_func (bwrap->fds, clear_fd);
+
+  if (env)
+    bwrap->envp = g_strdupv (env);
+  else
+    bwrap->envp = g_get_environ ();
+
+  return bwrap;
+}
+
+void
+flatpak_bwrap_free (FlatpakBwrap *bwrap)
+{
+  g_ptr_array_unref (bwrap->argv);
+  g_array_unref (bwrap->fds);
+  g_strfreev (bwrap->envp);
+  g_free (bwrap);
+}
+
+void
+flatpak_bwrap_set_env (FlatpakBwrap *bwrap,
+                       const char  *variable,
+                       const char  *value,
+                       gboolean      overwrite)
+{
+  bwrap->envp = g_environ_setenv (bwrap->envp, variable, value, overwrite);
+}
+
+void
+flatpak_bwrap_unset_env (FlatpakBwrap *bwrap,
+                         const char  *variable)
+{
+  bwrap->envp = g_environ_unsetenv (bwrap->envp, variable);
+}
+
+void
+flatpak_bwrap_add_args (FlatpakBwrap *bwrap, ...)
+{
+  va_list args;
+  const gchar *arg;
+
+  va_start (args, bwrap);
+  while ((arg = va_arg (args, const gchar *)))
+    g_ptr_array_add (bwrap->argv, g_strdup (arg));
+  va_end (args);
+}
+
+void
+flatpak_bwrap_append_argsv (FlatpakBwrap *bwrap,
+                            char **args,
+                            int len)
+{
+  int i;
+
+  if (len < 0)
+    len = g_strv_length (args);
+
+  for (i = 0; i < len; i++)
+    g_ptr_array_add (bwrap->argv, g_strdup (args[i]));
+}
+
+void
+flatpak_bwrap_append_args (FlatpakBwrap *bwrap,
+                           GPtrArray *other_array)
+{
+  flatpak_bwrap_append_argsv (bwrap,
+                              (char **)other_array->pdata,
+                              other_array->len);
+}
+
+void
+flatpak_bwrap_add_args_data_fd (FlatpakBwrap *bwrap,
+                                const char *op,
+                                int fd,
+                                const char *path_optional)
+{
+  g_autofree char *fd_str = g_strdup_printf ("%d", fd);
+
+  g_array_append_val (bwrap->fds, fd);
+  flatpak_bwrap_add_args (bwrap,
+                          op, fd_str, path_optional,
+                          NULL);
+}
+
+
+/* Given a buffer @content of size @content_size, generate a fd (memfd if available)
+ * of the data.  The @name parameter is used by memfd_create() as a debugging aid;
+ * it has no semantic meaning.  The bwrap command line will inject it into the target
+ * container as @path.
+ */
+gboolean
+flatpak_bwrap_add_args_data (FlatpakBwrap *bwrap,
+                             const char *name,
+                             const char *content,
+                             gssize content_size,
+                             const char *path,
+                             GError **error)
+{
+  g_auto(GLnxTmpfile) args_tmpf  = { 0, };
+
+  if (!buffer_to_sealed_memfd_or_tmpfile (&args_tmpf, name, content, content_size, error))
+    return FALSE;
+
+  flatpak_bwrap_add_args_data_fd (bwrap, "--bind-data", glnx_steal_fd (&args_tmpf.fd), path);
+  return TRUE;
+}
+
+/* This resolves the target here rather than in bwrap, because it may
+ * not resolve in bwrap setup due to absolute symlinks conflicting
+ * with /newroot root. For example, dest could be inside
+ * ~/.var/app/XXX where XXX is an absolute symlink.  However, in the
+ * usecases here the destination file often doesn't exist, so we
+ * only resolve the directory part.
+ */
+void
+flatpak_bwrap_add_bind_arg (FlatpakBwrap *bwrap,
+                            const char *type,
+                            const char *src,
+                            const char *dest)
+{
+  g_autofree char *dest_dirname = g_path_get_dirname (dest);
+  g_autofree char *dest_dirname_real = realpath (dest_dirname, NULL);
+
+  if (dest_dirname_real)
+    {
+      g_autofree char *dest_basename = g_path_get_basename (dest);
+      g_autofree char *dest_real = g_build_filename (dest_dirname_real, dest_basename, NULL);
+      flatpak_bwrap_add_args (bwrap, type, src, dest_real, NULL);
+    }
+}
+
+
+static char *
+calculate_ld_cache_checksum (GVariant *app_deploy_data,
+                             GVariant *runtime_deploy_data,
+                             const char *app_extensions,
+                             const char *runtime_extensions)
+{
+  g_autoptr(GChecksum) ld_so_checksum = g_checksum_new (G_CHECKSUM_SHA256);
+  if (app_deploy_data)
+    g_checksum_update (ld_so_checksum, (guchar *)flatpak_deploy_data_get_commit (app_deploy_data), -1);
+  g_checksum_update (ld_so_checksum, (guchar *)flatpak_deploy_data_get_commit (runtime_deploy_data), -1);
+  if (app_extensions)
+    g_checksum_update (ld_so_checksum, (guchar *)app_extensions, -1);
+  if (runtime_extensions)
+    g_checksum_update (ld_so_checksum, (guchar *)runtime_extensions, -1);
+
+  return g_strdup (g_checksum_get_string (ld_so_checksum));
+}
+
+static gboolean
+add_ld_so_conf (FlatpakBwrap   *bwrap,
+                GError        **error)
+{
+  const char *contents =
+    "include /run/flatpak/ld.so.conf.d/app-*.conf\n"
+    "include /app/etc/ld.so.conf\n"
+    "/app/lib\n"
+    "include /run/flatpak/ld.so.conf.d/runtime-*.conf\n";
+
+  return flatpak_bwrap_add_args_data (bwrap, "ld-so-conf",
+                                      contents, -1, "/etc/ld.so.conf", error);
+}
+
+static int
+regenerate_ld_cache (GPtrArray      *base_argv_array,
+                     GArray         *base_fd_array,
+                     GFile          *app_id_dir,
+                     const char     *checksum,
+                     GFile          *runtime_files,
+                     gboolean        generate_ld_so_conf,
+                     GCancellable   *cancellable,
+                     GError        **error)
+{
+  g_autoptr(FlatpakBwrap) bwrap = NULL;
+  g_autoptr(GArray) combined_fd_array = NULL;
+  g_autoptr(GFile) ld_so_cache = NULL;
+  g_autofree char *sandbox_cache_path = NULL;
+  g_auto(GStrv) minimal_envp = NULL;
+  g_autofree char *commandline = NULL;
+  int exit_status;
+  glnx_autofd int ld_so_fd = -1;
+  g_autoptr(GFile) ld_so_dir = NULL;
+
+  if (app_id_dir)
+    ld_so_dir = g_file_get_child (app_id_dir, ".ld.so");
+  else
+    {
+      g_autoptr(GFile) base_dir = g_file_new_for_path (g_get_user_cache_dir ());
+      ld_so_dir = g_file_resolve_relative_path (base_dir, "flatpak/ld.so");
+    }
+
+  ld_so_cache = g_file_get_child (ld_so_dir, checksum);
+  ld_so_fd = open (flatpak_file_get_path_cached (ld_so_cache), O_RDONLY);
+  if (ld_so_fd >= 0)
+    return glnx_steal_fd (&ld_so_fd);
+
+  g_debug ("Regenerating ld.so.cache %s", flatpak_file_get_path_cached (ld_so_cache));
+
+  if (!flatpak_mkdir_p (ld_so_dir, cancellable, error))
+    return FALSE;
+
+  minimal_envp = flatpak_run_get_minimal_env (FALSE, FALSE);
+  bwrap = flatpak_bwrap_new (minimal_envp);
+  flatpak_bwrap_add_args (bwrap, flatpak_get_bwrap (), NULL);
+
+  flatpak_bwrap_append_args (bwrap, base_argv_array);
+
+  flatpak_run_setup_usr_links (bwrap, runtime_files);
+
+  if (generate_ld_so_conf)
+    {
+      if (!add_ld_so_conf (bwrap, error))
+        return -1;
+    }
+  else
+    flatpak_bwrap_add_args (bwrap,
+                            "--symlink", "../usr/etc/ld.so.conf", "/etc/ld.so.conf",
+                            NULL);
+
+  sandbox_cache_path = g_build_filename ("/run/ld-so-cache-dir", checksum, NULL);
+
+  flatpak_bwrap_add_args (bwrap,
+                          "--unshare-pid",
+                          "--unshare-ipc",
+                          "--unshare-net",
+                          "--proc", "/proc",
+                          "--dev", "/dev",
+                          "--bind", flatpak_file_get_path_cached (ld_so_dir), "/run/ld-so-cache-dir",
+                          "ldconfig", "-X", "-C", sandbox_cache_path, NULL);
+
+  g_ptr_array_add (bwrap->argv, NULL);
+
+  commandline = flatpak_quote_argv ((const char **) bwrap->argv->pdata);
+  flatpak_debug2 ("Running: '%s'", commandline);
+
+  combined_fd_array = g_array_new (FALSE, TRUE, sizeof (int));
+  g_array_append_vals (combined_fd_array, base_fd_array->data, base_fd_array->len);
+  g_array_append_vals (combined_fd_array, bwrap->fds->data, bwrap->fds->len);
+
+  if (!g_spawn_sync (NULL,
+                     (char **) bwrap->argv->pdata,
+                     bwrap->envp,
+                     G_SPAWN_SEARCH_PATH,
+                     child_setup, combined_fd_array,
+                     NULL, NULL,
+                     &exit_status,
+                     error))
+    return -1;
+
+  if (!WIFEXITED(exit_status) || WEXITSTATUS(exit_status) != 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   _("ldconfig failed, exit status %d"), exit_status);
+      return -1;
+    }
+
+  ld_so_fd = open (flatpak_file_get_path_cached (ld_so_cache), O_RDONLY);
+  if (ld_so_fd < 0)
+    {
+      flatpak_fail (error, "Can't open generated ld.so.cache");
+      return -1;
+    }
+
+  if (app_id_dir == NULL)
+    {
+      /* For runs without an app id dir we always regenerate the ld.so.cache */
+      unlink (flatpak_file_get_path_cached (ld_so_cache));
+    }
+  else
+    {
+      g_autoptr(GFile) active = g_file_get_child (ld_so_dir, "active");
+
+      /* For app-dirs we keep one checksum alive, by pointing the active symlink to it */
+
+      if (!flatpak_switch_symlink_and_remove (flatpak_file_get_path_cached (active),
+                                              checksum, error))
+        return -1;
+    }
+
+  return glnx_steal_fd (&ld_so_fd);
+}
+
+gboolean
+flatpak_run_app (const char     *app_ref,
+                 FlatpakDeploy  *app_deploy,
+                 FlatpakContext *extra_context,
+                 const char     *custom_runtime,
+                 const char     *custom_runtime_version,
+                 FlatpakRunFlags flags,
+                 const char     *custom_command,
+                 char           *args[],
+                 int             n_args,
+                 GCancellable   *cancellable,
+                 GError        **error)
+{
+  g_autoptr(FlatpakDeploy) runtime_deploy = NULL;
+  g_autoptr(GVariant) runtime_deploy_data = NULL;
+  g_autoptr(GVariant) app_deploy_data = NULL;
+  g_autoptr(GFile) app_files = NULL;
+  g_autoptr(GFile) runtime_files = NULL;
+  g_autoptr(GFile) bin_ldconfig = NULL;
+  g_autoptr(GFile) app_id_dir = NULL;
+  g_autofree char *default_runtime = NULL;
+  g_autofree char *default_command = NULL;
+  g_autofree char *runtime_ref = NULL;
+  g_autoptr(GKeyFile) metakey = NULL;
+  g_autoptr(GKeyFile) runtime_metakey = NULL;
+  g_autoptr(FlatpakBwrap) bwrap = NULL;
+  g_auto(GLnxTmpfile) arg_tmpf = { 0, };
+  g_autoptr(GPtrArray) real_argv_array = NULL;
+  const char *command = "/bin/sh";
+  g_autoptr(GError) my_error = NULL;
+  g_auto(GStrv) runtime_parts = NULL;
+  int i;
+  g_autofree char *app_info_path = NULL;
+  g_autoptr(FlatpakContext) app_context = NULL;
+  g_autoptr(FlatpakContext) overrides = NULL;
+  g_autoptr(FlatpakExports) exports = NULL;
+  g_auto(GStrv) app_ref_parts = NULL;
+  g_autofree char *commandline = NULL;
+  int commandline_2_start;
+  g_autofree char *commandline2 = NULL;
+  g_autofree char *doc_mount_path = NULL;
+  g_autofree char *app_extensions = NULL;
+  g_autofree char *runtime_extensions = NULL;
+  g_autofree char *checksum = NULL;
+  int ld_so_fd = -1;
+  g_autoptr(GFile) runtime_ld_so_conf = NULL;
+  gboolean generate_ld_so_conf = TRUE;
+  gboolean use_ld_so_cache = TRUE;
+  struct stat s;
+
+  app_ref_parts = flatpak_decompose_ref (app_ref, error);
+  if (app_ref_parts == NULL)
+    return FALSE;
+
+  bwrap = flatpak_bwrap_new (NULL);
+
+  if (app_deploy == NULL)
+    {
+      g_assert (g_str_has_prefix (app_ref, "runtime/"));
+      default_runtime = g_strdup (app_ref + strlen ("runtime/"));
+    }
+  else
+    {
+      const gchar *key;
+
+      app_deploy_data = flatpak_deploy_get_deploy_data (app_deploy, cancellable, error);
+      if (app_deploy_data == NULL)
+        return FALSE;
+
+      if ((flags & FLATPAK_RUN_FLAG_DEVEL) != 0)
+        key = FLATPAK_METADATA_KEY_SDK;
+      else
+        key = FLATPAK_METADATA_KEY_RUNTIME;
+
+      metakey = flatpak_deploy_get_metadata (app_deploy);
+      default_runtime = g_key_file_get_string (metakey,
+                                               FLATPAK_METADATA_GROUP_APPLICATION,
+                                               key, &my_error);
+      if (my_error)
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return FALSE;
+        }
+    }
+
+  runtime_parts = g_strsplit (default_runtime, "/", 0);
+  if (g_strv_length (runtime_parts) != 3)
+    return flatpak_fail (error, "Wrong number of components in runtime %s", default_runtime);
+
+  if (custom_runtime)
+    {
+      g_auto(GStrv) custom_runtime_parts = g_strsplit (custom_runtime, "/", 0);
+
+      for (i = 0; i < 3 && custom_runtime_parts[i] != NULL; i++)
+        {
+          if (strlen (custom_runtime_parts[i]) > 0)
+            {
+              g_free (runtime_parts[i]);
+              runtime_parts[i] = g_steal_pointer (&custom_runtime_parts[i]);
+            }
+        }
+    }
+
+  if (custom_runtime_version)
+    {
+      g_free (runtime_parts[2]);
+      runtime_parts[2] = g_strdup (custom_runtime_version);
+    }
+
+  runtime_ref = flatpak_compose_ref (FALSE,
+                                     runtime_parts[0],
+                                     runtime_parts[2],
+                                     runtime_parts[1],
+                                     error);
+  if (runtime_ref == NULL)
+    return FALSE;
+
+  runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, cancellable, error);
+  if (runtime_deploy == NULL)
+    return FALSE;
+
+  runtime_deploy_data = flatpak_deploy_get_deploy_data (runtime_deploy, cancellable, error);
+  if (runtime_deploy_data == NULL)
+    return FALSE;
+
+  runtime_metakey = flatpak_deploy_get_metadata (runtime_deploy);
+
+  app_context = flatpak_app_compute_permissions (metakey, runtime_metakey, error);
+  if (app_context == NULL)
+    return FALSE;
+
+  if (app_deploy != NULL)
+    {
+      overrides = flatpak_deploy_get_overrides (app_deploy);
+      flatpak_context_merge (app_context, overrides);
+    }
+
+  if (extra_context)
+    flatpak_context_merge (app_context, extra_context);
+
+  runtime_files = flatpak_deploy_get_files (runtime_deploy);
+  bin_ldconfig = g_file_resolve_relative_path (runtime_files, "bin/ldconfig");
+  if (!g_file_query_exists (bin_ldconfig, NULL))
+    use_ld_so_cache = FALSE;
+
+  if (app_deploy != NULL)
+    {
+      app_files = flatpak_deploy_get_files (app_deploy);
+      if ((app_id_dir = flatpak_ensure_data_dir (app_ref_parts[1], cancellable, error)) == NULL)
+        return FALSE;
+    }
+
+  flatpak_run_apply_env_default (bwrap, use_ld_so_cache);
+  flatpak_run_apply_env_vars (bwrap, app_context);
+
+  flatpak_bwrap_add_args (bwrap,
+                          "--ro-bind", flatpak_file_get_path_cached (runtime_files), "/usr",
+                          "--lock-file", "/usr/.ref",
+                          NULL);
+
+  if (app_files != NULL)
+    flatpak_bwrap_add_args (bwrap,
+                            "--ro-bind", flatpak_file_get_path_cached (app_files), "/app",
+                            "--lock-file", "/app/.ref",
+                            NULL);
+  else
+    flatpak_bwrap_add_args (bwrap,
+                            "--dir", "/app",
+                            NULL);
+
+  if (metakey != NULL &&
+      !flatpak_run_add_extension_args (bwrap, metakey, app_ref, use_ld_so_cache, &app_extensions, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_run_add_extension_args (bwrap, runtime_metakey, runtime_ref, use_ld_so_cache, &runtime_extensions, cancellable, error))
+    return FALSE;
+
+  runtime_ld_so_conf = g_file_resolve_relative_path (runtime_files, "etc/ld.so.conf");
+  if (lstat (flatpak_file_get_path_cached (runtime_ld_so_conf), &s) == 0)
+    generate_ld_so_conf = S_ISREG (s.st_mode) && s.st_size == 0;
+
+  /* At this point we have the minimal argv set up, with just the app, runtime and extensions.
+     We can reuse this to generate the ld.so.cache (if needed) */
+  if (use_ld_so_cache)
+    {
+      checksum = calculate_ld_cache_checksum (app_deploy_data, runtime_deploy_data,
+                                             app_extensions, runtime_extensions);
+      ld_so_fd = regenerate_ld_cache (bwrap->argv,
+                                     bwrap->fds,
+                                     app_id_dir,
+                                     checksum,
+                                     runtime_files,
+                                     generate_ld_so_conf,
+                                     cancellable, error);
+      if (ld_so_fd == -1)
+       return FALSE;
+      g_array_append_val (bwrap->fds, ld_so_fd);
+    }
+
+  if (app_context->features & FLATPAK_CONTEXT_FEATURE_DEVEL)
+    flags |= FLATPAK_RUN_FLAG_DEVEL;
+
+  if (app_context->features & FLATPAK_CONTEXT_FEATURE_MULTIARCH)
+    flags |= FLATPAK_RUN_FLAG_MULTIARCH;
+
+  if (!flatpak_run_setup_base_argv (bwrap, runtime_files, app_id_dir, app_ref_parts[2], flags, error))
+    return FALSE;
+
+  if (generate_ld_so_conf)
+    {
+      if (!add_ld_so_conf (bwrap, error))
+        return FALSE;
+    }
+
+  if (ld_so_fd != -1)
+    {
+      /* Don't add to fd_array, its already there */
+      add_args_data_fd (bwrap->argv, NULL, "--ro-bind-data", ld_so_fd, "/etc/ld.so.cache");
+    }
+
+  if (!flatpak_run_add_app_info_args (bwrap,
+                                      app_files, app_deploy_data, app_extensions,
+                                      runtime_files, runtime_deploy_data, runtime_extensions,
+                                      app_ref_parts[1], app_ref_parts[3],
+                                      runtime_ref, app_context, &app_info_path, error))
+    return FALSE;
+
+  add_document_portal_args (bwrap, app_ref_parts[1], &doc_mount_path);
+
+  if (!flatpak_run_add_environment_args (bwrap, app_info_path, flags,
+                                         app_ref_parts[1], app_context, app_id_dir, &exports, cancellable, error))
+    return FALSE;
+
+  flatpak_run_add_journal_args (bwrap);
+  add_font_path_args (bwrap);
+  add_icon_path_args (bwrap);
+
+  flatpak_bwrap_add_args (bwrap,
+                          /* Not in base, because we don't want this for flatpak build */
+                          "--symlink", "/app/lib/debug/source", "/run/build",
+                          "--symlink", "/usr/lib/debug/source", "/run/build-runtime",
+                          NULL);
+
+  if (custom_command)
+    {
+      command = custom_command;
+    }
+  else if (metakey)
+    {
+      default_command = g_key_file_get_string (metakey,
+                                               FLATPAK_METADATA_GROUP_APPLICATION,
+                                               FLATPAK_METADATA_KEY_COMMAND,
+                                               &my_error);
+      if (my_error)
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return FALSE;
+        }
+      command = default_command;
+    }
+
+  real_argv_array = g_ptr_array_new_with_free_func (g_free);
+  g_ptr_array_add (real_argv_array, g_strdup (flatpak_get_bwrap ()));
+
+  {
+    gsize len;
+    g_autofree char *args = join_args (bwrap->argv, &len);
+
+    if (!buffer_to_sealed_memfd_or_tmpfile (&arg_tmpf, "bwrap-args", args, len, error))
+      return FALSE;
+
+    add_args_data_fd (real_argv_array, bwrap->fds,
+                      "--args", glnx_steal_fd (&arg_tmpf.fd), NULL);
+  }
+
+  commandline_2_start = real_argv_array->len;
+
+  g_ptr_array_add (real_argv_array, g_strdup (command));
+  if (!add_rest_args (app_ref_parts[1], exports, (flags & FLATPAK_RUN_FLAG_FILE_FORWARDING) != 0,
+                      doc_mount_path,
+                      real_argv_array, args, n_args, error))
+    return FALSE;
+
+  g_ptr_array_add (real_argv_array, NULL);
+  g_ptr_array_add (bwrap->argv, NULL);
+
+  commandline = flatpak_quote_argv ((const char **) bwrap->argv->pdata);
+  commandline2 = flatpak_quote_argv (((const char **) real_argv_array->pdata) + commandline_2_start);
+  flatpak_debug2 ("Running '%s %s'", commandline, commandline2);
+
+  if ((flags & FLATPAK_RUN_FLAG_BACKGROUND) != 0)
+    {
+      if (!g_spawn_async (NULL,
+                          (char **) real_argv_array->pdata,
+                          bwrap->envp,
+                          G_SPAWN_SEARCH_PATH,
+                          child_setup, bwrap->fds,
+                          NULL,
+                          error))
+        return FALSE;
+    }
+  else
+    {
+      /* Ensure we unset O_CLOEXEC */
+      child_setup (bwrap->fds);
+      if (execvpe (flatpak_get_bwrap (), (char **) real_argv_array->pdata, bwrap->envp) == -1)
+        {
+          g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno),
+                               _("Unable to start app"));
+          return FALSE;
+        }
+      /* Not actually reached... */
+    }
+
+  return TRUE;
+}
diff --git a/common/flatpak-run.h b/common/flatpak-run.h
new file mode 100644 (file)
index 0000000..ec92328
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_RUN_H__
+#define __FLATPAK_RUN_H__
+
+#include "libglnx/libglnx.h"
+#include "dbus-proxy/flatpak-proxy.h"
+#include "flatpak-common-types.h"
+#include "flatpak-utils.h"
+
+gboolean flatpak_run_in_transient_unit (const char *app_id,
+                                        GError    **error);
+
+/* See flatpak-metadata(5) */
+
+#define FLATPAK_METADATA_GROUP_APPLICATION "Application"
+#define FLATPAK_METADATA_GROUP_RUNTIME "Runtime"
+#define FLATPAK_METADATA_KEY_COMMAND "command"
+#define FLATPAK_METADATA_KEY_NAME "name"
+#define FLATPAK_METADATA_KEY_REQUIRED_FLATPAK "required-flatpak"
+#define FLATPAK_METADATA_KEY_RUNTIME "runtime"
+#define FLATPAK_METADATA_KEY_SDK "sdk"
+#define FLATPAK_METADATA_KEY_TAGS "tags"
+
+#define FLATPAK_METADATA_GROUP_CONTEXT "Context"
+#define FLATPAK_METADATA_KEY_SHARED "shared"
+#define FLATPAK_METADATA_KEY_SOCKETS "sockets"
+#define FLATPAK_METADATA_KEY_FILESYSTEMS "filesystems"
+#define FLATPAK_METADATA_KEY_PERSISTENT "persistent"
+#define FLATPAK_METADATA_KEY_DEVICES "devices"
+#define FLATPAK_METADATA_KEY_FEATURES "features"
+
+#define FLATPAK_METADATA_GROUP_INSTANCE "Instance"
+#define FLATPAK_METADATA_KEY_APP_PATH "app-path"
+#define FLATPAK_METADATA_KEY_APP_COMMIT "app-commit"
+#define FLATPAK_METADATA_KEY_APP_EXTENSIONS "app-extensions"
+#define FLATPAK_METADATA_KEY_BRANCH "branch"
+#define FLATPAK_METADATA_KEY_FLATPAK_VERSION "flatpak-version"
+#define FLATPAK_METADATA_KEY_RUNTIME_PATH "runtime-path"
+#define FLATPAK_METADATA_KEY_RUNTIME_COMMIT "runtime-commit"
+#define FLATPAK_METADATA_KEY_RUNTIME_EXTENSIONS "runtime-extensions"
+#define FLATPAK_METADATA_KEY_SESSION_BUS_PROXY "session-bus-proxy"
+#define FLATPAK_METADATA_KEY_SYSTEM_BUS_PROXY "system-bus-proxy"
+
+#define FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY "Session Bus Policy"
+#define FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY "System Bus Policy"
+#define FLATPAK_METADATA_GROUP_PREFIX_POLICY "Policy "
+#define FLATPAK_METADATA_GROUP_ENVIRONMENT "Environment"
+
+#define FLATPAK_METADATA_GROUP_PREFIX_EXTENSION "Extension "
+#define FLATPAK_METADATA_KEY_ADD_LD_PATH "add-ld-path"
+#define FLATPAK_METADATA_KEY_AUTODELETE "autodelete"
+#define FLATPAK_METADATA_KEY_DIRECTORY "directory"
+#define FLATPAK_METADATA_KEY_DOWNLOAD_IF "download-if"
+#define FLATPAK_METADATA_KEY_ENABLE_IF "enable-if"
+#define FLATPAK_METADATA_KEY_MERGE_DIRS "merge-dirs"
+#define FLATPAK_METADATA_KEY_NO_AUTODOWNLOAD "no-autodownload"
+#define FLATPAK_METADATA_KEY_SUBDIRECTORIES "subdirectories"
+#define FLATPAK_METADATA_KEY_SUBDIRECTORY_SUFFIX "subdirectory-suffix"
+#define FLATPAK_METADATA_KEY_LOCALE_SUBSET "locale-subset"
+#define FLATPAK_METADATA_KEY_VERSION "version"
+#define FLATPAK_METADATA_KEY_VERSIONS "versions"
+
+#ifdef FLATPAK_ENABLE_P2P
+#define FLATPAK_METADATA_KEY_COLLECTION_ID "collection-id"
+#endif  /* FLATPAK_ENABLE_P2P */
+
+#define FLATPAK_METADATA_GROUP_EXTRA_DATA "Extra Data"
+#define FLATPAK_METADATA_KEY_EXTRA_DATA_CHECKSUM "checksum"
+#define FLATPAK_METADATA_KEY_EXTRA_DATA_INSTALLED_SIZE "installed-size"
+#define FLATPAK_METADATA_KEY_EXTRA_DATA_NAME "name"
+#define FLATPAK_METADATA_KEY_EXTRA_DATA_SIZE "size"
+#define FLATPAK_METADATA_KEY_EXTRA_DATA_URI "uri"
+#define FLATPAK_METADATA_KEY_NO_RUNTIME "NoRuntime"
+
+#define FLATPAK_METADATA_GROUP_EXTENSION_OF "ExtensionOf"
+#define FLATPAK_METADATA_KEY_PRIORITY "priority"
+#define FLATPAK_METADATA_KEY_REF "ref"
+
+extern const char *flatpak_context_sockets[];
+extern const char *flatpak_context_devices[];
+extern const char *flatpak_context_features[];
+extern const char *flatpak_context_shares[];
+
+typedef struct {
+  GPtrArray *argv;
+  GArray *fds;
+  GStrv envp;
+} FlatpakBwrap;
+
+FlatpakBwrap *flatpak_bwrap_new              (char         **env);
+void          flatpak_bwrap_free             (FlatpakBwrap  *bwrap);
+void          flatpak_bwrap_set_env          (FlatpakBwrap  *bwrap,
+                                              const char    *variable,
+                                              const char    *value,
+                                              gboolean       overwrite);
+void          flatpak_bwrap_unset_env        (FlatpakBwrap  *bwrap,
+                                              const char    *variable);
+void          flatpak_bwrap_add_args         (FlatpakBwrap  *bwrap,
+                                              ...);
+void          flatpak_bwrap_append_argsv     (FlatpakBwrap *bwrap,
+                                              char        **args,
+                                              int           len);
+void          flatpak_bwrap_append_args      (FlatpakBwrap  *bwrap,
+                                              GPtrArray     *other_array);
+void          flatpak_bwrap_add_args_data_fd (FlatpakBwrap  *bwrap,
+                                              const char    *op,
+                                              int            fd,
+                                              const char    *path_optional);
+gboolean      flatpak_bwrap_add_args_data    (FlatpakBwrap  *bwrap,
+                                              const char    *name,
+                                              const char    *content,
+                                              gssize         content_size,
+                                              const char    *path,
+                                              GError       **error);
+void          flatpak_bwrap_add_bind_arg     (FlatpakBwrap  *bwrap,
+                                              const char    *type,
+                                              const char    *src,
+                                              const char    *dest);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakBwrap, flatpak_bwrap_free)
+
+
+FlatpakContext *flatpak_context_new (void);
+void           flatpak_context_free (FlatpakContext *context);
+void           flatpak_context_merge (FlatpakContext *context,
+                                      FlatpakContext *other);
+GOptionGroup  *flatpak_context_get_options (FlatpakContext *context);
+void           flatpak_context_complete (FlatpakContext *context,
+                                         FlatpakCompletion *completion);
+gboolean       flatpak_context_load_metadata (FlatpakContext *context,
+                                              GKeyFile       *metakey,
+                                              GError        **error);
+void           flatpak_context_save_metadata (FlatpakContext *context,
+                                              gboolean        flatten,
+                                              GKeyFile       *metakey);
+void           flatpak_context_allow_host_fs (FlatpakContext *context);
+void           flatpak_context_set_session_bus_policy (FlatpakContext *context,
+                                                       const char     *name,
+                                                       FlatpakPolicy   policy);
+void           flatpak_context_set_system_bus_policy (FlatpakContext *context,
+                                                      const char     *name,
+                                                      FlatpakPolicy   policy);
+void           flatpak_context_to_args (FlatpakContext *context,
+                                        GPtrArray *args);
+gboolean       flatpak_context_get_needs_session_bus_proxy (FlatpakContext *context);
+gboolean       flatpak_context_get_needs_system_bus_proxy (FlatpakContext *context);
+
+FlatpakContext *flatpak_context_load_for_app (const char     *app_id,
+                                              GError        **error);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakContext, flatpak_context_free)
+
+typedef enum {
+  FLATPAK_RUN_FLAG_DEVEL              = (1 << 0),
+  FLATPAK_RUN_FLAG_BACKGROUND         = (1 << 1),
+  FLATPAK_RUN_FLAG_LOG_SESSION_BUS    = (1 << 2),
+  FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS     = (1 << 3),
+  FLATPAK_RUN_FLAG_NO_SESSION_HELPER  = (1 << 4),
+  FLATPAK_RUN_FLAG_MULTIARCH          = (1 << 5),
+  FLATPAK_RUN_FLAG_WRITABLE_ETC       = (1 << 6),
+  FLATPAK_RUN_FLAG_NO_SESSION_BUS_PROXY = (1 << 7),
+  FLATPAK_RUN_FLAG_NO_SYSTEM_BUS_PROXY = (1 << 8),
+  FLATPAK_RUN_FLAG_SET_PERSONALITY    = (1 << 9),
+  FLATPAK_RUN_FLAG_FILE_FORWARDING    = (1 << 10),
+  FLATPAK_RUN_FLAG_DIE_WITH_PARENT    = (1 << 11),
+  FLATPAK_RUN_FLAG_LOG_A11Y_BUS       = (1 << 12),
+  FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY  = (1 << 13),
+} FlatpakRunFlags;
+
+typedef struct _FlatpakExports FlatpakExports;
+
+void flatpak_exports_free (FlatpakExports *exports);
+
+gboolean flatpak_exports_path_is_visible (FlatpakExports *exports,
+                                          const char *path);
+FlatpakExports *flatpak_exports_from_context (FlatpakContext *context,
+                                              const char *app_id);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakExports, flatpak_exports_free);
+
+gboolean  flatpak_run_add_extension_args (FlatpakBwrap   *bwrap,
+                                          GKeyFile     *metakey,
+                                          const char   *full_ref,
+                                          gboolean      use_ld_so_cache,
+                                          char        **extensions_out,
+                                          GCancellable *cancellable,
+                                          GError      **error);
+gboolean flatpak_run_add_environment_args (FlatpakBwrap   *bwrap,
+                                           const char     *app_info_path,
+                                           FlatpakRunFlags flags,
+                                           const char     *app_id,
+                                           FlatpakContext *context,
+                                           GFile          *app_id_dir,
+                                           FlatpakExports **exports_out,
+                                           GCancellable *cancellable,
+                                           GError      **error);
+char **  flatpak_run_get_minimal_env (gboolean devel, gboolean use_ld_so_cache);
+void     flatpak_run_apply_env_default (FlatpakBwrap *bwrap, gboolean use_ld_so_cache);
+void     flatpak_run_apply_env_appid (FlatpakBwrap *bwrap,
+                                      GFile *app_dir);
+void      flatpak_run_apply_env_vars (FlatpakBwrap *bwrap,
+                                      FlatpakContext *context);
+FlatpakContext *flatpak_app_compute_permissions (GKeyFile *app_metadata,
+                                                 GKeyFile *runtime_metadata,
+                                                 GError  **error);
+GFile *flatpak_get_data_dir (const char *app_id);
+GFile *flatpak_ensure_data_dir (const char   *app_id,
+                                GCancellable *cancellable,
+                                GError      **error);
+
+gboolean flatpak_run_setup_base_argv (FlatpakBwrap   *bwrap,
+                                      GFile          *runtime_files,
+                                      GFile          *app_id_dir,
+                                      const char     *arch,
+                                      FlatpakRunFlags flags,
+                                      GError        **error);
+gboolean flatpak_run_add_app_info_args (FlatpakBwrap   *bwrap,
+                                        GFile          *app_files,
+                                        GVariant       *app_deploy_data,
+                                        const char     *app_extensions,
+                                        GFile          *runtime_files,
+                                        GVariant       *runtime_deploy_data,
+                                        const char     *runtime_extensions,
+                                        const char     *app_id,
+                                        const char     *app_branch,
+                                        const char     *runtime_ref,
+                                        FlatpakContext *final_app_context,
+                                        char          **app_info_path_out,
+                                        GError        **error);
+
+gboolean flatpak_run_app (const char     *app_ref,
+                          FlatpakDeploy  *app_deploy,
+                          FlatpakContext *extra_context,
+                          const char     *custom_runtime,
+                          const char     *custom_runtime_version,
+                          FlatpakRunFlags flags,
+                          const char     *custom_command,
+                          char           *args[],
+                          int             n_args,
+                          GCancellable   *cancellable,
+                          GError        **error);
+
+
+#endif /* __FLATPAK_RUN_H__ */
diff --git a/common/flatpak-table-printer.c b/common/flatpak-table-printer.c
new file mode 100644 (file)
index 0000000..8bb7ab1
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-table-printer.h"
+#include "flatpak-utils.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <locale.h>
+
+
+typedef struct {
+  char *text;
+  int align;
+} Cell;
+
+static void
+free_cell (gpointer data)
+{
+  Cell *cell = data;
+
+  g_free (cell->text);
+  g_free (cell);
+}
+
+struct FlatpakTablePrinter
+{
+  GPtrArray *titles;
+  GPtrArray *rows;
+  GPtrArray *current;
+  int        n_columns;
+};
+
+FlatpakTablePrinter *
+flatpak_table_printer_new (void)
+{
+  FlatpakTablePrinter *printer = g_new0 (FlatpakTablePrinter, 1);
+
+  printer->titles = g_ptr_array_new_with_free_func (g_free);
+  printer->rows = g_ptr_array_new_with_free_func ((GDestroyNotify) g_ptr_array_unref);
+  printer->current = g_ptr_array_new_with_free_func (free_cell);
+
+  return printer;
+}
+
+void
+flatpak_table_printer_free (FlatpakTablePrinter *printer)
+{
+  g_ptr_array_free (printer->titles, TRUE);
+  g_ptr_array_free (printer->rows, TRUE);
+  g_ptr_array_free (printer->current, TRUE);
+  g_free (printer);
+}
+
+void
+flatpak_table_printer_set_column_title (FlatpakTablePrinter *printer,
+                                        int                  column,
+                                        const char          *text)
+{
+  g_ptr_array_insert (printer->titles, column, g_strdup (text));
+}
+
+void
+flatpak_table_printer_add_aligned_column (FlatpakTablePrinter *printer,
+                                          const char          *text,
+                                          int                  align)
+{
+  Cell *cell = g_new (Cell, 1);
+  cell->text = text ? g_strdup (text) : g_strdup ("");
+  cell->align = align;
+  g_ptr_array_add (printer->current, cell);
+}
+
+static const char *
+find_decimal_point (const char *text)
+{
+  struct lconv *locale_data;
+
+  locale_data = localeconv ();
+  return strstr (text, locale_data->decimal_point);
+}
+
+void
+flatpak_table_printer_add_decimal_column (FlatpakTablePrinter *printer,
+                                          const char          *text)
+{
+  const char *decimal;
+  int align = -1;
+
+  decimal = find_decimal_point (text);
+  if (decimal)
+    align = decimal - text;
+
+  flatpak_table_printer_add_aligned_column (printer, text, align);
+}
+
+void
+flatpak_table_printer_add_column (FlatpakTablePrinter *printer,
+                                  const char          *text)
+{
+  flatpak_table_printer_add_aligned_column (printer, text, -1);
+}
+
+void
+flatpak_table_printer_add_column_len (FlatpakTablePrinter *printer,
+                                      const char          *text,
+                                      gsize                len)
+{
+  Cell *cell = g_new (Cell, 1);
+  cell->text = text ? g_strndup (text, len) : g_strdup ("");
+  cell->align = -1;
+  g_ptr_array_add (printer->current, cell);
+}
+
+void
+flatpak_table_printer_append_with_comma (FlatpakTablePrinter *printer,
+                                         const char          *text)
+{
+  Cell *cell;
+  char *new;
+
+  g_assert (printer->current->len > 0);
+
+  cell = g_ptr_array_index (printer->current, printer->current->len - 1);
+
+  if (cell->text[0] != 0)
+    new = g_strconcat (cell->text, ",", text, NULL);
+  else
+    new = g_strdup (text);
+
+  g_free (cell->text);
+  cell->text = new;
+}
+
+
+void
+flatpak_table_printer_finish_row (FlatpakTablePrinter *printer)
+{
+  if (printer->current->len == 0)
+    return; /* Ignore empty rows */
+
+  printer->n_columns = MAX (printer->n_columns, printer->current->len);
+  g_ptr_array_add (printer->rows, printer->current);
+  printer->current = g_ptr_array_new_with_free_func (free_cell);
+}
+
+void
+flatpak_table_printer_print (FlatpakTablePrinter *printer)
+{
+  g_autofree int *widths = NULL;
+  g_autofree int *lwidths = NULL;
+  g_autofree int *rwidths = NULL;
+  int i, j;
+
+  if (printer->current->len != 0)
+    flatpak_table_printer_finish_row (printer);
+
+  widths = g_new0 (int, printer->n_columns);
+  lwidths = g_new0 (int, printer->n_columns);
+  rwidths = g_new0 (int, printer->n_columns);
+
+  for (i = 0; i < printer->titles->len && i < printer->n_columns; i++)
+    {
+      char *title = g_ptr_array_index (printer->titles, i);
+
+      if (title)
+        widths[i] = MAX (widths[i], strlen (title));
+    }
+
+  for (i = 0; i < printer->rows->len; i++)
+    {
+      GPtrArray *row = g_ptr_array_index (printer->rows, i);
+
+      for (j = 0; j < row->len; j++)
+        {
+          Cell *cell = g_ptr_array_index (row, j);
+          int width;
+
+          width = strlen (cell->text);
+          widths[j] = MAX (widths[j], width);
+          if (cell->align >= 0)
+            {
+              lwidths[j] = MAX (lwidths[j], cell->align);
+              rwidths[j] = MAX (rwidths[j], width - cell->align);
+            }
+        }
+    }
+
+  if (flatpak_fancy_output () && printer->titles->len > 0)
+    {
+      g_print (FLATPAK_ANSI_BOLD_ON);
+      for (i = 0; i < printer->titles->len && i < printer->n_columns; i++)
+        {
+          char *title = g_ptr_array_index (printer->titles, i);
+
+          g_print ("%s%-*s", (i == 0) ? "" : " ", widths[i], title);
+        }
+      g_print (FLATPAK_ANSI_BOLD_OFF);
+      g_print ("\n");
+    }
+
+  for (i = 0; i < printer->rows->len; i++)
+    {
+      GPtrArray *row = g_ptr_array_index (printer->rows, i);
+
+      for (j = 0; j < row->len; j++)
+        {
+          Cell *cell = g_ptr_array_index (row, j);
+          if (cell->align < 0)
+            g_print ("%s%-*s", (j == 0) ? "" : " ", widths[j], cell->text);
+          else
+            g_print ("%s%*s%-*s", (j == 0) ? "" : " ", lwidths[j] - cell->align, "", widths[j] - (lwidths[j] - cell->align), cell->text);
+        }
+      g_print ("\n");
+    }
+}
diff --git a/common/flatpak-table-printer.h b/common/flatpak-table-printer.h
new file mode 100644 (file)
index 0000000..b19f5aa
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_TABLE_PRINTER_H__
+#define __FLATPAK_TABLE_PRINTER_H__
+
+#include <gio/gio.h>
+
+typedef struct FlatpakTablePrinter FlatpakTablePrinter;
+
+FlatpakTablePrinter *flatpak_table_printer_new               (void);
+void                flatpak_table_printer_free               (FlatpakTablePrinter *printer);
+void                flatpak_table_printer_set_column_title   (FlatpakTablePrinter *printer,
+                                                              int                  column,
+                                                              const char          *title);
+void                flatpak_table_printer_add_column         (FlatpakTablePrinter *printer,
+                                                              const char          *text);
+void                flatpak_table_printer_add_aligned_column (FlatpakTablePrinter *printer,
+                                                              const char          *text,
+                                                              int                  align);
+void                flatpak_table_printer_add_decimal_column (FlatpakTablePrinter *printer,
+                                                              const char          *text);
+void                flatpak_table_printer_add_column_len     (FlatpakTablePrinter *printer,
+                                                              const char          *text,
+                                                              gsize                len);
+void                flatpak_table_printer_append_with_comma  (FlatpakTablePrinter *printer,
+                                                              const char          *text);
+void                flatpak_table_printer_finish_row         (FlatpakTablePrinter *printer);
+void                flatpak_table_printer_print              (FlatpakTablePrinter *printer);
+
+#endif /* __FLATPAK_TABLE_PRINTER_H__ */
diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c
new file mode 100644 (file)
index 0000000..56b5e67
--- /dev/null
@@ -0,0 +1,6629 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-utils.h"
+#include "lib/flatpak-error.h"
+#include "flatpak-dir.h"
+#include "flatpak-portal-error.h"
+#include "flatpak-oci-registry.h"
+#include "flatpak-run.h"
+
+#include <glib/gi18n.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/types.h>
+#include <sys/utsname.h>
+#include <sys/ioctl.h>
+
+#include <glib.h>
+#include "libglnx/libglnx.h"
+#include <libsoup/soup.h>
+#include <gio/gunixoutputstream.h>
+#include <gio/gunixinputstream.h>
+
+/* This is also here so the common code can report these errors to the lib */
+static const GDBusErrorEntry flatpak_error_entries[] = {
+  {FLATPAK_ERROR_ALREADY_INSTALLED,     "org.freedesktop.Flatpak.Error.AlreadyInstalled"},
+  {FLATPAK_ERROR_NOT_INSTALLED,         "org.freedesktop.Flatpak.Error.NotInstalled"},
+};
+
+typedef struct archive FlatpakAutoArchiveRead;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(FlatpakAutoArchiveRead, archive_read_free)
+
+static void
+propagate_libarchive_error (GError      **error,
+                            struct archive *a)
+{
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+               "%s", archive_error_string (a));
+}
+
+GQuark
+flatpak_error_quark (void)
+{
+  static volatile gsize quark_volatile = 0;
+
+  g_dbus_error_register_error_domain ("flatpak-error-quark",
+                                      &quark_volatile,
+                                      flatpak_error_entries,
+                                      G_N_ELEMENTS (flatpak_error_entries));
+  return (GQuark) quark_volatile;
+}
+
+void
+flatpak_debug2 (const char *format, ...)
+{
+  va_list var_args;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+  va_start (var_args, format);
+  g_logv (G_LOG_DOMAIN"2",
+          G_LOG_LEVEL_DEBUG,
+          format, var_args);
+  va_end (var_args);
+#pragma GCC diagnostic pop
+
+}
+
+GFile *
+flatpak_file_new_tmp_in (GFile *dir,
+                         const char *template,
+                         GError        **error)
+{
+  glnx_autofd int tmp_fd = -1;
+  g_autofree char *tmpl = g_build_filename (flatpak_file_get_path_cached (dir), template, NULL);
+
+  tmp_fd = g_mkstemp_full (tmpl, O_RDWR, 0644);
+  if (tmp_fd == -1)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  return g_file_new_for_path (tmpl);
+}
+
+gboolean
+flatpak_write_update_checksum (GOutputStream  *out,
+                               gconstpointer   data,
+                               gsize           len,
+                               gsize          *out_bytes_written,
+                               GChecksum      *checksum,
+                               GCancellable   *cancellable,
+                               GError        **error)
+{
+  if (out)
+    {
+      if (!g_output_stream_write_all (out, data, len, out_bytes_written,
+                                      cancellable, error))
+        return FALSE;
+    }
+  else if (out_bytes_written)
+    {
+      *out_bytes_written = len;
+    }
+
+  if (checksum)
+    g_checksum_update (checksum, data, len);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_splice_update_checksum (GOutputStream  *out,
+                                GInputStream   *in,
+                                GChecksum      *checksum,
+                                FlatpakLoadUriProgress progress,
+                                gpointer        progress_data,
+                                GCancellable   *cancellable,
+                                GError        **error)
+{
+  gsize bytes_read, bytes_written;
+  char buf[32*1024];
+  guint64 downloaded_bytes = 0;
+  gint64 progress_start;
+
+  progress_start = g_get_monotonic_time ();
+  do
+    {
+      if (!g_input_stream_read_all (in, buf, sizeof buf, &bytes_read, cancellable, error))
+        return FALSE;
+
+      if (!flatpak_write_update_checksum (out, buf, bytes_read, &bytes_written, checksum,
+                                          cancellable, error))
+        return FALSE;
+
+      downloaded_bytes += bytes_read;
+
+      if (progress &&
+          g_get_monotonic_time () - progress_start >  5 * 1000000)
+        {
+          progress (downloaded_bytes, progress_data);
+          progress_start = g_get_monotonic_time ();
+        }
+    }
+  while (bytes_read > 0);
+
+  if (progress)
+    progress (downloaded_bytes, progress_data);
+
+  return TRUE;
+}
+
+GBytes *
+flatpak_read_stream (GInputStream *in,
+                     gboolean      null_terminate,
+                     GError      **error)
+{
+  g_autoptr(GOutputStream) mem_stream = NULL;
+
+  mem_stream = g_memory_output_stream_new_resizable ();
+  if (g_output_stream_splice (mem_stream, in,
+                              0, NULL, error) < 0)
+    return NULL;
+
+  if (null_terminate)
+    {
+      if (!g_output_stream_write (G_OUTPUT_STREAM (mem_stream), "\0", 1, NULL, error))
+        return NULL;
+    }
+
+  if (!g_output_stream_close (G_OUTPUT_STREAM (mem_stream), NULL, error))
+    return NULL;
+
+  return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (mem_stream));
+}
+
+gint
+flatpak_strcmp0_ptr (gconstpointer a,
+                     gconstpointer b)
+{
+  return g_strcmp0 (*(char * const *) a, *(char * const *) b);
+}
+
+/* Compares if str has a specific path prefix. This differs
+   from a regular prefix in two ways. First of all there may
+   be multiple slashes separating the path elements, and
+   secondly, if a prefix is matched that has to be en entire
+   path element. For instance /a/prefix matches /a/prefix/foo/bar,
+   but not /a/prefixfoo/bar. */
+gboolean
+flatpak_has_path_prefix (const char *str,
+                         const char *prefix)
+{
+  while (TRUE)
+    {
+      /* Skip consecutive slashes to reach next path
+         element */
+      while (*str == '/')
+        str++;
+      while (*prefix == '/')
+        prefix++;
+
+      /* No more prefix path elements? Done! */
+      if (*prefix == 0)
+        return TRUE;
+
+      /* Compare path element */
+      while (*prefix != 0 && *prefix != '/')
+        {
+          if (*str != *prefix)
+            return FALSE;
+          str++;
+          prefix++;
+        }
+
+      /* Matched prefix path element,
+         must be entire str path element */
+      if (*str != '/' && *str != 0)
+        return FALSE;
+    }
+}
+
+/* Returns end of matching path prefix, or NULL if no match */
+const char *
+flatpak_path_match_prefix (const char *pattern,
+                           const char *string)
+{
+  char c, test;
+  const char *tmp;
+
+  while (*pattern == '/')
+    pattern++;
+
+  while (*string == '/')
+    string++;
+
+  while (TRUE)
+    {
+      switch (c = *pattern++)
+        {
+        case 0:
+          if (*string == '/' || *string == 0)
+            return string;
+          return NULL;
+
+        case '?':
+          if (*string == '/' || *string == 0)
+            return NULL;
+          string++;
+          break;
+
+        case '*':
+          c = *pattern;
+
+          while (c == '*')
+            c = *++pattern;
+
+          /* special case * at end */
+          if (c == 0)
+            {
+              char *tmp = strchr (string, '/');
+              if (tmp != NULL)
+                return tmp;
+              return string + strlen (string);
+            }
+          else if (c == '/')
+            {
+              string = strchr (string, '/');
+              if (string == NULL)
+                return NULL;
+              break;
+            }
+
+          while ((test = *string) != 0)
+            {
+              tmp = flatpak_path_match_prefix (pattern, string);
+              if (tmp != NULL)
+                return tmp;
+              if (test == '/')
+                break;
+              string++;
+            }
+          return NULL;
+
+        default:
+          if (c != *string)
+            return NULL;
+          string++;
+          break;
+        }
+    }
+  return NULL; /* Should not be reached */
+}
+
+static const char *
+flatpak_get_kernel_arch (void)
+{
+  static struct utsname buf;
+  static char *arch = NULL;
+  char *m;
+
+  if (arch != NULL)
+    return arch;
+
+  if (uname (&buf))
+    {
+      arch = "unknown";
+      return arch;
+    }
+
+  /* By default, just pass on machine, good enough for most arches */
+  arch = buf.machine;
+
+  /* Override for some arches */
+
+  m = buf.machine;
+  /* i?86 */
+  if (strlen (m) == 4 && m[0] == 'i' && m[2] == '8'  && m[3] == '6')
+    {
+      arch = "i386";
+    }
+  else if (g_str_has_prefix (m, "arm"))
+    {
+      if (g_str_has_suffix (m, "b"))
+        arch = "armeb";
+      else
+        arch = "arm";
+    }
+  else if (strcmp (m, "mips") == 0)
+    {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+      arch = "mipsel";
+#endif
+    }
+  else if (strcmp (m, "mips64") == 0)
+    {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+      arch = "mips64el";
+#endif
+    }
+
+  return arch;
+}
+
+/* This maps the kernel-reported uname to a single string representing
+ * the cpu family, in the sense that all members of this family would
+ * be able to understand and link to a binary file with such cpu
+ * opcodes. That doesn't necessarily mean that all members of the
+ * family can run all opcodes, for instance for modern 32bit intel we
+ * report "i386", even though they support instructions that the
+ * original i386 cpu cannot run. Still, such an executable would
+ * at least try to execute a 386, whereas an arm binary would not.
+ */
+const char *
+flatpak_get_arch (void)
+{
+  /* Avoid using uname on multiarch machines, because uname reports the kernels
+   * arch, and that may be different from userspace. If e.g. the kernel is 64bit and
+   * the userspace is 32bit we want to use 32bit by default. So, we take the current build
+   * arch as the default. */
+#if defined(__i386__)
+  return "i386";
+#elif defined(__x86_64__)
+  return "x86_64";
+#elif defined(__aarch64__)
+  return "aarch64";
+#elif defined(__arm__)
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+  return "arm";
+#else
+  return "armeb";
+#endif
+#else
+  return flatpak_get_kernel_arch ();
+#endif
+}
+
+gboolean
+flatpak_is_linux32_arch (const char *arch)
+{
+  const char *kernel_arch = flatpak_get_kernel_arch ();
+
+  if (strcmp (kernel_arch, "x86_64") == 0 &&
+      strcmp (arch, "i386") == 0)
+    return TRUE;
+
+  if (strcmp (kernel_arch, "aarch64") == 0 &&
+      strcmp (arch, "arm") == 0)
+    return TRUE;
+
+  return FALSE;
+}
+
+/* Get all compatible arches for this host in order of priority */
+const char **
+flatpak_get_arches (void)
+{
+  static gsize arches = 0;
+  static struct {
+    const char *kernel_arch;
+    const char *compat_arch;
+  } compat_arches[] = {
+    { "x86_64", "i386" },
+    { "aarch64", "arm" },
+  };
+
+  if (g_once_init_enter (&arches))
+    {
+      gsize new_arches = 0;
+      const char *main_arch = flatpak_get_arch ();
+      const char *kernel_arch = flatpak_get_kernel_arch ();
+      GPtrArray *array = g_ptr_array_new ();
+      int i;
+
+      /* This is the userspace arch, i.e. the one flatpak itself was
+         build for. It's always first. */
+      g_ptr_array_add (array, (char *)main_arch);
+
+      /* Also add all other arches that are compatible with the kernel arch */
+      for (i = 0; i < G_N_ELEMENTS(compat_arches); i++)
+        {
+          if ((strcmp (compat_arches[i].kernel_arch, kernel_arch) == 0) &&
+              /* Don't re-add the main arch */
+              (strcmp (compat_arches[i].compat_arch, main_arch) != 0))
+            g_ptr_array_add (array, (char *)compat_arches[i].compat_arch);
+        }
+
+      g_ptr_array_add (array, NULL);
+      new_arches = (gsize)g_ptr_array_free (array, FALSE);
+
+      g_once_init_leave (&arches, new_arches);
+ }
+
+  return (const char **)arches;
+}
+
+const char **
+flatpak_get_gl_drivers (void)
+{
+  static gsize drivers = 0;
+  if (g_once_init_enter (&drivers))
+    {
+      gsize new_drivers;
+      char **new_drivers_c = 0;
+      const char *env = g_getenv ("FLATPAK_GL_DRIVERS");
+      if (env != NULL && *env != 0)
+        new_drivers_c = g_strsplit (env, ":", -1);
+      else
+        {
+          g_autofree char *nvidia_version = NULL;
+          char *dot;
+          GPtrArray *array = g_ptr_array_new ();
+
+          if (g_file_get_contents ("/sys/module/nvidia/version",
+                                   &nvidia_version, NULL, NULL))
+            {
+              g_strstrip (nvidia_version);
+              /* Convert dots to dashes */
+              while ((dot = strchr (nvidia_version, '.')) != NULL)
+                *dot = '-';
+              g_ptr_array_add (array, g_strconcat ("nvidia-", nvidia_version, NULL));
+            }
+
+          g_ptr_array_add (array, (char *)"default");
+          g_ptr_array_add (array, (char *)"host");
+
+          g_ptr_array_add (array, NULL);
+          new_drivers_c = (char **)g_ptr_array_free (array, FALSE);
+        }
+
+      new_drivers = (gsize)new_drivers_c;
+      g_once_init_leave (&drivers, new_drivers);
+    }
+
+  return (const char **)drivers;
+}
+
+static gboolean
+flatpak_get_have_intel_gpu (void)
+{
+  static int have_intel = -1;
+
+  if (have_intel == -1)
+    have_intel = g_file_test ("/sys/module/i915", G_FILE_TEST_EXISTS);
+
+  return have_intel;
+}
+
+static const char *
+flatpak_get_gtk_theme (void)
+{
+  static char *gtk_theme;
+
+  if (g_once_init_enter (&gtk_theme))
+    {
+      /* The schema may not be installed so check first */
+      GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
+      g_autoptr(GSettingsSchema) schema = g_settings_schema_source_lookup (source,
+                                            "org.gnome.desktop.interface", FALSE);
+
+      if (schema == NULL)
+        g_once_init_leave (&gtk_theme, g_strdup (""));
+      else
+        {
+          /* GSettings is used to store the theme if you use Wayland or GNOME.
+           * TODO: Check XSettings Net/ThemeName for other desktops.
+           * We don't care about any other method (like settings.ini) because they
+           *   aren't passed through the sandbox anyway. */
+          g_autoptr(GSettings) settings = g_settings_new ("org.gnome.desktop.interface");
+          g_once_init_leave (&gtk_theme, g_settings_get_string (settings, "gtk-theme"));
+        }
+    }
+
+  return (const char*)gtk_theme;
+}
+
+gboolean
+flatpak_is_in_sandbox (void)
+{
+  static gsize in_sandbox = 0;
+
+  if (g_once_init_enter (&in_sandbox))
+    {
+      g_autofree char *path = g_build_filename (g_get_user_runtime_dir (), "flatpak-info", NULL);
+      gsize new_in_sandbox;
+
+      new_in_sandbox = 2;
+      if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
+        new_in_sandbox = 1;
+
+      g_once_init_leave (&in_sandbox, new_in_sandbox);
+ }
+
+  return in_sandbox == 1;
+}
+
+gboolean
+flatpak_fancy_output (void)
+{
+        return isatty (STDOUT_FILENO);
+}
+
+const char *
+flatpak_get_bwrap (void)
+{
+  const char *e = g_getenv ("FLATPAK_BWRAP");
+
+  if (e != NULL)
+    return e;
+  return HELPER;
+}
+
+gboolean
+flatpak_break_hardlink (GFile *file, GError **error)
+{
+  g_autofree char *path = g_file_get_path (file);
+  struct stat st_buf;
+
+  if (stat (path, &st_buf) == 0 && st_buf.st_nlink > 1)
+    {
+      g_autoptr(GFile) dir = g_file_get_parent (file);
+      g_autoptr(GFile) tmp = NULL;
+
+      tmp = flatpak_file_new_tmp_in (dir, ".breaklinkXXXXXX", error);
+      if (tmp == NULL)
+        return FALSE;
+
+      if (!g_file_copy (file, tmp,
+                        G_FILE_COPY_OVERWRITE,
+                        NULL, NULL, NULL, error))
+        return FALSE;
+
+      if (rename (flatpak_file_get_path_cached (tmp), path) != 0)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+/* We only migrate the user dir, because thats what most people used with xdg-app,
+ * and its where all per-user state/config are stored.
+ */
+void
+flatpak_migrate_from_xdg_app (void)
+{
+  g_autofree char *source = g_build_filename (g_get_user_data_dir (), "xdg-app", NULL);
+  g_autofree char *dest = g_build_filename (g_get_user_data_dir (), "flatpak", NULL);
+
+  if (!g_file_test (dest, G_FILE_TEST_EXISTS) &&
+      g_file_test (source, G_FILE_TEST_EXISTS))
+    {
+      g_print (_("Migrating %s to %s\n"), source, dest);
+      if (rename (source, dest) != 0)
+        {
+          if (errno != ENOENT &&
+              errno != ENOTEMPTY &&
+              errno != EEXIST)
+            g_print (_("Error during migration: %s\n"), g_strerror (errno));
+        }
+    }
+}
+
+static gboolean
+is_valid_initial_name_character (gint c, gboolean allow_dash)
+{
+  return
+    (c >= 'A' && c <= 'Z') ||
+    (c >= 'a' && c <= 'z') ||
+    (c == '_') || (allow_dash && c == '-');
+}
+
+static gboolean
+is_valid_name_character (gint c, gboolean allow_dash)
+{
+  return
+    is_valid_initial_name_character (c, allow_dash) ||
+    (c >= '0' && c <= '9');
+}
+
+/** flatpak_is_valid_name:
+ * @string: The string to check
+ * @error: Return location for an error
+ *
+ * Checks if @string is a valid application name.
+ *
+ * App names are composed of 3 or more elements separated by a period
+ * ('.') character. All elements must contain at least one character.
+ *
+ * Each element must only contain the ASCII characters
+ * "[A-Z][a-z][0-9]_-". Elements may not begin with a digit.
+ * Additionally "-" is only allowed in the last element.
+ *
+ * App names must not begin with a '.' (period) character.
+ *
+ * App names must not exceed 255 characters in length.
+ *
+ * The above means that any app name is also a valid DBus well known
+ * bus name, but not all DBus names are valid app names. The difference are:
+ * 1) DBus name elements may contain '-' in the non-last element.
+ * 2) DBus names require only two elements
+ *
+ * Returns: %TRUE if valid, %FALSE otherwise.
+ *
+ * Since: 2.26
+ */
+gboolean
+flatpak_is_valid_name (const char *string,
+                       GError **error)
+{
+  guint len;
+  gboolean ret;
+  const gchar *s;
+  const gchar *end;
+  const gchar *last_dot;
+  int dot_count;
+  gboolean last_element;
+
+  g_return_val_if_fail (string != NULL, FALSE);
+
+  ret = FALSE;
+
+  len = strlen (string);
+  if (G_UNLIKELY (len == 0))
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Name can't be empty");
+      goto out;
+    }
+
+  if (G_UNLIKELY (len > 255))
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Name can't be longer than 255 characters");
+      goto out;
+    }
+
+  end = string + len;
+
+  last_dot = strrchr (string, '.');
+  last_element = FALSE;
+
+  s = string;
+  if (G_UNLIKELY (*s == '.'))
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Name can't start with a period");
+      goto out;
+    }
+  else if (G_UNLIKELY (!is_valid_initial_name_character (*s, last_element)))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Name can't start with %c", *s);
+      goto out;
+    }
+
+  s += 1;
+  dot_count = 0;
+  while (s != end)
+    {
+      if (*s == '.')
+        {
+          if (s == last_dot)
+            last_element = TRUE;
+          s += 1;
+          if (G_UNLIKELY (s == end))
+            {
+              g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                                   "Name can't end with a period");
+              goto out;
+            }
+          if (!is_valid_initial_name_character (*s, last_element))
+            {
+              if (*s == '-')
+                g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                             "Only last name segment can contain -");
+              else
+                g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                             "Name segment can't start with %c", *s);
+              goto out;
+            }
+          dot_count++;
+        }
+      else if (G_UNLIKELY (!is_valid_name_character (*s, last_element)))
+        {
+          if (*s == '-')
+            g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                         "Only last name segment can contain -");
+          else
+            g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                         "Name can't contain %c", *s);
+          goto out;
+        }
+      s += 1;
+    }
+
+  if (G_UNLIKELY (dot_count < 2))
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Names must contain at least 2 periods");
+      goto out;
+    }
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+gboolean
+flatpak_has_name_prefix (const char *string,
+                         const char *name)
+{
+  const char *rest;
+
+  if (!g_str_has_prefix (string, name))
+    return FALSE;
+
+  rest = string + strlen (name);
+  return
+    *rest == 0 ||
+    *rest == '.' ||
+    !is_valid_name_character (*rest, FALSE);
+}
+
+static gboolean
+is_valid_initial_branch_character (gint c)
+{
+  return
+    (c >= '0' && c <= '9') ||
+    (c >= 'A' && c <= 'Z') ||
+    (c >= 'a' && c <= 'z') ||
+    (c == '_') ||
+    (c == '-');
+}
+
+static gboolean
+is_valid_branch_character (gint c)
+{
+  return
+    is_valid_initial_branch_character (c) ||
+    (c == '.');
+}
+
+/**
+ * flatpak_is_valid_branch:
+ * @string: The string to check
+ * @error: return location for an error
+ *
+ * Checks if @string is a valid branch name.
+ *
+ * Branch names must only contain the ASCII characters
+ * "[A-Z][a-z][0-9]_-.".
+ * Branch names may not begin with a digit.
+ * Branch names must contain at least one character.
+ *
+ * Returns: %TRUE if valid, %FALSE otherwise.
+ *
+ * Since: 2.26
+ */
+gboolean
+flatpak_is_valid_branch (const char *string,
+                         GError **error)
+{
+  guint len;
+  gboolean ret;
+  const gchar *s;
+  const gchar *end;
+
+  g_return_val_if_fail (string != NULL, FALSE);
+
+  ret = FALSE;
+
+  len = strlen (string);
+  if (G_UNLIKELY (len == 0))
+    {
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                           "Branch can't be empty");
+      goto out;
+    }
+
+  end = string + len;
+
+  s = string;
+  if (G_UNLIKELY (!is_valid_initial_branch_character (*s)))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Branch can't start with %c", *s);
+      goto out;
+    }
+
+  s += 1;
+  while (s != end)
+    {
+      if (G_UNLIKELY (!is_valid_branch_character (*s)))
+        {
+          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                       "Branch can't contain %c", *s);
+          goto out;
+        }
+      s += 1;
+    }
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+/* Dashes are only valid in the last part of the app id, so
+   we replace them with underscore so we can suffix the id */
+char *
+flatpak_make_valid_id_prefix (const char *orig_id)
+{
+  char *id, *t;
+
+  id = g_strdup (orig_id);
+  t = id;
+  while (*t != 0 && *t != '/')
+    {
+      if (*t == '-')
+        *t = '_';
+
+      t++;
+    }
+
+  return id;
+}
+
+gboolean
+flatpak_id_has_subref_suffix (const char *id)
+{
+  return
+    g_str_has_suffix (id, ".Locale") ||
+    g_str_has_suffix (id, ".Debug") ||
+    g_str_has_suffix (id, ".Sources");
+}
+
+char **
+flatpak_decompose_ref (const char *full_ref,
+                       GError    **error)
+{
+  g_auto(GStrv) parts = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  parts = g_strsplit (full_ref, "/", 0);
+  if (g_strv_length (parts) != 4)
+    {
+      flatpak_fail (error, "Wrong number of components in %s", full_ref);
+      return NULL;
+    }
+
+  if (strcmp (parts[0], "app") != 0 && strcmp (parts[0], "runtime") != 0)
+    {
+      flatpak_fail (error, "Not application or runtime");
+      return NULL;
+    }
+
+  if (!flatpak_is_valid_name (parts[1], &local_error))
+    {
+      flatpak_fail (error, "Invalid name %s: %s", parts[1], local_error->message);
+      return NULL;
+    }
+
+  if (strlen (parts[2]) == 0)
+    {
+      flatpak_fail (error, "Invalid arch %s", parts[2]);
+      return NULL;
+    }
+
+  if (!flatpak_is_valid_branch (parts[3], &local_error))
+    {
+      flatpak_fail (error, "Invalid branch %s: %s", parts[3], local_error->message);
+      return NULL;
+    }
+
+  return g_steal_pointer (&parts);
+}
+
+static const char *
+next_element (const char **partial_ref)
+{
+  const char *slash;
+  const char *end;
+  slash = (const char *)strchr (*partial_ref, '/');
+  if (slash != NULL)
+    {
+      end = slash;
+      *partial_ref = slash + 1;
+    }
+  else
+    {
+      end = *partial_ref + strlen (*partial_ref);
+      *partial_ref = end;
+    }
+
+  return end;
+}
+
+FlatpakKinds
+flatpak_kinds_from_bools (gboolean app, gboolean runtime)
+{
+  FlatpakKinds kinds = 0;
+
+  if (app)
+    kinds |= FLATPAK_KINDS_APP;
+
+  if (runtime)
+    kinds |= FLATPAK_KINDS_RUNTIME;
+
+  if (kinds == 0)
+    kinds = FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME;
+
+  return kinds;
+}
+
+static gboolean
+_flatpak_split_partial_ref_arg (const char   *partial_ref,
+                                gboolean      validate,
+                                FlatpakKinds  default_kinds,
+                                const char   *default_arch,
+                                const char   *default_branch,
+                                FlatpakKinds *out_kinds,
+                                char        **out_id,
+                                char        **out_arch,
+                                char        **out_branch,
+                                GError      **error)
+{
+  const char *id_start = NULL;
+  const char *id_end = NULL;
+  g_autofree char *id = NULL;
+  const char *arch_start = NULL;
+  const char *arch_end = NULL;
+  g_autofree char *arch = NULL;
+  const char *branch_start = NULL;
+  const char *branch_end = NULL;
+  g_autofree char *branch = NULL;
+  g_autoptr(GError) local_error = NULL;
+  FlatpakKinds kinds = 0;
+
+  if (g_str_has_prefix (partial_ref, "app/"))
+    {
+      partial_ref += strlen ("app/");
+      kinds = FLATPAK_KINDS_APP;
+    }
+  else if (g_str_has_prefix (partial_ref, "runtime/"))
+    {
+      partial_ref += strlen ("runtime/");
+      kinds = FLATPAK_KINDS_RUNTIME;
+    }
+  else
+    kinds = default_kinds;
+
+  id_start = partial_ref;
+  id_end = next_element (&partial_ref);
+  id = g_strndup (id_start, id_end - id_start);
+
+  if (validate && !flatpak_is_valid_name (id, &local_error))
+    return flatpak_fail (error, "Invalid id %s: %s", id, local_error->message);
+
+  arch_start = partial_ref;
+  arch_end = next_element (&partial_ref);
+  if (arch_end != arch_start)
+    arch = g_strndup (arch_start, arch_end - arch_start);
+  else
+    arch = g_strdup (default_arch);
+
+  branch_start = partial_ref;
+  branch_end = next_element (&partial_ref);
+  if (branch_end != branch_start)
+    branch = g_strndup (branch_start, branch_end - branch_start);
+  else
+    branch = g_strdup (default_branch);
+
+  if (validate && branch != NULL && !flatpak_is_valid_branch (branch, &local_error))
+    return flatpak_fail (error, "Invalid branch %s: %s", branch, local_error->message);
+
+  if (out_kinds)
+    *out_kinds = kinds;
+  if (out_id != NULL)
+    *out_id = g_steal_pointer (&id);
+  if (out_arch != NULL)
+    *out_arch = g_steal_pointer (&arch);
+  if (out_branch != NULL)
+    *out_branch = g_steal_pointer (&branch);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_split_partial_ref_arg (const char   *partial_ref,
+                               FlatpakKinds  default_kinds,
+                               const char   *default_arch,
+                               const char   *default_branch,
+                               FlatpakKinds *out_kinds,
+                               char        **out_id,
+                               char        **out_arch,
+                               char        **out_branch,
+                               GError      **error)
+{
+  return _flatpak_split_partial_ref_arg (partial_ref,
+                                         TRUE,
+                                         default_kinds,
+                                         default_arch,
+                                         default_branch,
+                                         out_kinds,
+                                         out_id,
+                                         out_arch,
+                                         out_branch,
+                                         error);
+}
+
+gboolean
+flatpak_split_partial_ref_arg_novalidate (const char   *partial_ref,
+                                          FlatpakKinds  default_kinds,
+                                          const char   *default_arch,
+                                          const char   *default_branch,
+                                          FlatpakKinds *out_kinds,
+                                          char        **out_id,
+                                          char        **out_arch,
+                                          char        **out_branch)
+{
+  return _flatpak_split_partial_ref_arg (partial_ref,
+                                         FALSE,
+                                         default_kinds,
+                                         default_arch,
+                                         default_branch,
+                                         out_kinds,
+                                         out_id,
+                                         out_arch,
+                                         out_branch,
+                                         NULL);
+}
+
+
+char *
+flatpak_compose_ref (gboolean    app,
+                     const char *name,
+                     const char *branch,
+                     const char *arch,
+                     GError    **error)
+{
+  g_autoptr(GError) local_error = NULL;
+
+  if (!flatpak_is_valid_name (name, &local_error))
+    {
+      flatpak_fail (error, "'%s' is not a valid name: %s", name, local_error->message);
+      return NULL;
+    }
+
+  if (branch && !flatpak_is_valid_branch (branch, &local_error))
+    {
+      flatpak_fail (error, "'%s' is not a valid branch name: %s", branch, local_error->message);
+      return NULL;
+    }
+
+  if (app)
+    return flatpak_build_app_ref (name, branch, arch);
+  else
+    return flatpak_build_runtime_ref (name, branch, arch);
+}
+
+char *
+flatpak_build_untyped_ref (const char *runtime,
+                           const char *branch,
+                           const char *arch)
+{
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  return g_build_filename (runtime, arch, branch, NULL);
+}
+
+char *
+flatpak_build_runtime_ref (const char *runtime,
+                           const char *branch,
+                           const char *arch)
+{
+  if (branch == NULL)
+    branch = "master";
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  return g_build_filename ("runtime", runtime, arch, branch, NULL);
+}
+
+char *
+flatpak_build_app_ref (const char *app,
+                       const char *branch,
+                       const char *arch)
+{
+  if (branch == NULL)
+    branch = "master";
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  return g_build_filename ("app", app, arch, branch, NULL);
+}
+
+char **
+flatpak_list_deployed_refs (const char   *type,
+                            const char   *name_prefix,
+                            const char   *branch,
+                            const char   *arch,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  gchar **ret = NULL;
+
+  g_autoptr(GPtrArray) names = NULL;
+  g_autoptr(GHashTable) hash = NULL;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  const char *key;
+  GHashTableIter iter;
+  int i;
+
+  hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  user_dir = flatpak_dir_get_user ();
+  system_dirs = flatpak_dir_get_system_list (cancellable, error);
+  if (system_dirs == NULL)
+    goto out;
+
+  if (!flatpak_dir_collect_deployed_refs (user_dir, type, name_prefix,
+                                          branch, arch, hash, cancellable,
+                                          error))
+    goto out;
+
+  for (i = 0; i < system_dirs->len; i++)
+    {
+      FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+      if (!flatpak_dir_collect_deployed_refs (system_dir, type, name_prefix,
+                                              branch, arch, hash, cancellable,
+                                              error))
+        goto out;
+    }
+
+  names = g_ptr_array_new ();
+  g_hash_table_iter_init (&iter, hash);
+  while (g_hash_table_iter_next (&iter, (gpointer *) &key, NULL))
+    g_ptr_array_add (names, g_strdup (key));
+
+  g_ptr_array_sort (names, flatpak_strcmp0_ptr);
+  g_ptr_array_add (names, NULL);
+
+  ret = (char **) g_ptr_array_free (names, FALSE);
+  names = NULL;
+
+out:
+  return ret;
+}
+
+char **
+flatpak_list_unmaintained_refs (const char   *name_prefix,
+                                const char   *branch,
+                                const char   *arch,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  gchar **ret = NULL;
+  g_autoptr(GPtrArray) names = NULL;
+  g_autoptr(GHashTable) hash = NULL;
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  const char *key;
+  GHashTableIter iter;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  int i;
+
+  hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  user_dir = flatpak_dir_get_user ();
+
+  if (!flatpak_dir_collect_unmaintained_refs (user_dir, name_prefix,
+                                              branch, arch, hash, cancellable,
+                                              error))
+    return NULL;
+
+  system_dirs = flatpak_dir_get_system_list (cancellable, error);
+  if (system_dirs == NULL)
+    return NULL;
+
+  for (i = 0; i < system_dirs->len; i++)
+    {
+      FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+
+      if (!flatpak_dir_collect_unmaintained_refs (system_dir, name_prefix,
+                                                  branch, arch, hash, cancellable,
+                                                  error))
+        return NULL;
+    }
+
+  names = g_ptr_array_new ();
+  g_hash_table_iter_init (&iter, hash);
+  while (g_hash_table_iter_next (&iter, (gpointer *) &key, NULL))
+    g_ptr_array_add (names, g_strdup (key));
+
+  g_ptr_array_sort (names, flatpak_strcmp0_ptr);
+  g_ptr_array_add (names, NULL);
+
+  ret = (char **) g_ptr_array_free (names, FALSE);
+  names = NULL;
+
+  return ret;
+}
+
+GFile *
+flatpak_find_deploy_dir_for_ref (const char   *ref,
+                                 FlatpakDir **dir_out,
+                                 GCancellable *cancellable,
+                                 GError      **error)
+{
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  FlatpakDir *dir = NULL;
+  g_autoptr(GFile) deploy = NULL;
+
+  user_dir = flatpak_dir_get_user ();
+  system_dirs = flatpak_dir_get_system_list (cancellable, error);
+  if (system_dirs == NULL)
+    return NULL;
+
+  dir = user_dir;
+  deploy = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable);
+  if (deploy == NULL)
+    {
+      int i;
+      for (i = 0; deploy == NULL && i < system_dirs->len; i++)
+        {
+          dir = g_ptr_array_index (system_dirs, i);
+          deploy = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable);
+          if (deploy != NULL)
+            break;
+        }
+    }
+
+  if (deploy == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("%s not installed"), ref);
+      return NULL;
+    }
+
+  if (dir_out)
+    *dir_out = g_object_ref (dir);
+  return g_steal_pointer (&deploy);
+}
+
+GFile *
+flatpak_find_files_dir_for_ref (const char   *ref,
+                                GCancellable *cancellable,
+                                GError      **error)
+{
+  g_autoptr(GFile) deploy = NULL;
+
+  deploy = flatpak_find_deploy_dir_for_ref (ref, NULL, cancellable, error);
+  if (deploy == NULL)
+    return NULL;
+
+  return g_file_get_child (deploy, "files");
+}
+
+GFile *
+flatpak_find_unmaintained_extension_dir_if_exists (const char   *name,
+                                                   const char   *arch,
+                                                   const char   *branch,
+                                                   GCancellable *cancellable)
+{
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(GFile) extension_dir = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  user_dir = flatpak_dir_get_user ();
+
+  extension_dir = flatpak_dir_get_unmaintained_extension_dir_if_exists (user_dir, name, arch, branch, cancellable);
+  if (extension_dir == NULL)
+    {
+      g_autoptr(GPtrArray) system_dirs = NULL;
+      int i;
+
+      system_dirs = flatpak_dir_get_system_list (cancellable, &local_error);
+      if (system_dirs == NULL)
+        {
+          g_warning ("Could not get the system installations: %s", local_error->message);
+          return NULL;
+        }
+
+      for (i = 0; i < system_dirs->len; i++)
+        {
+          FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+          extension_dir = flatpak_dir_get_unmaintained_extension_dir_if_exists (system_dir, name, arch, branch, cancellable);
+          if (extension_dir != NULL)
+            break;
+        }
+    }
+
+  if (extension_dir == NULL)
+    return NULL;
+
+  return g_steal_pointer(&extension_dir);
+}
+
+char *
+flatpak_find_current_ref (const char *app_id,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_autofree char *current_ref = NULL;
+  g_autoptr(FlatpakDir) user_dir = flatpak_dir_get_user ();
+  int i;
+
+  current_ref = flatpak_dir_current_ref (user_dir, app_id, NULL);
+  if (current_ref == NULL)
+    {
+      g_autoptr(GPtrArray) system_dirs = NULL;
+
+      system_dirs = flatpak_dir_get_system_list (cancellable, error);
+      if (system_dirs == NULL)
+        return FALSE;
+
+      for (i = 0; i < system_dirs->len; i++)
+        {
+          FlatpakDir *dir = g_ptr_array_index (system_dirs, i);
+          current_ref = flatpak_dir_current_ref (dir, app_id, cancellable);
+          if (current_ref != NULL)
+            break;
+        }
+    }
+
+  if (current_ref)
+    return g_steal_pointer (&current_ref);
+
+  g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+               _("%s not installed"), app_id);
+  return NULL;
+}
+
+FlatpakDeploy *
+flatpak_find_deploy_for_ref (const char   *ref,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(FlatpakDir) user_dir = NULL;
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  g_autoptr(FlatpakDeploy) deploy = NULL;
+  g_autoptr(GError) my_error = NULL;
+
+  user_dir = flatpak_dir_get_user ();
+  flatpak_log_dir_access (user_dir);
+  system_dirs = flatpak_dir_get_system_list (cancellable, error);
+  if (system_dirs == NULL)
+    return NULL;
+
+  deploy = flatpak_dir_load_deployed (user_dir, ref, NULL, cancellable, &my_error);
+  if (deploy == NULL &&
+      system_dirs->len > 0 &&
+      g_error_matches (my_error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
+    {
+      int i;
+
+      for (i = 0; deploy == NULL && i < system_dirs->len; i++)
+        {
+          FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i);
+
+          flatpak_log_dir_access (system_dir);
+          g_clear_error (&my_error);
+          deploy = flatpak_dir_load_deployed (system_dir, ref, NULL, cancellable, &my_error);
+        }
+    }
+  if (deploy == NULL)
+    g_propagate_error (error, g_steal_pointer (&my_error));
+
+  return g_steal_pointer (&deploy);
+}
+
+
+static gboolean
+overlay_symlink_tree_dir (int           source_parent_fd,
+                          const char   *source_name,
+                          const char   *source_symlink_prefix,
+                          int           destination_parent_fd,
+                          const char   *destination_name,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  gboolean ret = FALSE;
+  int res;
+
+  g_auto(GLnxDirFdIterator) source_iter = { 0 };
+  glnx_autofd int destination_dfd = -1;
+  struct dirent *dent;
+
+  if (!glnx_dirfd_iterator_init_at (source_parent_fd, source_name, FALSE, &source_iter, error))
+    goto out;
+
+  do
+    res = mkdirat (destination_parent_fd, destination_name, 0777);
+  while (G_UNLIKELY (res == -1 && errno == EINTR));
+  if (res == -1)
+    {
+      if (errno != EEXIST)
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
+    }
+
+  if (!glnx_opendirat (destination_parent_fd, destination_name, TRUE,
+                       &destination_dfd, error))
+    goto out;
+
+  while (TRUE)
+    {
+
+      if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&source_iter, &dent, cancellable, error))
+        goto out;
+
+      if (dent == NULL)
+        break;
+
+      if (dent->d_type == DT_DIR)
+        {
+          g_autofree gchar *target = g_build_filename ("..", source_symlink_prefix, dent->d_name, NULL);
+          if (!overlay_symlink_tree_dir (source_iter.fd, dent->d_name, target, destination_dfd, dent->d_name,
+                                         cancellable, error))
+            goto out;
+        }
+      else
+        {
+          g_autofree gchar *target = g_build_filename (source_symlink_prefix, dent->d_name, NULL);
+
+          if (unlinkat (destination_dfd, dent->d_name, 0) != 0 && errno != ENOENT)
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+
+          if (symlinkat (target, destination_dfd, dent->d_name) != 0)
+            {
+              glnx_set_error_from_errno (error);
+              goto out;
+            }
+        }
+    }
+
+  ret = TRUE;
+out:
+
+  return ret;
+}
+
+gboolean
+flatpak_overlay_symlink_tree (GFile        *source,
+                              GFile        *destination,
+                              const char   *symlink_prefix,
+                              GCancellable *cancellable,
+                              GError      **error)
+{
+  gboolean ret = FALSE;
+
+  if (!flatpak_mkdir_p (destination, cancellable, error))
+    goto out;
+
+  /* The fds are closed by this call */
+  if (!overlay_symlink_tree_dir (AT_FDCWD, flatpak_file_get_path_cached (source),
+                                 symlink_prefix,
+                                 AT_FDCWD, flatpak_file_get_path_cached (destination),
+                                 cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+static gboolean
+remove_dangling_symlinks (int           parent_fd,
+                          const char   *name,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  gboolean ret = FALSE;
+  struct dirent *dent;
+  g_auto(GLnxDirFdIterator) iter = { 0 };
+
+  if (!glnx_dirfd_iterator_init_at (parent_fd, name, FALSE, &iter, error))
+    goto out;
+
+  while (TRUE)
+    {
+      if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&iter, &dent, cancellable, error))
+        goto out;
+
+      if (dent == NULL)
+        break;
+
+      if (dent->d_type == DT_DIR)
+        {
+          if (!remove_dangling_symlinks (iter.fd, dent->d_name, cancellable, error))
+            goto out;
+        }
+      else if (dent->d_type == DT_LNK)
+        {
+          struct stat stbuf;
+          if (fstatat (iter.fd, dent->d_name, &stbuf, 0) != 0 && errno == ENOENT)
+            {
+              if (unlinkat (iter.fd, dent->d_name, 0) != 0)
+                {
+                  glnx_set_error_from_errno (error);
+                  goto out;
+                }
+            }
+        }
+    }
+
+  ret = TRUE;
+out:
+
+  return ret;
+}
+
+gboolean
+flatpak_remove_dangling_symlinks (GFile        *dir,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  gboolean ret = FALSE;
+
+  /* The fd is closed by this call */
+  if (!remove_dangling_symlinks (AT_FDCWD, flatpak_file_get_path_cached (dir),
+                                 cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
+/* This atomically replaces a symlink with a new value, removing the
+ * existing symlink target, if any. This is atomic in the sense that
+ * we're guaranteed to remove any existing symlink target (once),
+ * independent of how many processes do the same operation in
+ * parallele. However, it is still possible that we remove the old and
+ * then fail to create the new symlink for some reason, ending up with
+ * neither the old or the new target. That is fine if the reason for
+ * the symlink is keeping a cache though.
+ */
+gboolean
+flatpak_switch_symlink_and_remove (const char *symlink_path,
+                                   const char *target,
+                                   GError **error)
+{
+  g_autofree char *symlink_dir = g_path_get_dirname (symlink_path);
+  int try;
+
+  for (try = 0; try < 100; try++)
+    {
+      g_autofree char *tmp_path = NULL;
+      int fd;
+
+      /* Try to atomically create the symlink */
+      if (TEMP_FAILURE_RETRY (symlink (target, symlink_path)) == 0)
+        return TRUE;
+
+      if (errno != EEXIST)
+        {
+          /* Unexpected failure, bail */
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+
+      /* The symlink existed, move it to a temporary name atomically, and remove target
+         if that succeeded. */
+      tmp_path = g_build_filename (symlink_dir, ".switched-symlink-XXXXXX", NULL);
+
+      fd = g_mkstemp_full (tmp_path, O_RDWR, 0644);
+      if (fd == -1)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+      close (fd);
+
+      if (TEMP_FAILURE_RETRY (rename (symlink_path, tmp_path)) == 0)
+        {
+          /* The move succeeded, now we can remove the old target */
+          g_autofree char *old_target = flatpak_resolve_link (tmp_path, error);
+          if (old_target == NULL)
+            return FALSE;
+          unlink (old_target);
+        }
+      else if (errno != ENOENT)
+        {
+          glnx_set_error_from_errno (error);
+          unlink (tmp_path);
+          return -1;
+        }
+      unlink (tmp_path);
+
+      /* An old target was removed, try again */
+    }
+
+  return flatpak_fail (error, "flatpak_switch_symlink_and_remove looped too many times");
+}
+
+
+/* Based on g_mkstemp from glib */
+
+gint
+flatpak_mkstempat (int    dir_fd,
+                   gchar *tmpl,
+                   int    flags,
+                   int    mode)
+{
+  char *XXXXXX;
+  int count, fd;
+  static const char letters[] =
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+  static const int NLETTERS = sizeof (letters) - 1;
+  glong value;
+  GTimeVal tv;
+  static int counter = 0;
+
+  g_return_val_if_fail (tmpl != NULL, -1);
+
+  /* find the last occurrence of "XXXXXX" */
+  XXXXXX = g_strrstr (tmpl, "XXXXXX");
+
+  if (!XXXXXX || strncmp (XXXXXX, "XXXXXX", 6))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  /* Get some more or less random data.  */
+  g_get_current_time (&tv);
+  value = (tv.tv_usec ^ tv.tv_sec) + counter++;
+
+  for (count = 0; count < 100; value += 7777, ++count)
+    {
+      glong v = value;
+
+      /* Fill in the random bits.  */
+      XXXXXX[0] = letters[v % NLETTERS];
+      v /= NLETTERS;
+      XXXXXX[1] = letters[v % NLETTERS];
+      v /= NLETTERS;
+      XXXXXX[2] = letters[v % NLETTERS];
+      v /= NLETTERS;
+      XXXXXX[3] = letters[v % NLETTERS];
+      v /= NLETTERS;
+      XXXXXX[4] = letters[v % NLETTERS];
+      v /= NLETTERS;
+      XXXXXX[5] = letters[v % NLETTERS];
+
+      fd = openat (dir_fd, tmpl, flags | O_CREAT | O_EXCL, mode);
+
+      if (fd >= 0)
+        return fd;
+      else if (errno != EEXIST)
+        /* Any other error will apply also to other names we might
+         *  try, and there are 2^32 or so of them, so give up now.
+         */
+        return -1;
+    }
+
+  /* We got out of the loop because we ran out of combinations to try.  */
+  errno = EEXIST;
+  return -1;
+}
+
+
+static GHashTable *app_ids;
+
+typedef struct
+{
+  char     *name;
+  GKeyFile *app_info;
+  gboolean  exited;
+  GList    *pending;
+} AppInfo;
+
+static void
+app_info_free (AppInfo *info)
+{
+  g_free (info->name);
+  g_key_file_unref (info->app_info);
+  g_free (info);
+}
+
+static void
+ensure_app_ids (void)
+{
+  if (app_ids == NULL)
+    app_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                     NULL, (GDestroyNotify) app_info_free);
+}
+
+/* Returns NULL on failure, keyfile with name "" if not sandboxed, and full app-info otherwise */
+static GKeyFile *
+parse_app_id_from_fileinfo (int pid)
+{
+  g_autofree char *root_path = NULL;
+  glnx_autofd int root_fd = -1;
+  glnx_autofd int info_fd = -1;
+  struct stat stat_buf;
+  g_autoptr(GError) local_error = NULL;
+  g_autoptr(GMappedFile) mapped = NULL;
+  g_autoptr(GKeyFile) metadata = NULL;
+
+  root_path = g_strdup_printf ("/proc/%u/root", pid);
+  root_fd = openat (AT_FDCWD, root_path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
+  if (root_fd == -1)
+    {
+      /* Not able to open the root dir shouldn't happen. Probably the app died and
+         *we're failing due to /proc/$pid not existing. In that case fail instead
+         of treating this as privileged. */
+      g_debug ("Unable to open %s", root_path);
+      return NULL;
+    }
+
+  metadata = g_key_file_new ();
+
+  info_fd = openat (root_fd, ".flatpak-info", O_RDONLY | O_CLOEXEC | O_NOCTTY);
+  if (info_fd == -1)
+    {
+      if (errno == ENOENT)
+        {
+          /* No file => on the host */
+          g_key_file_set_string (metadata, FLATPAK_METADATA_GROUP_APPLICATION,
+                                 FLATPAK_METADATA_KEY_NAME, "");
+          return g_steal_pointer (&metadata);
+        }
+
+      return NULL; /* Some weird error => failure */
+    }
+
+  if (fstat (info_fd, &stat_buf) != 0 || !S_ISREG (stat_buf.st_mode))
+    return NULL; /* Some weird fd => failure */
+
+  mapped = g_mapped_file_new_from_fd  (info_fd, FALSE, &local_error);
+  if (mapped == NULL)
+    {
+      g_warning ("Can't map .flatpak-info file: %s", local_error->message);
+      return NULL;
+    }
+
+  if (!g_key_file_load_from_data (metadata,
+                                  g_mapped_file_get_contents (mapped),
+                                  g_mapped_file_get_length (mapped),
+                                  G_KEY_FILE_NONE, &local_error))
+    {
+      g_warning ("Can't load .flatpak-info file: %s", local_error->message);
+      return NULL;
+    }
+
+  return g_steal_pointer (&metadata);
+}
+
+static void
+got_credentials_cb (GObject      *source_object,
+                    GAsyncResult *res,
+                    gpointer      user_data)
+{
+  AppInfo *info = user_data;
+
+  g_autoptr(GDBusMessage) reply = NULL;
+  g_autoptr(GError) error = NULL;
+  GList *l;
+
+  reply = g_dbus_connection_send_message_with_reply_finish (G_DBUS_CONNECTION (source_object),
+                                                            res, &error);
+
+  if (!info->exited && reply != NULL)
+    {
+      GVariant *body = g_dbus_message_get_body (reply);
+      guint32 pid;
+
+      g_variant_get (body, "(u)", &pid);
+
+      info->app_info = parse_app_id_from_fileinfo (pid);
+    }
+
+  for (l = info->pending; l != NULL; l = l->next)
+    {
+      GTask *task = l->data;
+
+      if (info->app_info == NULL)
+        g_task_return_new_error (task, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
+                                 "Can't find app id");
+      else
+        g_task_return_pointer (task, g_key_file_ref (info->app_info), (GDestroyNotify)g_key_file_unref);
+    }
+
+  g_list_free_full (info->pending, g_object_unref);
+  info->pending = NULL;
+
+  if (info->app_info == NULL)
+    g_hash_table_remove (app_ids, info->name);
+}
+
+void
+flatpak_invocation_lookup_app_info (GDBusMethodInvocation *invocation,
+                                    GCancellable          *cancellable,
+                                    GAsyncReadyCallback    callback,
+                                    gpointer               user_data)
+{
+  GDBusConnection *connection = g_dbus_method_invocation_get_connection (invocation);
+  const gchar *sender = g_dbus_method_invocation_get_sender (invocation);
+
+  g_autoptr(GTask) task = NULL;
+  AppInfo *info;
+
+  task = g_task_new (invocation, cancellable, callback, user_data);
+
+  ensure_app_ids ();
+
+  info = g_hash_table_lookup (app_ids, sender);
+
+  if (info == NULL)
+    {
+      info = g_new0 (AppInfo, 1);
+      info->name = g_strdup (sender);
+      g_hash_table_insert (app_ids, info->name, info);
+    }
+
+  if (info->app_info)
+    {
+      g_task_return_pointer (task, g_key_file_ref (info->app_info), (GDestroyNotify)g_key_file_unref);
+    }
+  else
+    {
+      if (info->pending == NULL)
+        {
+          g_autoptr(GDBusMessage) msg = g_dbus_message_new_method_call ("org.freedesktop.DBus",
+                                                                        "/org/freedesktop/DBus",
+                                                                        "org.freedesktop.DBus",
+                                                                        "GetConnectionUnixProcessID");
+          g_dbus_message_set_body (msg, g_variant_new ("(s)", sender));
+
+          g_dbus_connection_send_message_with_reply (connection, msg,
+                                                     G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+                                                     30000,
+                                                     NULL,
+                                                     cancellable,
+                                                     got_credentials_cb,
+                                                     info);
+        }
+
+      info->pending = g_list_prepend (info->pending, g_object_ref (task));
+    }
+}
+
+GKeyFile *
+flatpak_invocation_lookup_app_info_finish (GDBusMethodInvocation *invocation,
+                                           GAsyncResult          *result,
+                                           GError               **error)
+{
+  return g_task_propagate_pointer (G_TASK (result), error);
+}
+
+static void
+name_owner_changed (GDBusConnection *connection,
+                    const gchar     *sender_name,
+                    const gchar     *object_path,
+                    const gchar     *interface_name,
+                    const gchar     *signal_name,
+                    GVariant        *parameters,
+                    gpointer         user_data)
+{
+  const char *name, *from, *to;
+
+  g_variant_get (parameters, "(sss)", &name, &from, &to);
+
+  ensure_app_ids ();
+
+  if (name[0] == ':' &&
+      strcmp (name, from) == 0 &&
+      strcmp (to, "") == 0)
+    {
+      AppInfo *info = g_hash_table_lookup (app_ids, name);
+
+      if (info != NULL)
+        {
+          info->exited = TRUE;
+          if (info->pending == NULL)
+            g_hash_table_remove (app_ids, name);
+        }
+    }
+}
+
+void
+flatpak_connection_track_name_owners (GDBusConnection *connection)
+{
+  g_dbus_connection_signal_subscribe (connection,
+                                      "org.freedesktop.DBus",
+                                      "org.freedesktop.DBus",
+                                      "NameOwnerChanged",
+                                      "/org/freedesktop/DBus",
+                                      NULL,
+                                      G_DBUS_SIGNAL_FLAGS_NONE,
+                                      name_owner_changed,
+                                      NULL, NULL);
+}
+
+typedef struct
+{
+  GError    *error;
+  GError    *splice_error;
+  GMainLoop *loop;
+  int        refs;
+} SpawnData;
+
+static void
+spawn_data_exit (SpawnData *data)
+{
+  data->refs--;
+  if (data->refs == 0)
+    g_main_loop_quit (data->loop);
+}
+
+static void
+spawn_output_spliced_cb (GObject      *obj,
+                         GAsyncResult *result,
+                         gpointer      user_data)
+{
+  SpawnData *data = user_data;
+
+  g_output_stream_splice_finish (G_OUTPUT_STREAM (obj), result, &data->splice_error);
+  spawn_data_exit (data);
+}
+
+static void
+spawn_exit_cb (GObject      *obj,
+               GAsyncResult *result,
+               gpointer      user_data)
+{
+  SpawnData *data = user_data;
+
+  g_subprocess_wait_check_finish (G_SUBPROCESS (obj), result, &data->error);
+  spawn_data_exit (data);
+}
+
+static gboolean
+needs_quoting (const char *arg)
+{
+  while (*arg != 0)
+    {
+      char c = *arg;
+      if (!g_ascii_isalnum (c) &&
+          !(c == '-' || c == '/' || c == '~' ||
+            c == ':' || c == '.' || c == '_' ||
+            c == '='))
+        return TRUE;
+      arg++;
+    }
+  return FALSE;
+}
+
+char *
+flatpak_quote_argv (const char *argv[])
+{
+  GString *res = g_string_new ("");
+  int i;
+
+  for (i = 0; argv[i] != NULL; i++)
+    {
+      if (i != 0)
+        g_string_append_c (res, ' ');
+
+      if (needs_quoting (argv[i]))
+        {
+          g_autofree char *quoted = g_shell_quote (argv[i]);
+          g_string_append (res, quoted);
+        }
+      else
+        g_string_append (res, argv[i]);
+    }
+
+  return g_string_free (res, FALSE);
+}
+
+/* This is useful, because it handles escaped characters in uris, and ? arguments at the end of the uri */
+gboolean
+flatpak_file_arg_has_suffix (const char *arg, const char *suffix)
+{
+  g_autoptr(GFile) file = g_file_new_for_commandline_arg (arg);
+  g_autofree char *basename = g_file_get_basename (file);
+
+  return g_str_has_suffix (basename, suffix);
+}
+
+gboolean
+flatpak_spawn (GFile       *dir,
+               char       **output,
+               GError     **error,
+               const gchar *argv0,
+               va_list      ap)
+{
+  GPtrArray *args;
+  const gchar *arg;
+  gboolean res;
+
+  args = g_ptr_array_new ();
+  g_ptr_array_add (args, (gchar *) argv0);
+  while ((arg = va_arg (ap, const gchar *)))
+    g_ptr_array_add (args, (gchar *) arg);
+  g_ptr_array_add (args, NULL);
+
+  res = flatpak_spawnv (dir, output, 0, error, (const gchar * const *) args->pdata);
+
+  g_ptr_array_free (args, TRUE);
+
+  return res;
+}
+
+gboolean
+flatpak_spawnv (GFile                *dir,
+                char                **output,
+                GSubprocessFlags      flags,
+                GError              **error,
+                const gchar * const  *argv)
+{
+  g_autoptr(GSubprocessLauncher) launcher = NULL;
+  g_autoptr(GSubprocess) subp = NULL;
+  GInputStream *in;
+  g_autoptr(GOutputStream) out = NULL;
+  g_autoptr(GMainLoop) loop = NULL;
+  SpawnData data = {0};
+  g_autofree gchar *commandline = NULL;
+
+  launcher = g_subprocess_launcher_new (0);
+
+  if (output)
+    flags |= G_SUBPROCESS_FLAGS_STDOUT_PIPE;
+
+  g_subprocess_launcher_set_flags (launcher, flags);
+
+  if (dir)
+    {
+      g_autofree char *path = g_file_get_path (dir);
+      g_subprocess_launcher_set_cwd (launcher, path);
+    }
+
+  commandline = flatpak_quote_argv ((const char **)argv);
+  g_debug ("Running: %s", commandline);
+
+  subp = g_subprocess_launcher_spawnv (launcher, argv, error);
+
+  if (subp == NULL)
+    return FALSE;
+
+  loop = g_main_loop_new (NULL, FALSE);
+
+  data.loop = loop;
+  data.refs = 1;
+
+  if (output)
+    {
+      data.refs++;
+      in = g_subprocess_get_stdout_pipe (subp);
+      out = g_memory_output_stream_new_resizable ();
+      g_output_stream_splice_async (out,
+                                    in,
+                                    G_OUTPUT_STREAM_SPLICE_NONE,
+                                    0,
+                                    NULL,
+                                    spawn_output_spliced_cb,
+                                    &data);
+    }
+
+  g_subprocess_wait_async (subp, NULL, spawn_exit_cb, &data);
+
+  g_main_loop_run (loop);
+
+  if (data.error)
+    {
+      g_propagate_error (error, data.error);
+      g_clear_error (&data.splice_error);
+      return FALSE;
+    }
+
+  if (out)
+    {
+      if (data.splice_error)
+        {
+          g_propagate_error (error, data.splice_error);
+          return FALSE;
+        }
+
+      /* Null terminate */
+      g_output_stream_write (out, "\0", 1, NULL, NULL);
+      g_output_stream_close (out, NULL, NULL);
+      *output = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (out));
+    }
+
+  return TRUE;
+}
+
+GFile *
+flatpak_build_file_va (GFile *base,
+                       va_list args)
+{
+  g_autoptr(GFile) res = g_object_ref (base);
+  const gchar *arg;
+
+  while ((arg = va_arg (args, const gchar *)))
+    {
+      GFile *child = g_file_resolve_relative_path (res, arg);
+      g_set_object (&res, child);
+    }
+
+  return g_steal_pointer (&res);
+}
+
+GFile *
+flatpak_build_file (GFile *base, ...)
+{
+  GFile *res;
+  va_list args;
+
+  va_start (args, base);
+  res = flatpak_build_file_va (base, args);
+  va_end (args);
+
+  return res;
+}
+
+const char *
+flatpak_file_get_path_cached (GFile *file)
+{
+  const char *path;
+  static GQuark _file_path_quark = 0;
+
+  if (G_UNLIKELY (_file_path_quark == 0))
+    _file_path_quark = g_quark_from_static_string ("flatpak-file-path");
+
+  do
+    {
+      path = g_object_get_qdata ((GObject*)file, _file_path_quark);
+      if (path == NULL)
+        {
+          g_autofree char *new_path = NULL;
+          new_path = g_file_get_path (file);
+          if (new_path == NULL)
+            return NULL;
+
+          if (g_object_replace_qdata ((GObject*)file, _file_path_quark,
+                                      NULL, new_path, g_free, NULL))
+            path = g_steal_pointer (&new_path);
+        }
+    }
+  while (path == NULL);
+
+  return path;
+}
+
+gboolean
+flatpak_openat_noatime (int            dfd,
+                        const char    *name,
+                        int           *ret_fd,
+                        GCancellable  *cancellable,
+                        GError       **error)
+{
+  int fd;
+  int flags = O_RDONLY | O_CLOEXEC;
+
+#ifdef O_NOATIME
+  do
+    fd = openat (dfd, name, flags | O_NOATIME, 0);
+  while (G_UNLIKELY (fd == -1 && errno == EINTR));
+  /* Only the owner or superuser may use O_NOATIME; so we may get
+   * EPERM.  EINVAL may happen if the kernel is really old...
+   */
+  if (fd == -1 && (errno == EPERM || errno == EINVAL))
+#endif
+    do
+      fd = openat (dfd, name, flags, 0);
+    while (G_UNLIKELY (fd == -1 && errno == EINTR));
+
+  if (fd == -1)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+  else
+    {
+      *ret_fd = fd;
+      return TRUE;
+    }
+}
+
+gboolean
+flatpak_cp_a (GFile         *src,
+              GFile         *dest,
+              FlatpakCpFlags flags,
+              GCancellable  *cancellable,
+              GError       **error)
+{
+  gboolean ret = FALSE;
+  GFileEnumerator *enumerator = NULL;
+  GFileInfo *src_info = NULL;
+  GFile *dest_child = NULL;
+  int dest_dfd = -1;
+  gboolean merge = (flags & FLATPAK_CP_FLAGS_MERGE) != 0;
+  gboolean no_chown = (flags & FLATPAK_CP_FLAGS_NO_CHOWN) != 0;
+  gboolean move = (flags & FLATPAK_CP_FLAGS_MOVE) != 0;
+  g_autoptr(GFileInfo) child_info = NULL;
+  GError *temp_error = NULL;
+  int r;
+
+  enumerator = g_file_enumerate_children (src, "standard::type,standard::name,unix::uid,unix::gid,unix::mode",
+                                          G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                          cancellable, error);
+  if (!enumerator)
+    goto out;
+
+  src_info = g_file_query_info (src, "standard::name,unix::mode,unix::uid,unix::gid," \
+                                     "time::modified,time::modified-usec,time::access,time::access-usec",
+                                G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                cancellable, error);
+  if (!src_info)
+    goto out;
+
+  do
+    r = mkdir (flatpak_file_get_path_cached (dest), 0755);
+  while (G_UNLIKELY (r == -1 && errno == EINTR));
+  if (r == -1 &&
+      (!merge || errno != EEXIST))
+    {
+      glnx_set_error_from_errno (error);
+      goto out;
+    }
+
+  if (!glnx_opendirat (AT_FDCWD, flatpak_file_get_path_cached (dest), TRUE,
+                       &dest_dfd, error))
+    goto out;
+
+  if (!no_chown)
+    {
+      do
+        r = fchown (dest_dfd,
+                    g_file_info_get_attribute_uint32 (src_info, "unix::uid"),
+                    g_file_info_get_attribute_uint32 (src_info, "unix::gid"));
+      while (G_UNLIKELY (r == -1 && errno == EINTR));
+      if (r == -1)
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
+    }
+
+  do
+    r = fchmod (dest_dfd, g_file_info_get_attribute_uint32 (src_info, "unix::mode"));
+  while (G_UNLIKELY (r == -1 && errno == EINTR));
+
+  if (dest_dfd != -1)
+    {
+      (void) close (dest_dfd);
+      dest_dfd = -1;
+    }
+
+  while ((child_info = g_file_enumerator_next_file (enumerator, cancellable, &temp_error)))
+    {
+      const char *name = g_file_info_get_name (child_info);
+      g_autoptr(GFile) src_child = g_file_get_child (src, name);
+
+      if (dest_child)
+        g_object_unref (dest_child);
+      dest_child = g_file_get_child (dest, name);
+
+      if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY)
+        {
+          if (!flatpak_cp_a (src_child, dest_child, flags,
+                             cancellable, error))
+            goto out;
+        }
+      else
+        {
+          (void) unlink (flatpak_file_get_path_cached (dest_child));
+          GFileCopyFlags copyflags = G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS;
+          if (!no_chown)
+            copyflags |= G_FILE_COPY_ALL_METADATA;
+          if (move)
+            {
+              if (!g_file_move (src_child, dest_child, copyflags,
+                                cancellable, NULL, NULL, error))
+                goto out;
+            }
+          else
+            {
+              if (!g_file_copy (src_child, dest_child, copyflags,
+                                cancellable, NULL, NULL, error))
+                goto out;
+            }
+        }
+
+      g_clear_object (&child_info);
+    }
+
+  if (temp_error != NULL)
+    {
+      g_propagate_error (error, temp_error);
+      goto out;
+    }
+
+  if (move &&
+      !g_file_delete (src, NULL, error))
+    goto out;
+
+  ret = TRUE;
+out:
+  if (dest_dfd != -1)
+    (void) close (dest_dfd);
+  g_clear_object (&src_info);
+  g_clear_object (&enumerator);
+  g_clear_object (&dest_child);
+  return ret;
+}
+
+gboolean
+flatpak_zero_mtime (int parent_dfd,
+                    const char *rel_path,
+                    GCancellable  *cancellable,
+                    GError       **error)
+{
+  struct stat stbuf;
+
+  if (TEMP_FAILURE_RETRY (fstatat (parent_dfd, rel_path, &stbuf, AT_SYMLINK_NOFOLLOW)) != 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  if (S_ISDIR (stbuf.st_mode))
+    {
+      g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
+      gboolean inited;
+
+      inited = glnx_dirfd_iterator_init_at (parent_dfd, rel_path, FALSE, &dfd_iter, NULL);
+
+      while (inited)
+        {
+          struct dirent *dent;
+
+          if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, NULL, NULL) || dent == NULL)
+            break;
+
+          if (!flatpak_zero_mtime (dfd_iter.fd, dent->d_name,
+                                   cancellable, error))
+            return FALSE;
+        }
+
+      /* Update stbuf */
+      if (TEMP_FAILURE_RETRY (fstat (dfd_iter.fd, &stbuf)) != 0)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+    }
+
+  /* OSTree checks out to mtime 0, so we do the same */
+  if (stbuf.st_mtime != OSTREE_TIMESTAMP)
+    {
+      const struct timespec times[2] = { { 0, UTIME_OMIT }, { OSTREE_TIMESTAMP, } };
+
+      if (TEMP_FAILURE_RETRY (utimensat (parent_dfd, rel_path, times, AT_SYMLINK_NOFOLLOW)) != 0)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+/* Make a directory, and its parent. Don't error if it already exists.
+ * If you want a failure mode with EEXIST, use g_file_make_directory_with_parents. */
+gboolean
+flatpak_mkdir_p (GFile         *dir,
+                 GCancellable  *cancellable,
+                 GError       **error)
+{
+  return glnx_shutil_mkdir_p_at (AT_FDCWD,
+                                 flatpak_file_get_path_cached (dir),
+                                 0777,
+                                 cancellable,
+                                 error);
+}
+
+gboolean
+flatpak_rm_rf (GFile         *dir,
+               GCancellable  *cancellable,
+               GError       **error)
+{
+  return glnx_shutil_rm_rf_at (AT_FDCWD,
+                               flatpak_file_get_path_cached (dir),
+                               cancellable, error);
+}
+
+char *
+flatpak_readlink (const char *path,
+                  GError **error)
+{
+  char buf[PATH_MAX + 1];
+  ssize_t symlink_size;
+
+  symlink_size = readlink (path, buf, sizeof (buf) - 1);
+  if (symlink_size < 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  buf[symlink_size] = 0;
+  return g_strdup (buf);
+}
+
+char *
+flatpak_resolve_link (const char *path,
+                      GError **error)
+{
+  g_autofree char *link = flatpak_readlink (path, error);
+  g_autofree char *dirname = NULL;
+
+  if (link == NULL)
+    return NULL;
+
+  if (g_path_is_absolute (link))
+    return g_steal_pointer (&link);
+
+  dirname = g_path_get_dirname (path);
+  return g_build_filename (dirname, link, NULL);
+}
+
+char *
+flatpak_canonicalize_filename (const char *path)
+{
+  g_autoptr(GFile) file = g_file_new_for_path (path);
+  return g_file_get_path (file);
+}
+
+gboolean flatpak_file_rename (GFile *from,
+                              GFile *to,
+                              GCancellable  *cancellable,
+                              GError       **error)
+{
+  if (g_cancellable_set_error_if_cancelled (cancellable, error))
+    return FALSE;
+
+  if (rename (flatpak_file_get_path_cached (from),
+              flatpak_file_get_path_cached (to)) < 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_open_in_tmpdir_at (int                tmpdir_fd,
+                           int                mode,
+                           char              *tmpl,
+                           GOutputStream    **out_stream,
+                           GCancellable      *cancellable,
+                           GError           **error)
+{
+  const int max_attempts = 128;
+  int i;
+  int fd;
+
+  /* 128 attempts seems reasonable... */
+  for (i = 0; i < max_attempts; i++)
+    {
+      glnx_gen_temp_name (tmpl);
+
+      do
+        fd = openat (tmpdir_fd, tmpl, O_WRONLY | O_CREAT | O_EXCL, mode);
+      while (fd == -1 && errno == EINTR);
+      if (fd < 0 && errno != EEXIST)
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
+      else if (fd != -1)
+        break;
+    }
+  if (i == max_attempts)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "Exhausted attempts to open temporary file");
+      return FALSE;
+    }
+
+  if (out_stream)
+    *out_stream = g_unix_output_stream_new (fd, TRUE);
+  else
+    (void) close (fd);
+
+  return TRUE;
+}
+
+GVariant *
+flatpak_gvariant_new_empty_string_dict (void)
+{
+  g_auto(GVariantBuilder) builder = FLATPAK_VARIANT_BUILDER_INITIALIZER;
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+  return g_variant_builder_end (&builder);
+}
+
+gboolean
+flatpak_variant_save (GFile        *dest,
+                      GVariant     *variant,
+                      GCancellable *cancellable,
+                      GError      **error)
+{
+  g_autoptr(GOutputStream) out = NULL;
+  gsize bytes_written;
+
+  out = (GOutputStream *) g_file_replace (dest, NULL, FALSE,
+                                          G_FILE_CREATE_REPLACE_DESTINATION,
+                                          cancellable, error);
+  if (out == NULL)
+    return FALSE;
+
+  if (!g_output_stream_write_all (out,
+                                  g_variant_get_data (variant),
+                                  g_variant_get_size (variant),
+                                  &bytes_written,
+                                  cancellable,
+                                  error))
+    return FALSE;
+
+  if (!g_output_stream_close (out, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+void
+flatpak_variant_builder_init_from_variant (GVariantBuilder *builder,
+                                           const char      *type,
+                                           GVariant        *variant)
+{
+  gint i, n;
+
+  g_variant_builder_init (builder, G_VARIANT_TYPE (type));
+
+  n = g_variant_n_children (variant);
+  for (i = 0; i < n; i++)
+    {
+      GVariant *child = g_variant_get_child_value (variant, i);
+      g_variant_builder_add_value (builder, child);
+      g_variant_unref (child);
+    }
+}
+
+gboolean
+flatpak_variant_bsearch_str (GVariant   *array,
+                             const char *str,
+                             int        *out_pos)
+{
+  gsize imax, imin;
+  gsize imid;
+  gsize n;
+
+  n = g_variant_n_children (array);
+  if (n == 0)
+    return FALSE;
+
+  imax = n - 1;
+  imin = 0;
+  while (imax >= imin)
+    {
+      g_autoptr(GVariant) child = NULL;
+      g_autoptr(GVariant) cur_v = NULL;
+      const char *cur;
+      int cmp;
+
+      imid = (imin + imax) / 2;
+
+      child = g_variant_get_child_value (array, imid);
+      cur_v = g_variant_get_child_value (child, 0);
+      cur = g_variant_get_data (cur_v);
+
+      cmp = strcmp (cur, str);
+      if (cmp < 0)
+        {
+          imin = imid + 1;
+        }
+      else if (cmp > 0)
+        {
+          if (imid == 0)
+            break;
+          imax = imid - 1;
+        }
+      else
+        {
+          *out_pos = imid;
+          return TRUE;
+        }
+    }
+
+  *out_pos = imid;
+  return FALSE;
+}
+
+/* Find the list of refs which belong to the given @collection_id in @summary.
+ * If @collection_id is %NULL, the main refs list from the summary will be
+ * returned. If @collection_id doesn’t match any collection IDs in the summary
+ * file, %NULL will be returned. */
+static GVariant *
+summary_find_refs_list (GVariant   *summary,
+                        const char *collection_id)
+{
+  g_autoptr(GVariant) refs = NULL;
+  g_autoptr(GVariant) metadata = g_variant_get_child_value (summary, 1);
+  const char *summary_collection_id;
+
+  if (!g_variant_lookup (metadata, "ostree.summary.collection-id", "&s", &summary_collection_id))
+    summary_collection_id = NULL;
+
+  if (collection_id == NULL || g_strcmp0 (collection_id, summary_collection_id) == 0)
+    {
+      refs = g_variant_get_child_value (summary, 0);
+    }
+  else if (collection_id != NULL)
+    {
+      g_autoptr(GVariant) collection_map = NULL;
+
+      collection_map = g_variant_lookup_value (metadata, "ostree.summary.collection-map",
+                                               G_VARIANT_TYPE ("a{sa(s(taya{sv}))}"));
+      if (collection_map != NULL)
+        refs = g_variant_lookup_value (collection_map, collection_id, G_VARIANT_TYPE ("a(s(taya{sv}))"));
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/* This matches all refs from @collection_id that have ref, followed by '.'  as prefix */
+char **
+flatpak_summary_match_subrefs (GVariant   *summary,
+                               const char *collection_id,
+                               const char *ref)
+{
+  g_autoptr(GVariant) refs = NULL;
+  GPtrArray *res = g_ptr_array_new ();
+  gsize n, i;
+  g_auto(GStrv) parts = NULL;
+  g_autofree char *parts_prefix = NULL;
+  g_autofree char *ref_prefix = NULL;
+  g_autofree char *ref_suffix = NULL;
+
+  /* Work out which refs list to use, based on the @collection_id. */
+  refs = summary_find_refs_list (summary, collection_id);
+
+  if (refs != NULL)
+    {
+      /* Match against the refs. */
+      parts = g_strsplit (ref, "/", 0);
+      parts_prefix = g_strconcat (parts[1], ".", NULL);
+
+      ref_prefix = g_strconcat (parts[0], "/", NULL);
+      ref_suffix = g_strconcat ("/", parts[2], "/", parts[3], NULL);
+
+      n = g_variant_n_children (refs);
+      for (i = 0; i < n; i++)
+        {
+          g_autoptr(GVariant) child = NULL;
+          g_autoptr(GVariant) cur_v = NULL;
+          const char *cur;
+          const char *id_start;
+
+          child = g_variant_get_child_value (refs, i);
+          cur_v = g_variant_get_child_value (child, 0);
+          cur = g_variant_get_data (cur_v);
+
+          /* Must match type */
+          if (!g_str_has_prefix (cur, ref_prefix))
+            continue;
+
+          /* Must match arch & branch */
+          if (!g_str_has_suffix (cur, ref_suffix))
+            continue;
+
+          id_start = strchr (cur, '/');
+          if (id_start == NULL)
+            continue;
+
+          /* But only prefix of id */
+          if (!g_str_has_prefix (id_start + 1, parts_prefix))
+            continue;
+
+          g_ptr_array_add (res, g_strdup (cur));
+        }
+    }
+
+  g_ptr_array_add (res, NULL);
+  return (char **)g_ptr_array_free (res, FALSE);
+}
+
+gboolean
+flatpak_summary_lookup_ref (GVariant    *summary,
+                            const char  *collection_id,
+                            const char  *ref,
+                            char       **out_checksum,
+                            GVariant   **out_variant)
+{
+  g_autoptr(GVariant) refs = NULL;
+  int pos;
+  g_autoptr(GVariant) refdata = NULL;
+  g_autoptr(GVariant) reftargetdata = NULL;
+  guint64 commit_size;
+  g_autoptr(GVariant) commit_csum_v = NULL;
+
+  refs = summary_find_refs_list (summary, collection_id);
+  if (refs == NULL)
+    return FALSE;
+
+  if (!flatpak_variant_bsearch_str (refs, ref, &pos))
+    return FALSE;
+
+  refdata = g_variant_get_child_value (refs, pos);
+  reftargetdata = g_variant_get_child_value (refdata, 1);
+  g_variant_get (reftargetdata, "(t@ay@a{sv})", &commit_size, &commit_csum_v, NULL);
+
+  if (!ostree_validate_structureof_csum_v (commit_csum_v, NULL))
+    return FALSE;
+
+  if (out_checksum)
+    *out_checksum = ostree_checksum_from_bytes_v (commit_csum_v);
+
+  if (out_variant)
+    *out_variant = g_steal_pointer (&reftargetdata);
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_set_title (OstreeRepo *repo,
+                        const char *title,
+                        GError    **error)
+{
+  g_autoptr(GKeyFile) config = NULL;
+
+  config = ostree_repo_copy_config (repo);
+
+  if (title)
+    g_key_file_set_string (config, "flatpak", "title", title);
+  else
+    g_key_file_remove_key (config, "flatpak", "title", NULL);
+
+  if (!ostree_repo_write_config (repo, config, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_set_redirect_url (OstreeRepo *repo,
+                               const char *redirect_url,
+                               GError    **error)
+{
+  g_autoptr(GKeyFile) config = NULL;
+
+  config = ostree_repo_copy_config (repo);
+
+  if (redirect_url)
+    g_key_file_set_string (config, "flatpak", "redirect-url", redirect_url);
+  else
+    g_key_file_remove_key (config, "flatpak", "redirect-url", NULL);
+
+  if (!ostree_repo_write_config (repo, config, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_set_deploy_collection_id (OstreeRepo  *repo,
+                                       gboolean     deploy_collection_id,
+                                       GError     **error)
+{
+  g_autoptr(GKeyFile) config = NULL;
+
+  config = ostree_repo_copy_config (repo);
+  g_key_file_set_boolean (config, "flatpak", "deploy-collection-id", deploy_collection_id);
+  return ostree_repo_write_config (repo, config, error);
+}
+
+gboolean
+flatpak_repo_set_gpg_keys (OstreeRepo *repo,
+                           GBytes *bytes,
+                           GError    **error)
+{
+  g_autoptr(GKeyFile) config = NULL;
+  g_autofree char *value_base64 = NULL;
+
+  config = ostree_repo_copy_config (repo);
+
+  value_base64 = g_base64_encode (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
+
+  g_key_file_set_string (config, "flatpak", "gpg-keys", value_base64);
+
+  if (!ostree_repo_write_config (repo, config, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_set_default_branch (OstreeRepo *repo,
+                                 const char *branch,
+                                 GError    **error)
+{
+  g_autoptr(GKeyFile) config = NULL;
+
+  config = ostree_repo_copy_config (repo);
+
+  if (branch)
+    g_key_file_set_string (config, "flatpak", "default-branch", branch);
+  else
+    g_key_file_remove_key (config, "flatpak", "default-branch", NULL);
+
+  if (!ostree_repo_write_config (repo, config, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_set_collection_id (OstreeRepo  *repo,
+                                const char  *collection_id,
+                                GError     **error)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  g_autoptr(GKeyFile) config = NULL;
+
+  config = ostree_repo_copy_config (repo);
+  if (!ostree_repo_set_collection_id (repo, collection_id, error))
+    return FALSE;
+
+  if (!ostree_repo_write_config (repo, config, error))
+    return FALSE;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  return TRUE;
+}
+
+GVariant *
+flatpak_commit_get_extra_data_sources (GVariant *commitv,
+                                       GError      **error)
+{
+  g_autoptr(GVariant) commit_metadata = NULL;
+  g_autoptr(GVariant) extra_data_sources = NULL;
+
+  commit_metadata = g_variant_get_child_value (commitv, 0);
+  extra_data_sources = g_variant_lookup_value (commit_metadata,
+                                               "xa.extra-data-sources",
+                                               G_VARIANT_TYPE ("a(ayttays)"));
+
+  if (extra_data_sources == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   _("No extra data sources"));
+      return NULL;
+    }
+
+  return g_steal_pointer (&extra_data_sources);
+}
+
+
+GVariant *
+flatpak_repo_get_extra_data_sources (OstreeRepo   *repo,
+                                     const char   *rev,
+                                     GCancellable *cancellable,
+                                     GError      **error)
+{
+  g_autoptr(GVariant) commitv = NULL;
+
+  if (!ostree_repo_load_variant (repo,
+                                 OSTREE_OBJECT_TYPE_COMMIT,
+                                 rev, &commitv, error))
+    return NULL;
+
+  return flatpak_commit_get_extra_data_sources (commitv, error);
+}
+
+void
+flatpak_repo_parse_extra_data_sources (GVariant *extra_data_sources,
+                                       int index,
+                                       const char **name,
+                                       guint64 *download_size,
+                                       guint64 *installed_size,
+                                       const guchar **sha256,
+                                       const char **uri)
+{
+  g_autoptr(GVariant) sha256_v = NULL;
+  g_variant_get_child (extra_data_sources, index, "(^aytt@ay&s)",
+                       name,
+                       download_size,
+                       installed_size,
+                       &sha256_v,
+                       uri);
+
+  if (download_size)
+    *download_size = GUINT64_FROM_BE (*download_size);
+
+  if (installed_size)
+    *installed_size = GUINT64_FROM_BE (*installed_size);
+
+  if (sha256)
+    *sha256 = ostree_checksum_bytes_peek (sha256_v);
+}
+
+#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::size,standard::is-symlink,standard::symlink-target," \
+                                   "unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")
+
+static gboolean
+_flatpak_repo_collect_sizes (OstreeRepo   *repo,
+                             GFile        *file,
+                             GFileInfo    *file_info,
+                             guint64      *installed_size,
+                             guint64      *download_size,
+                             GCancellable *cancellable,
+                             GError      **error)
+{
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  GFileInfo *child_info_tmp;
+  g_autoptr(GError) temp_error = NULL;
+
+  if (file_info != NULL && g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
+    {
+      const char *checksum = ostree_repo_file_get_checksum (OSTREE_REPO_FILE (file));
+      guint64 obj_size;
+      guint64 file_size = g_file_info_get_size (file_info);
+
+      if (installed_size)
+        *installed_size += ((file_size + 511) / 512) * 512;
+
+      if (download_size)
+        {
+          g_autoptr(GInputStream) input = NULL;
+          GInputStream *base_input;
+          g_autoptr(GError) local_error = NULL;
+
+          if (!ostree_repo_query_object_storage_size (repo,
+                                                      OSTREE_OBJECT_TYPE_FILE, checksum,
+                                                      &obj_size, cancellable, &local_error))
+            {
+              int fd;
+              struct stat stbuf;
+
+              /* Ostree does not look at the staging directory when querying storage
+                 size, so may return a NOT_FOUND error here. We work around this
+                 by loading the object and walking back until we find the original
+                 fd which we can fstat(). */
+              if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+                return FALSE;
+
+              if (!ostree_repo_load_file (repo, checksum,  &input, NULL, NULL, NULL, error))
+                return FALSE;
+
+              base_input = input;
+              while (G_IS_FILTER_INPUT_STREAM (base_input))
+                base_input = g_filter_input_stream_get_base_stream (G_FILTER_INPUT_STREAM (base_input));
+
+              if (!G_IS_UNIX_INPUT_STREAM (base_input))
+                return flatpak_fail (error, "Unable to find size of commit %s, not an unix stream\n", checksum);
+
+              fd = g_unix_input_stream_get_fd (G_UNIX_INPUT_STREAM (base_input));
+
+              if (fstat (fd, &stbuf) != 0)
+                return glnx_throw_errno_prefix (error, "Can't find commit size: ");
+
+              obj_size = stbuf.st_size;
+            }
+
+          *download_size += obj_size;
+        }
+    }
+
+  if (file_info == NULL || g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
+    {
+      dir_enum = g_file_enumerate_children (file, OSTREE_GIO_FAST_QUERYINFO,
+                                            G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                            cancellable, error);
+      if (!dir_enum)
+        return FALSE;
+
+
+      while ((child_info_tmp = g_file_enumerator_next_file (dir_enum, cancellable, &temp_error)))
+        {
+          g_autoptr(GFileInfo) child_info = child_info_tmp;
+          const char *name = g_file_info_get_name (child_info);
+          g_autoptr(GFile) child = g_file_get_child (file, name);
+
+          if (!_flatpak_repo_collect_sizes (repo, child, child_info, installed_size, download_size, cancellable, error))
+            return FALSE;
+        }
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_repo_collect_sizes (OstreeRepo   *repo,
+                            GFile        *root,
+                            guint64      *installed_size,
+                            guint64      *download_size,
+                            GCancellable *cancellable,
+                            GError      **error)
+{
+  return _flatpak_repo_collect_sizes (repo, root, NULL, installed_size, download_size, cancellable, error);
+}
+
+
+static void
+flatpak_repo_collect_extra_data_sizes (OstreeRepo   *repo,
+                                       const char   *rev,
+                                       guint64      *installed_size,
+                                       guint64      *download_size)
+{
+  g_autoptr(GVariant) extra_data_sources = NULL;
+  gsize n_extra_data;
+  int i;
+
+  extra_data_sources = flatpak_repo_get_extra_data_sources (repo, rev, NULL, NULL);
+  if (extra_data_sources == NULL)
+    return;
+
+  n_extra_data = g_variant_n_children (extra_data_sources);
+  if (n_extra_data == 0)
+    return;
+
+  for (i = 0; i < n_extra_data; i++)
+    {
+      guint64 extra_download_size;
+      guint64 extra_installed_size;
+
+      flatpak_repo_parse_extra_data_sources (extra_data_sources, i,
+                                             NULL,
+                                             &extra_download_size,
+                                             &extra_installed_size,
+                                             NULL, NULL);
+      if (installed_size)
+        *installed_size += extra_installed_size;
+      if (download_size)
+        *download_size += extra_download_size;
+    }
+}
+
+/* Loads a summary file from a local repo */
+GVariant *
+flatpak_repo_load_summary (OstreeRepo *repo,
+                           GError **error)
+{
+  glnx_autofd int fd = -1;
+  g_autoptr(GMappedFile) mfile = NULL;
+  g_autoptr(GBytes) bytes = NULL;
+
+  fd = openat (ostree_repo_get_dfd (repo), "summary", O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    {
+      glnx_set_error_from_errno (error);
+      return NULL;
+    }
+
+  mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
+  if (!mfile)
+    return NULL;
+
+  bytes = g_mapped_file_get_bytes (mfile);
+
+  return g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT, bytes, TRUE));
+}
+
+typedef struct {
+  guint64 installed_size;
+  guint64 download_size;
+  char *metadata_contents;
+} CommitData;
+
+static void
+commit_data_free (gpointer data)
+{
+  CommitData *rev_data = data;
+  g_free (rev_data->metadata_contents);
+  g_free (rev_data);
+}
+
+/* For all the refs listed in @cache_v (an xa.cache value) which exist in the
+ * @summary, insert their data into @commit_data_cache if it isn’t already there. */
+static void
+populate_commit_data_cache (GVariant   *metadata,
+                            GVariant   *summary,
+                            GHashTable *commit_data_cache  /* (element-type utf8 CommitData) */)
+{
+  g_autoptr(GVariant) cache_v = NULL;
+  g_autoptr(GVariant) cache = NULL;
+  gsize n, i;
+  const char *old_collection_id;
+
+#if FLATPAK_ENABLE_P2P
+  if (!g_variant_lookup (metadata, "ostree.summary.collection-id", "&s", &old_collection_id))
+    old_collection_id = NULL;
+#else  /* if !FLATPAK_ENABLE_P2P */
+  old_collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+  cache_v = g_variant_lookup_value (metadata, "xa.cache", NULL);
+
+  if (cache_v == NULL)
+    return;
+
+  cache = g_variant_get_child_value (cache_v, 0);
+
+  n = g_variant_n_children (cache);
+  for (i = 0; i < n; i++)
+    {
+      g_autoptr(GVariant) old_element = g_variant_get_child_value (cache, i);
+      g_autoptr(GVariant) old_ref_v = g_variant_get_child_value (old_element, 0);
+      const char *old_ref = g_variant_get_string (old_ref_v, NULL);
+      g_autofree char *old_rev = NULL;
+      g_autoptr(GVariant) old_commit_data_v = g_variant_get_child_value (old_element, 1);
+      CommitData *old_rev_data;
+
+      if (flatpak_summary_lookup_ref (summary, old_collection_id, old_ref, &old_rev, NULL))
+        {
+          guint64 old_installed_size, old_download_size;
+          g_autofree char *old_metadata = NULL;
+
+          /* See if we already have the info on this revision */
+          if (g_hash_table_lookup (commit_data_cache, old_rev))
+            continue;
+
+          g_variant_get_child (old_commit_data_v, 0, "t", &old_installed_size);
+          old_installed_size = GUINT64_FROM_BE (old_installed_size);
+          g_variant_get_child (old_commit_data_v, 1, "t", &old_download_size);
+          old_download_size = GUINT64_FROM_BE (old_download_size);
+          g_variant_get_child (old_commit_data_v, 2, "s", &old_metadata);
+
+          old_rev_data = g_new (CommitData, 1);
+          old_rev_data->installed_size = old_installed_size;
+          old_rev_data->download_size = old_download_size;
+          old_rev_data->metadata_contents = g_steal_pointer (&old_metadata);
+
+          g_hash_table_insert (commit_data_cache, g_steal_pointer (&old_rev), old_rev_data);
+        }
+    }
+}
+
+/* Update the metadata in the summary file for @repo, and then re-sign the file.
+ * If the repo has a collection ID set, additionally store the metadata on a
+ * contentless commit in a well-known branch, which is the preferred way of
+ * broadcasting per-repo metadata (putting it in the summary file is deprecated,
+ * but kept for backwards compatibility).
+ *
+ * Note that there are two keys for the collection ID: collection-id, and
+ * xa.collection-id. If a client does not currently have a collection ID configured
+ * for this remote, it will *only* update its configuration from xa.collection-id.
+ * This allows phased deployment of collection-based repositories. Clients will
+ * only update their configuration from an unset to a set collection ID once
+ * (otherwise the security properties of collection IDs are broken). */
+gboolean
+flatpak_repo_update (OstreeRepo   *repo,
+                     const char  **gpg_key_ids,
+                     const char   *gpg_homedir,
+                     GCancellable *cancellable,
+                     GError      **error)
+{
+  GVariantBuilder builder;
+  GVariantBuilder ref_data_builder;
+  GKeyFile *config;
+  g_autofree char *title = NULL;
+  g_autofree char *redirect_url = NULL;
+  g_autofree char *default_branch = NULL;
+  g_autofree char *gpg_keys = NULL;
+  g_autoptr(GVariant) old_summary = NULL;
+  g_autoptr(GVariant) new_summary = NULL;
+  g_autoptr(GHashTable) refs = NULL;
+  const char *prefixes[] = { "appstream", "app", "runtime", NULL };
+  const char **prefix;
+  g_autoptr(GList) ordered_keys = NULL;
+  GList *l = NULL;
+  g_autoptr(GHashTable) commit_data_cache = NULL;
+  const char *collection_id;
+  g_autofree char *old_ostree_metadata_checksum = NULL;
+  g_autoptr(GVariant) old_ostree_metadata_v = NULL;
+  gboolean deploy_collection_id = FALSE;
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+
+  config = ostree_repo_get_config (repo);
+
+  if (config)
+    {
+      title = g_key_file_get_string (config, "flatpak", "title", NULL);
+      default_branch = g_key_file_get_string (config, "flatpak", "default-branch", NULL);
+      gpg_keys = g_key_file_get_string (config, "flatpak", "gpg-keys", NULL);
+      redirect_url = g_key_file_get_string (config, "flatpak", "redirect-url", NULL);
+      deploy_collection_id = g_key_file_get_boolean (config, "flatpak", "deploy-collection-id", NULL);
+    }
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = ostree_repo_get_collection_id (repo);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (title)
+    g_variant_builder_add (&builder, "{sv}", "xa.title",
+                           g_variant_new_string (title));
+
+  if (redirect_url)
+    g_variant_builder_add (&builder, "{sv}", "xa.redirect-url",
+                           g_variant_new_string (redirect_url));
+
+  if (default_branch)
+    g_variant_builder_add (&builder, "{sv}", "xa.default-branch",
+                           g_variant_new_string (default_branch));
+
+  if (deploy_collection_id && collection_id != NULL)
+    g_variant_builder_add (&builder, "{sv}", "xa.collection-id",
+                           g_variant_new_string (collection_id));
+  else if (deploy_collection_id)
+    g_debug ("Ignoring deploy-collection-id=true because no collection ID is set.");
+
+  if (gpg_keys)
+    {
+      guchar *decoded;
+      gsize decoded_len;
+
+      gpg_keys = g_strstrip (gpg_keys);
+      decoded = g_base64_decode (gpg_keys, &decoded_len);
+
+      g_variant_builder_add (&builder, "{sv}", "xa.gpg-keys",
+                             g_variant_new_from_data (G_VARIANT_TYPE ("ay"), decoded, decoded_len,
+                                                      TRUE, (GDestroyNotify)g_free, decoded));
+    }
+
+  g_variant_builder_init (&ref_data_builder, G_VARIANT_TYPE ("a{s(tts)}"));
+
+  /* Only operate on flatpak relevant refs */
+  refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  for (prefix = prefixes; *prefix != NULL; prefix++)
+    {
+      g_autoptr(GHashTable) prefix_refs = NULL;
+      GHashTableIter hashiter;
+      gpointer key, value;
+
+      if (!ostree_repo_list_refs_ext (repo, *prefix, &prefix_refs,
+                                      OSTREE_REPO_LIST_REFS_EXT_NONE,
+                                      cancellable, error))
+        return FALSE;
+
+      /* Merge the prefix refs to the full refs table */
+      g_hash_table_iter_init (&hashiter, prefix_refs);
+      while (g_hash_table_iter_next (&hashiter, &key, &value))
+        {
+          char *ref = g_strdup (key);
+          char *rev = g_strdup (value);
+          g_hash_table_replace (refs, ref, rev);
+        }
+    }
+
+  commit_data_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                             g_free, commit_data_free);
+
+  old_summary = flatpak_repo_load_summary (repo, NULL);
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (!ostree_repo_resolve_rev (repo, OSTREE_REPO_METADATA_REF,
+                                TRUE, &old_ostree_metadata_checksum, error))
+    return FALSE;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (old_summary != NULL &&
+      old_ostree_metadata_checksum != NULL &&
+      ostree_repo_load_commit (repo, old_ostree_metadata_checksum, &old_ostree_metadata_v, NULL, NULL))
+    {
+      g_autoptr(GVariant) metadata = g_variant_get_child_value (old_ostree_metadata_v, 0);
+
+      populate_commit_data_cache (metadata, old_summary, commit_data_cache);
+    }
+  else if (old_summary != NULL)
+    {
+      g_autoptr(GVariant) extensions = g_variant_get_child_value (old_summary, 1);
+
+      populate_commit_data_cache (extensions, old_summary, commit_data_cache);
+    }
+
+  ordered_keys = g_hash_table_get_keys (refs);
+  ordered_keys = g_list_sort (ordered_keys, (GCompareFunc) strcmp);
+  for (l = ordered_keys; l; l = l->next)
+    {
+      const char *ref = l->data;
+      const char *rev = g_hash_table_lookup (refs, ref);
+      g_autoptr(GFile) root = NULL;
+      g_autoptr(GFile) metadata = NULL;
+      guint64 installed_size = 0;
+      guint64 download_size = 0;
+      g_autofree char *metadata_contents = NULL;
+      g_autofree char *commit = NULL;
+      g_autoptr(GVariant) commit_v = NULL;
+      g_autoptr(GVariant) commit_metadata = NULL;
+      CommitData *rev_data;
+
+      /* See if we already have the info on this revision */
+      if (g_hash_table_lookup (commit_data_cache, rev))
+        continue;
+
+      if (!ostree_repo_read_commit (repo, rev, &root, &commit, NULL, error))
+        return FALSE;
+
+      if (!ostree_repo_load_commit (repo, commit, &commit_v, NULL, error))
+        return FALSE;
+
+      commit_metadata = g_variant_get_child_value (commit_v, 0);
+      if (!g_variant_lookup (commit_metadata, "xa.metadata", "s", &metadata_contents))
+        {
+          metadata = g_file_get_child (root, "metadata");
+          if (!g_file_load_contents (metadata, cancellable, &metadata_contents, NULL, NULL, NULL))
+            metadata_contents = g_strdup ("");
+        }
+
+      if (g_variant_lookup (commit_metadata, "xa.installed-size", "t", &installed_size) &&
+          g_variant_lookup (commit_metadata, "xa.download-size", "t", &download_size))
+        {
+          installed_size = GUINT64_FROM_BE (installed_size);
+          download_size = GUINT64_FROM_BE (download_size);
+        }
+      else
+        {
+          if (!flatpak_repo_collect_sizes (repo, root, &installed_size, &download_size, cancellable, error))
+            return FALSE;
+        }
+
+      flatpak_repo_collect_extra_data_sizes (repo, rev, &installed_size, &download_size);
+
+      rev_data = g_new (CommitData, 1);
+      rev_data->installed_size = installed_size;
+      rev_data->download_size = download_size;
+      rev_data->metadata_contents = g_strdup (metadata_contents);
+
+      g_hash_table_insert (commit_data_cache, g_strdup (rev), rev_data);
+    }
+
+  for (l = ordered_keys; l; l = l->next)
+    {
+      const char *ref = l->data;
+      const char *rev = g_hash_table_lookup (refs, ref);
+      const CommitData *rev_data = g_hash_table_lookup (commit_data_cache,
+                                                        rev);
+
+      g_variant_builder_add (&ref_data_builder, "{s(tts)}",
+                             ref,
+                             GUINT64_TO_BE (rev_data->installed_size),
+                             GUINT64_TO_BE (rev_data->download_size),
+                             rev_data->metadata_contents);
+    }
+
+  /* Note: xa.cache doesn’t need to support collection IDs for the refs listed
+   * in it, because the xa.cache metadata is stored on the ostree-metadata ref,
+   * which is itself strongly bound to a collection ID — so that collection ID
+   * is bound to all the refs in xa.cache. If a client is using the xa.cache
+   * data from a summary file (rather than an ostree-metadata branch), they are
+   * too old to care about collection IDs anyway. */
+  g_variant_builder_add (&builder, "{sv}", "xa.cache",
+                         g_variant_new_variant (g_variant_builder_end (&ref_data_builder)));
+
+  new_summary = g_variant_ref_sink (g_variant_builder_end (&builder));
+
+  /* Write out a new metadata commit for the repository. */
+  if (collection_id != NULL)
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      OstreeCollectionRef collection_ref = { (gchar *) collection_id, (gchar *) OSTREE_REPO_METADATA_REF };
+      g_autofree gchar *new_ostree_metadata_checksum = NULL;
+      g_autoptr(OstreeMutableTree) mtree = NULL;
+      g_autoptr(OstreeRepoFile) repo_file = NULL;
+      g_autoptr(GVariantDict) new_summary_commit_dict = NULL;
+      g_autoptr(GVariant) new_summary_commit = NULL;
+
+      /* Add bindings to the metadata. */
+      new_summary_commit_dict = g_variant_dict_new (new_summary);
+      g_variant_dict_insert (new_summary_commit_dict, "ostree.collection-binding",
+                             "s", collection_ref.collection_id);
+      g_variant_dict_insert_value (new_summary_commit_dict, "ostree.ref-binding",
+                                   g_variant_new_strv ((const gchar * const *) &collection_ref.ref_name, 1));
+      new_summary_commit = g_variant_ref_sink (g_variant_dict_end (new_summary_commit_dict));
+
+      if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+        goto out;
+
+      /* Set up an empty mtree. */
+      mtree = ostree_mutable_tree_new ();
+      if (!flatpak_mtree_create_root (repo, mtree, cancellable, error))
+        goto out;
+      if (!ostree_repo_write_mtree (repo, mtree, (GFile **) &repo_file, NULL, error))
+        goto out;
+
+      if (!ostree_repo_write_commit (repo, old_ostree_metadata_checksum,
+                                     NULL  /* subject */, NULL  /* body */,
+                                     new_summary_commit, repo_file, &new_ostree_metadata_checksum,
+                                     NULL, error))
+        goto out;
+
+      if (gpg_key_ids != NULL)
+        {
+          const char * const *iter;
+
+          for (iter = gpg_key_ids; iter != NULL && *iter != NULL; iter++)
+            {
+              const char *key_id = *iter;
+
+              if (!ostree_repo_sign_commit (repo,
+                                            new_ostree_metadata_checksum,
+                                            key_id,
+                                            gpg_homedir,
+                                            cancellable,
+                                            error))
+                goto out;
+            }
+        }
+
+      ostree_repo_transaction_set_collection_ref (repo, &collection_ref,
+                                                  new_ostree_metadata_checksum);
+
+      if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
+        goto out;
+#else  /* if !FLATPAK_ENABLE_P2P */
+      g_assert_not_reached ();
+      goto out;
+#endif  /* FLATPAK_ENABLE_P2P */
+    }
+
+  /* Regenerate and re-sign the summary file. */
+  if (!ostree_repo_regenerate_summary (repo, new_summary, cancellable, error))
+    return FALSE;
+
+  if (gpg_key_ids)
+    {
+      if (!ostree_repo_add_gpg_signature_summary (repo,
+                                                  gpg_key_ids,
+                                                  gpg_homedir,
+                                                  cancellable,
+                                                  error))
+        return FALSE;
+    }
+
+  return TRUE;
+
+out:
+  if (repo != NULL)
+    ostree_repo_abort_transaction (repo, cancellable, NULL);
+  return FALSE;
+}
+
+gboolean
+flatpak_mtree_create_root (OstreeRepo        *repo,
+                           OstreeMutableTree *mtree,
+                           GCancellable      *cancellable,
+                           GError           **error)
+{
+  g_autoptr(GVariant) dirmeta = NULL;
+  g_autoptr(GFileInfo) file_info = g_file_info_new ();
+  g_autofree guchar *csum = NULL;
+  g_autofree char *checksum = NULL;
+
+  g_file_info_set_name (file_info, "/");
+  g_file_info_set_file_type (file_info, G_FILE_TYPE_DIRECTORY);
+  g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::mode", 040755);
+
+  dirmeta = ostree_create_directory_metadata (file_info, NULL);
+  if (!ostree_repo_write_metadata (repo, OSTREE_OBJECT_TYPE_DIR_META, NULL,
+                                   dirmeta, &csum, cancellable, error))
+    return FALSE;
+
+  checksum = ostree_checksum_from_bytes (csum);
+  ostree_mutable_tree_set_metadata_checksum (mtree, checksum);
+
+  return TRUE;
+}
+
+static OstreeRepoCommitFilterResult
+commit_filter (OstreeRepo *repo,
+               const char *path,
+               GFileInfo  *file_info,
+               gpointer    user_data)
+{
+  guint current_mode;
+
+  /* No user info */
+  g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
+  g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0);
+
+  /* No setuid */
+  current_mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
+  g_file_info_set_attribute_uint32 (file_info, "unix::mode", current_mode & ~07000);
+
+  return OSTREE_REPO_COMMIT_FILTER_ALLOW;
+}
+
+static gboolean
+validate_component (FlatpakXml *component,
+                    const char *ref,
+                    const char *id,
+                    char      **tags,
+                    const char *runtime,
+                    const char *sdk)
+{
+  FlatpakXml *bundle, *text, *prev, *id_node, *id_text_node, *metadata, *value;
+  g_autofree char *id_text = NULL;
+  int i;
+
+  if (g_strcmp0 (component->element_name, "component") != 0)
+    return FALSE;
+
+  id_node = flatpak_xml_find (component, "id", NULL);
+  if (id_node == NULL)
+    return FALSE;
+
+  id_text_node = flatpak_xml_find (id_node, NULL, NULL);
+  if (id_text_node == NULL || id_text_node->text == NULL)
+    return FALSE;
+
+  id_text = g_strstrip (g_strdup (id_text_node->text));
+
+  /* Drop .desktop file suffix (unless the actual app id ends with .desktop) */
+  if (g_str_has_suffix (id_text, ".desktop") &&
+      !g_str_has_suffix (id, ".desktop"))
+    id_text[strlen(id_text)-strlen(".desktop")] = 0;
+
+  if (!g_str_has_prefix (id_text, id))
+    {
+      g_warning ("Invalid id %s", id_text);
+      return FALSE;
+    }
+
+  while ((bundle = flatpak_xml_find (component, "bundle", &prev)) != NULL)
+    flatpak_xml_free (flatpak_xml_unlink (component, bundle));
+
+  bundle = flatpak_xml_new ("bundle");
+  bundle->attribute_names = g_new0 (char *, 2 * 4);
+  bundle->attribute_values = g_new0 (char *, 2 * 4);
+  bundle->attribute_names[0] = g_strdup ("type");
+  bundle->attribute_values[0] = g_strdup ("flatpak");
+
+  i = 1;
+  if (runtime && !g_str_has_prefix (runtime, "runtime/"))
+    {
+      bundle->attribute_names[i] = g_strdup ("runtime");
+      bundle->attribute_values[i] = g_strdup (runtime);
+      i++;
+    }
+
+  if (sdk)
+    {
+      bundle->attribute_names[i] = g_strdup ("sdk");
+      bundle->attribute_values[i] = g_strdup (sdk);
+      i++;
+    }
+
+  text = flatpak_xml_new (NULL);
+  text->text = g_strdup (ref);
+  flatpak_xml_add (bundle, text);
+
+  flatpak_xml_add (component, flatpak_xml_new_text ("  "));
+  flatpak_xml_add (component, bundle);
+  flatpak_xml_add (component, flatpak_xml_new_text ("\n  "));
+
+  if (tags != NULL && tags[0] != NULL)
+    {
+      metadata = flatpak_xml_find (component, "metadata", NULL);
+      if (metadata == NULL)
+        {
+          metadata = flatpak_xml_new ("metadata");
+          metadata->attribute_names = g_new0 (char *, 1);
+          metadata->attribute_values = g_new0 (char *, 1);
+
+          flatpak_xml_add (component, flatpak_xml_new_text ("  "));
+          flatpak_xml_add (component, metadata);
+          flatpak_xml_add (component, flatpak_xml_new_text ("\n  "));
+        }
+
+      value = flatpak_xml_new ("value");
+      value->attribute_names = g_new0 (char *, 2);
+      value->attribute_values = g_new0 (char *, 2);
+      value->attribute_names[0] = g_strdup ("key");
+      value->attribute_values[0] = g_strdup ("X-Flatpak-Tags");
+      flatpak_xml_add (metadata, flatpak_xml_new_text ("\n       "));
+      flatpak_xml_add (metadata, value);
+      flatpak_xml_add (metadata, flatpak_xml_new_text ("\n    "));
+
+      text = flatpak_xml_new (NULL);
+      text->text = g_strjoinv (",", tags);
+      flatpak_xml_add (value, text);
+
+    }
+
+  return TRUE;
+}
+
+gboolean
+flatpak_appstream_xml_migrate (FlatpakXml *source,
+                               FlatpakXml *dest,
+                               const char *ref,
+                               const char *id,
+                               GKeyFile   *metadata)
+{
+  FlatpakXml *source_components;
+  FlatpakXml *dest_components;
+  FlatpakXml *component;
+  FlatpakXml *prev_component;
+  gboolean migrated = FALSE;
+
+  g_auto(GStrv) tags = NULL;
+  g_autofree const char *runtime = NULL;
+  g_autofree const char *sdk = NULL;
+  const char *group;
+
+  if (source->first_child == NULL ||
+      source->first_child->next_sibling != NULL ||
+      g_strcmp0 (source->first_child->element_name, "components") != 0)
+    return FALSE;
+
+  if (g_str_has_prefix (ref, "app/"))
+    group = FLATPAK_METADATA_GROUP_APPLICATION;
+  else
+    group = FLATPAK_METADATA_GROUP_RUNTIME;
+
+  tags = g_key_file_get_string_list (metadata, group, FLATPAK_METADATA_KEY_TAGS,
+                                     NULL, NULL);
+  runtime = g_key_file_get_string (metadata, group,
+                                   FLATPAK_METADATA_KEY_RUNTIME, NULL);
+  sdk = g_key_file_get_string (metadata, group, FLATPAK_METADATA_KEY_SDK, NULL);
+
+  source_components = source->first_child;
+  dest_components = dest->first_child;
+
+  component = source_components->first_child;
+  prev_component = NULL;
+  while (component != NULL)
+    {
+      FlatpakXml *next = component->next_sibling;
+
+      if (validate_component (component, ref, id, tags, runtime, sdk))
+        {
+          flatpak_xml_add (dest_components,
+                           flatpak_xml_unlink (component, prev_component));
+          migrated = TRUE;
+        }
+      else
+        {
+          prev_component = component;
+        }
+
+      component = next;
+    }
+
+  return migrated;
+}
+
+static gboolean
+copy_icon (const char *id,
+           GFile      *root,
+           GFile      *dest,
+           const char *size,
+           GError    **error)
+{
+  g_autofree char *icon_name = g_strconcat (id, ".png", NULL);
+
+  g_autoptr(GFile) icons_dir =
+    g_file_resolve_relative_path (root,
+                                  "files/share/app-info/icons/flatpak");
+  g_autoptr(GFile) size_dir = g_file_get_child (icons_dir, size);
+  g_autoptr(GFile) icon_file = g_file_get_child (size_dir, icon_name);
+  g_autoptr(GFile) dest_dir = g_file_get_child (dest, "icons");
+  g_autoptr(GFile) dest_size_dir = g_file_get_child (dest_dir, size);
+  g_autoptr(GFile) dest_file = g_file_get_child (dest_size_dir, icon_name);
+  g_autoptr(GInputStream) in = NULL;
+  g_autoptr(GOutputStream) out = NULL;
+  g_autoptr(GError) my_error = NULL;
+  gssize n_bytes_written;
+
+  in = (GInputStream *) g_file_read (icon_file, NULL, &my_error);
+  if (!in)
+    {
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+        {
+          g_debug ("No icon at size %s", size);
+          return TRUE;
+        }
+
+      g_propagate_error (error, g_steal_pointer (&my_error));
+      return FALSE;
+    }
+
+  if (!flatpak_mkdir_p (dest_size_dir, NULL, error))
+    return FALSE;
+
+  out = (GOutputStream *) g_file_replace (dest_file, NULL, FALSE,
+                                          G_FILE_CREATE_REPLACE_DESTINATION,
+                                          NULL, error);
+  if (!out)
+    return FALSE;
+
+  n_bytes_written = g_output_stream_splice (out, in,
+                                            G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+                                            NULL, error);
+  if (n_bytes_written < 0)
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+extract_appstream (OstreeRepo   *repo,
+                   FlatpakXml   *appstream_root,
+                   const char   *ref,
+                   const char   *id,
+                   GFile        *dest,
+                   GCancellable *cancellable,
+                   GError      **error)
+{
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(GFile) xmls_dir = NULL;
+  g_autoptr(GFile) appstream_file = NULL;
+  g_autoptr(GFile) metadata = NULL;
+  g_autofree char *appstream_basename = NULL;
+  g_autoptr(GInputStream) in = NULL;
+  g_autoptr(FlatpakXml) xml_root = NULL;
+  g_autoptr(GKeyFile) keyfile = NULL;
+
+  if (!ostree_repo_read_commit (repo, ref, &root, NULL, NULL, error))
+    return FALSE;
+
+  keyfile = g_key_file_new ();
+  metadata = g_file_get_child (root, "metadata");
+  if (g_file_query_exists (metadata, cancellable))
+    {
+      g_autofree char *content = NULL;
+      gsize len;
+
+      if (!g_file_load_contents (metadata, cancellable, &content, &len, NULL, error))
+        return FALSE;
+
+      if (!g_key_file_load_from_data (keyfile, content, len, G_KEY_FILE_NONE, error))
+        return FALSE;
+    }
+
+  xmls_dir = g_file_resolve_relative_path (root, "files/share/app-info/xmls");
+  appstream_basename = g_strconcat (id, ".xml.gz", NULL);
+  appstream_file = g_file_get_child (xmls_dir, appstream_basename);
+
+  in = (GInputStream *) g_file_read (appstream_file, cancellable, error);
+  if (!in)
+    return FALSE;
+
+  xml_root = flatpak_xml_parse (in, TRUE, cancellable, error);
+  if (xml_root == NULL)
+    return FALSE;
+
+  if (flatpak_appstream_xml_migrate (xml_root, appstream_root,
+                                     ref, id, keyfile))
+    {
+      g_autoptr(GError) my_error = NULL;
+      FlatpakXml *components = appstream_root->first_child;
+      FlatpakXml *component = components->first_child;
+
+      while (component != NULL)
+        {
+          FlatpakXml *component_id, *component_id_text_node;
+          g_autofree char *component_id_text = NULL;
+
+          if (g_strcmp0 (component->element_name, "component") != 0)
+            {
+              component = component->next_sibling;
+              continue;
+            }
+
+          component_id = flatpak_xml_find (component, "id", NULL);
+          component_id_text_node = flatpak_xml_find (component_id, NULL, NULL);
+
+          component_id_text = g_strstrip (g_strdup (component_id_text_node->text));
+          if (!g_str_has_prefix (component_id_text, id) ||
+              !g_str_has_suffix (component_id_text, ".desktop"))
+            {
+              component = component->next_sibling;
+              continue;
+            }
+
+          g_print ("Extracting icons for component %s\n", component_id_text);
+          component_id_text[strlen (component_id_text) - strlen (".desktop")] = 0;
+
+          if (!copy_icon (component_id_text, root, dest, "64x64", &my_error))
+            {
+              g_print ("Error copying 64x64 icon: %s\n", my_error->message);
+              g_clear_error (&my_error);
+            }
+          if (!copy_icon (component_id_text, root, dest, "128x128", &my_error))
+            {
+              g_print ("Error copying 128x128 icon: %s\n", my_error->message);
+              g_clear_error (&my_error);
+            }
+
+          /* We updated icons for our component, so we're done */
+          break;
+        }
+    }
+
+  return TRUE;
+}
+
+FlatpakXml *
+flatpak_appstream_xml_new (void)
+{
+  FlatpakXml *appstream_root = NULL;
+  FlatpakXml *appstream_components;
+
+  appstream_root = flatpak_xml_new ("root");
+  appstream_components = flatpak_xml_new ("components");
+  flatpak_xml_add (appstream_root, appstream_components);
+  flatpak_xml_add (appstream_components, flatpak_xml_new_text ("\n  "));
+
+  appstream_components->attribute_names = g_new0 (char *, 3);
+  appstream_components->attribute_values = g_new0 (char *, 3);
+  appstream_components->attribute_names[0] = g_strdup ("version");
+  appstream_components->attribute_values[0] = g_strdup ("0.8");
+  appstream_components->attribute_names[1] = g_strdup ("origin");
+  appstream_components->attribute_values[1] = g_strdup ("flatpak");
+
+  return appstream_root;
+}
+
+GBytes *
+flatpak_appstream_xml_root_to_data (FlatpakXml *appstream_root,
+                                    GError    **error)
+{
+  g_autoptr(GString) xml = NULL;
+  g_autoptr(GZlibCompressor) compressor = NULL;
+  g_autoptr(GOutputStream) out2 = NULL;
+  g_autoptr(GOutputStream) out = NULL;
+
+  flatpak_xml_add (appstream_root->first_child, flatpak_xml_new_text ("\n"));
+
+  xml = g_string_new ("");
+  flatpak_xml_to_string (appstream_root, xml);
+
+  compressor = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP, -1);
+  out = g_memory_output_stream_new_resizable ();
+  out2 = g_converter_output_stream_new (out, G_CONVERTER (compressor));
+  if (!g_output_stream_write_all (out2, xml->str, xml->len,
+                                  NULL, NULL, error))
+    return NULL;
+  if (!g_output_stream_close (out2, NULL, error))
+    return NULL;
+
+  return g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (out));
+}
+
+gboolean
+flatpak_repo_generate_appstream (OstreeRepo   *repo,
+                                 const char  **gpg_key_ids,
+                                 const char   *gpg_homedir,
+                                 guint64       timestamp,
+                                 GCancellable *cancellable,
+                                 GError      **error)
+{
+  g_autoptr(GHashTable) all_refs = NULL;
+  g_autoptr(GHashTable) arches = NULL;  /* (element-type utf8 utf8) */
+  GHashTableIter iter;
+  gpointer key;
+  const char *collection_id;
+
+  arches = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+#ifdef FLATPAK_ENABLE_P2P
+  collection_id = ostree_repo_get_collection_id (repo);
+#else  /* if !FLATPAK_ENABLE_P2P */
+  collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+  if (!ostree_repo_list_refs (repo,
+                              NULL,
+                              &all_refs,
+                              cancellable,
+                              error))
+    return FALSE;
+
+  g_hash_table_iter_init (&iter, all_refs);
+  while (g_hash_table_iter_next (&iter, &key, NULL))
+    {
+      const char *ref = key;
+      const char *arch;
+      g_auto(GStrv) split = NULL;
+
+      split = flatpak_decompose_ref (ref, NULL);
+      if (!split)
+        continue;
+
+      arch = split[2];
+      if (!g_hash_table_contains (arches, arch))
+        g_hash_table_add (arches, g_strdup (arch));
+    }
+
+  g_hash_table_iter_init (&iter, arches);
+  while (g_hash_table_iter_next (&iter, &key, NULL))
+    {
+      GHashTableIter iter2;
+      const char *arch = key;
+      g_autofree char *tmpdir = g_strdup ("/tmp/flatpak-appstream-XXXXXX");
+      g_autoptr(FlatpakTempDir) tmpdir_file = NULL;
+      g_autoptr(GFile) appstream_file = NULL;
+      g_autoptr(GFile) root = NULL;
+      g_autoptr(OstreeMutableTree) mtree = NULL;
+      g_autofree char *commit_checksum = NULL;
+      OstreeRepoTransactionStats stats;
+      g_autoptr(OstreeRepoCommitModifier) modifier = NULL;
+      g_autofree char *parent = NULL;
+      g_autofree char *branch = NULL;
+      g_autoptr(FlatpakXml) appstream_root = NULL;
+      g_autoptr(GBytes) xml_data = NULL;
+      gboolean skip_commit = FALSE;
+
+      if (g_mkdtemp_full (tmpdir, 0755) == NULL)
+        return flatpak_fail (error, "Can't create temporary directory");
+
+      tmpdir_file = g_file_new_for_path (tmpdir);
+
+      appstream_root = flatpak_appstream_xml_new ();
+
+      g_hash_table_iter_init (&iter2, all_refs);
+      while (g_hash_table_iter_next (&iter2, &key, NULL))
+        {
+          const char *ref = key;
+          g_auto(GStrv) split = NULL;
+          g_autoptr(GError) my_error = NULL;
+
+          split = flatpak_decompose_ref (ref, NULL);
+          if (!split)
+            continue;
+
+          if (strcmp (split[2], arch) != 0)
+            continue;
+
+          if (!extract_appstream (repo, appstream_root,
+                                  ref, split[1], tmpdir_file,
+                                  cancellable, &my_error))
+            {
+              if (g_str_has_prefix (ref, "app/"))
+                g_print ("No appstream data for %s: %s\n", ref, my_error->message);
+              continue;
+            }
+        }
+
+      xml_data = flatpak_appstream_xml_root_to_data (appstream_root, error);
+      if (xml_data == NULL)
+        return FALSE;
+
+      appstream_file = g_file_get_child (tmpdir_file, "appstream.xml.gz");
+
+      if (!g_file_replace_contents (appstream_file,
+                                    g_bytes_get_data (xml_data, NULL),
+                                    g_bytes_get_size (xml_data),
+                                    NULL,
+                                    FALSE,
+                                    G_FILE_CREATE_NONE,
+                                    NULL,
+                                    cancellable,
+                                    error))
+        return FALSE;
+
+      if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+        return FALSE;
+
+      branch = g_strdup_printf ("appstream/%s", arch);
+
+      if (!ostree_repo_resolve_rev (repo, branch, TRUE, &parent, error))
+        goto out;
+
+      mtree = ostree_mutable_tree_new ();
+
+      modifier = ostree_repo_commit_modifier_new (OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS |
+                                                  OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS,
+                                                  (OstreeRepoCommitFilter) commit_filter, NULL, NULL);
+
+      if (!ostree_repo_write_directory_to_mtree (repo, G_FILE (tmpdir_file), mtree, modifier, cancellable, error))
+        goto out;
+
+      if (!ostree_repo_write_mtree (repo, mtree, &root, cancellable, error))
+        goto out;
+
+
+      /* No need to commit if nothing changed */
+      if (parent)
+        {
+          g_autoptr(GFile) parent_root;
+
+          if (!ostree_repo_read_commit (repo, parent, &parent_root, NULL, cancellable, error))
+            goto out;
+
+          if (g_file_equal (root, parent_root))
+            {
+              skip_commit = TRUE;
+              g_debug ("Not updating %s, no change", branch);
+            }
+        }
+
+      if (!skip_commit)
+        {
+          g_autoptr(GVariantDict) metadata_dict = NULL;
+          g_autoptr(GVariant) metadata = NULL;
+
+          /* Add bindings to the metadata. Do this even if P2P support is not
+           * enabled, as it might be enable for other flatpak builds. */
+          metadata_dict = g_variant_dict_new (NULL);
+          g_variant_dict_insert (metadata_dict, "ostree.collection-binding",
+                                 "s", (collection_id != NULL) ? collection_id : "");
+          g_variant_dict_insert_value (metadata_dict, "ostree.ref-binding",
+                                       g_variant_new_strv ((const gchar * const *) &branch, 1));
+          metadata = g_variant_ref_sink (g_variant_dict_end (metadata_dict));
+
+          if (timestamp > 0)
+            {
+              if (!ostree_repo_write_commit_with_time (repo, parent, "Update", NULL, metadata,
+                                                       OSTREE_REPO_FILE (root),
+                                                       timestamp,
+                                                       &commit_checksum,
+                                                       cancellable, error))
+                goto out;
+            }
+          else
+            {
+              if (!ostree_repo_write_commit (repo, parent, "Update", NULL, metadata,
+                                             OSTREE_REPO_FILE (root),
+                                             &commit_checksum, cancellable, error))
+                goto out;
+            }
+
+          if (gpg_key_ids)
+            {
+              int i;
+
+              for (i = 0; gpg_key_ids[i] != NULL; i++)
+                {
+                  const char *keyid = gpg_key_ids[i];
+
+                  if (!ostree_repo_sign_commit (repo,
+                                                commit_checksum,
+                                                keyid,
+                                                gpg_homedir,
+                                                cancellable,
+                                                error))
+                    goto out;
+                }
+            }
+
+#ifdef FLATPAK_ENABLE_P2P
+          if (collection_id != NULL)
+            {
+              const OstreeCollectionRef collection_ref = { (char *) collection_id, branch };
+              ostree_repo_transaction_set_collection_ref (repo, &collection_ref, commit_checksum);
+            }
+          else
+#endif  /* FLATPAK_ENABLE_P2P */
+            {
+              ostree_repo_transaction_set_ref (repo, NULL, branch, commit_checksum);
+            }
+
+          if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
+            goto out;
+        }
+      else
+        {
+          ostree_repo_abort_transaction (repo, cancellable, NULL);
+        }
+    }
+
+  return TRUE;
+
+out:
+  ostree_repo_abort_transaction (repo, cancellable, NULL);
+  return FALSE;
+}
+
+void
+flatpak_extension_free (FlatpakExtension *extension)
+{
+  g_free (extension->id);
+  g_free (extension->installed_id);
+  g_free (extension->commit);
+  g_free (extension->ref);
+  g_free (extension->directory);
+  g_free (extension->files_path);
+  g_free (extension->add_ld_path);
+  g_free (extension->subdir_suffix);
+  g_strfreev (extension->merge_dirs);
+  g_free (extension);
+}
+
+static int
+flatpak_extension_compare (gconstpointer  _a,
+                           gconstpointer  _b)
+{
+  const FlatpakExtension *a = _a;
+  const FlatpakExtension *b = _b;
+
+  return b->priority - a->priority;
+}
+
+static FlatpakExtension *
+flatpak_extension_new (const char *id,
+                       const char *extension,
+                       const char *ref,
+                       const char *directory,
+                       const char *add_ld_path,
+                       const char *subdir_suffix,
+                       char **merge_dirs,
+                       GFile *files,
+                       GFile *deploy_dir,
+                       gboolean is_unmaintained)
+{
+  FlatpakExtension *ext = g_new0 (FlatpakExtension, 1);
+  g_autoptr(GVariant) deploy_data = NULL;
+
+  ext->id = g_strdup (id);
+  ext->installed_id = g_strdup (extension);
+  ext->ref = g_strdup (ref);
+  ext->directory = g_strdup (directory);
+  ext->files_path = g_file_get_path (files);
+  ext->add_ld_path = g_strdup (add_ld_path);
+  ext->subdir_suffix = g_strdup (subdir_suffix);
+  ext->merge_dirs = g_strdupv (merge_dirs);
+  ext->is_unmaintained = is_unmaintained;
+
+  if (deploy_dir)
+    {
+      deploy_data = flatpak_load_deploy_data (deploy_dir, NULL, NULL);
+      if (deploy_data)
+        ext->commit = g_strdup (flatpak_deploy_data_get_commit (deploy_data));
+    }
+
+  if (is_unmaintained)
+    ext->priority = 1000;
+  else
+    {
+      g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+      g_autofree char *metadata_path = g_build_filename (ext->files_path, "../metadata", NULL);
+
+      if (g_key_file_load_from_file (keyfile, metadata_path, G_KEY_FILE_NONE, NULL))
+        ext->priority = g_key_file_get_integer (keyfile,
+                                                FLATPAK_METADATA_GROUP_EXTENSION_OF,
+                                                FLATPAK_METADATA_KEY_PRIORITY,
+                                                NULL);
+    }
+
+  return ext;
+}
+
+gboolean
+flatpak_extension_matches_reason (const char *extension_id,
+                                  const char *reason,
+                                  gboolean default_value)
+{
+  const char *extension_basename;
+
+  if (reason == NULL || *reason == 0)
+    return default_value;
+
+  extension_basename = strrchr (extension_id, '.');
+  if (extension_basename == NULL)
+    return FALSE;
+  extension_basename += 1;
+
+  if (strcmp (reason, "active-gl-driver") == 0)
+    {
+      /* handled below */
+      const char **gl_drivers = flatpak_get_gl_drivers ();
+      int i;
+
+      for (i = 0; gl_drivers[i] != NULL; i++)
+        {
+          if (strcmp (gl_drivers[i], extension_basename) == 0)
+            return TRUE;
+        }
+
+      return FALSE;
+    }
+  else if (strcmp (reason, "active-gtk-theme") == 0)
+    {
+      const char *gtk_theme = flatpak_get_gtk_theme ();
+      return (strcmp (gtk_theme, extension_basename) == 0);
+    }
+  else if (strcmp (reason, "have-intel-gpu") == 0)
+    {
+      /* Used for Intel VAAPI driver extension */
+      return flatpak_get_have_intel_gpu ();
+    }
+
+  return FALSE;
+}
+
+static GList *
+add_extension (GKeyFile   *metakey,
+               const char *group,
+               const char *extension,
+               const char *arch,
+               const char *branch,
+               GList *res)
+{
+  FlatpakExtension *ext;
+  g_autofree char *directory = g_key_file_get_string (metakey, group,
+                                                      FLATPAK_METADATA_KEY_DIRECTORY,
+                                                      NULL);
+  g_autofree char *add_ld_path = g_key_file_get_string (metakey, group,
+                                                        FLATPAK_METADATA_KEY_ADD_LD_PATH,
+                                                        NULL);
+  g_auto(GStrv) merge_dirs = g_key_file_get_string_list (metakey, group,
+                                                         FLATPAK_METADATA_KEY_MERGE_DIRS,
+                                                         NULL, NULL);
+  g_autofree char *enable_if = g_key_file_get_string (metakey, group,
+                                                      FLATPAK_METADATA_KEY_ENABLE_IF,
+                                                      NULL);
+  g_autofree char *subdir_suffix = g_key_file_get_string (metakey, group,
+                                                          FLATPAK_METADATA_KEY_SUBDIRECTORY_SUFFIX,
+                                                          NULL);
+  g_autofree char *ref = NULL;
+  gboolean is_unmaintained = FALSE;
+  g_autoptr(GFile) files = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+
+  if (directory == NULL)
+    return res;
+
+  ref = g_build_filename ("runtime", extension, arch, branch, NULL);
+
+  files = flatpak_find_unmaintained_extension_dir_if_exists (extension, arch, branch, NULL);
+
+  if (files == NULL)
+    {
+      deploy_dir = flatpak_find_deploy_dir_for_ref (ref, NULL, NULL, NULL);
+      if (deploy_dir)
+        files = g_file_get_child (deploy_dir, "files");
+    }
+  else
+    is_unmaintained = TRUE;
+
+  /* Prefer a full extension (org.freedesktop.Locale) over subdirectory ones (org.freedesktop.Locale.sv) */
+  if (files != NULL)
+    {
+      if (flatpak_extension_matches_reason (extension, enable_if, TRUE))
+        {
+          ext = flatpak_extension_new (extension, extension, ref, directory, add_ld_path, subdir_suffix, merge_dirs, files, deploy_dir, is_unmaintained);
+          res = g_list_prepend (res, ext);
+        }
+    }
+  else if (g_key_file_get_boolean (metakey, group,
+                                   FLATPAK_METADATA_KEY_SUBDIRECTORIES, NULL))
+    {
+      g_autofree char *prefix = g_strconcat (extension, ".", NULL);
+      g_auto(GStrv) refs = NULL;
+      g_auto(GStrv) unmaintained_refs = NULL;
+      int j;
+
+      refs = flatpak_list_deployed_refs ("runtime", prefix, arch, branch,
+                                         NULL, NULL);
+      for (j = 0; refs != NULL && refs[j] != NULL; j++)
+        {
+          g_autofree char *extended_dir = g_build_filename (directory, refs[j] + strlen (prefix), NULL);
+          g_autofree char *dir_ref = g_build_filename ("runtime", refs[j], arch, branch, NULL);
+          g_autoptr(GFile) subdir_deploy_dir = NULL;
+          g_autoptr(GFile) subdir_files = NULL;
+          subdir_deploy_dir = flatpak_find_deploy_dir_for_ref (dir_ref, NULL, NULL, NULL);
+          if (subdir_deploy_dir)
+            subdir_files = g_file_get_child (subdir_deploy_dir, "files");
+
+          if (subdir_files && flatpak_extension_matches_reason (refs[j], enable_if, TRUE))
+            {
+              ext = flatpak_extension_new (extension, refs[j], dir_ref, extended_dir, add_ld_path, subdir_suffix, merge_dirs, subdir_files, subdir_deploy_dir, FALSE);
+              ext->needs_tmpfs = TRUE;
+              res = g_list_prepend (res, ext);
+            }
+        }
+
+      unmaintained_refs = flatpak_list_unmaintained_refs (prefix, arch, branch,
+                                                          NULL, NULL);
+      for (j = 0; unmaintained_refs != NULL && unmaintained_refs[j] != NULL; j++)
+        {
+          g_autofree char *extended_dir = g_build_filename (directory, unmaintained_refs[j] + strlen (prefix), NULL);
+          g_autofree char *dir_ref = g_build_filename ("runtime", unmaintained_refs[j], arch, branch, NULL);
+          g_autoptr(GFile) subdir_files = flatpak_find_unmaintained_extension_dir_if_exists (unmaintained_refs[j], arch, branch, NULL);
+
+          if (subdir_files && flatpak_extension_matches_reason (unmaintained_refs[j], enable_if, TRUE))
+            {
+              ext = flatpak_extension_new (extension, unmaintained_refs[j], dir_ref, extended_dir, add_ld_path, subdir_suffix, merge_dirs, subdir_files, NULL, TRUE);
+              ext->needs_tmpfs = TRUE;
+              res = g_list_prepend (res, ext);
+            }
+        }
+    }
+
+  return res;
+}
+
+
+GList *
+flatpak_list_extensions (GKeyFile   *metakey,
+                         const char *arch,
+                         const char *default_branch)
+{
+  g_auto(GStrv) groups = NULL;
+  int i, j;
+  GList *res;
+
+  res = NULL;
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  groups = g_key_file_get_groups (metakey, NULL);
+  for (i = 0; groups[i] != NULL; i++)
+    {
+      char *extension;
+
+      if (g_str_has_prefix (groups[i], FLATPAK_METADATA_GROUP_PREFIX_EXTENSION) &&
+          *(extension = (groups[i] + strlen (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION))) != 0)
+        {
+          g_autofree char *version = g_key_file_get_string (metakey, groups[i],
+                                                            FLATPAK_METADATA_KEY_VERSION,
+                                                            NULL);
+          g_auto(GStrv) versions = g_key_file_get_string_list (metakey, groups[i],
+                                                               FLATPAK_METADATA_KEY_VERSIONS,
+                                                               NULL, NULL);
+          const char *default_branches[] = { default_branch, NULL};
+          const char **branches;
+
+          if (versions)
+            branches = (const char **)versions;
+          else
+            {
+              if (version)
+                default_branches[0] = version;
+              branches = default_branches;
+            }
+
+          for (j = 0; branches[j] != NULL; j++)
+            res = add_extension (metakey, groups[i], extension, arch, branches[j], res);
+        }
+    }
+
+  return g_list_sort (g_list_reverse (res), flatpak_extension_compare);
+}
+
+typedef struct
+{
+  FlatpakXml *current;
+} XmlData;
+
+FlatpakXml *
+flatpak_xml_new (const gchar *element_name)
+{
+  FlatpakXml *node = g_new0 (FlatpakXml, 1);
+
+  node->element_name = g_strdup (element_name);
+  return node;
+}
+
+FlatpakXml *
+flatpak_xml_new_text (const gchar *text)
+{
+  FlatpakXml *node = g_new0 (FlatpakXml, 1);
+
+  node->text = g_strdup (text);
+  return node;
+}
+
+void
+flatpak_xml_add (FlatpakXml *parent, FlatpakXml *node)
+{
+  node->parent = parent;
+
+  if (parent->first_child == NULL)
+    parent->first_child = node;
+  else
+    parent->last_child->next_sibling = node;
+  parent->last_child = node;
+}
+
+static void
+xml_start_element (GMarkupParseContext *context,
+                   const gchar         *element_name,
+                   const gchar        **attribute_names,
+                   const gchar        **attribute_values,
+                   gpointer             user_data,
+                   GError             **error)
+{
+  XmlData *data = user_data;
+  FlatpakXml *node;
+
+  node = flatpak_xml_new (element_name);
+  node->attribute_names = g_strdupv ((char **) attribute_names);
+  node->attribute_values = g_strdupv ((char **) attribute_values);
+
+  flatpak_xml_add (data->current, node);
+  data->current = node;
+}
+
+static void
+xml_end_element (GMarkupParseContext *context,
+                 const gchar         *element_name,
+                 gpointer             user_data,
+                 GError             **error)
+{
+  XmlData *data = user_data;
+
+  data->current = data->current->parent;
+}
+
+static void
+xml_text (GMarkupParseContext *context,
+          const gchar         *text,
+          gsize                text_len,
+          gpointer             user_data,
+          GError             **error)
+{
+  XmlData *data = user_data;
+  FlatpakXml *node;
+
+  node = flatpak_xml_new (NULL);
+  node->text = g_strndup (text, text_len);
+  flatpak_xml_add (data->current, node);
+}
+
+static void
+xml_passthrough (GMarkupParseContext *context,
+                 const gchar         *passthrough_text,
+                 gsize                text_len,
+                 gpointer             user_data,
+                 GError             **error)
+{
+}
+
+static GMarkupParser xml_parser = {
+  xml_start_element,
+  xml_end_element,
+  xml_text,
+  xml_passthrough,
+  NULL
+};
+
+void
+flatpak_xml_free (FlatpakXml *node)
+{
+  FlatpakXml *child;
+
+  if (node == NULL)
+    return;
+
+  child = node->first_child;
+  while (child != NULL)
+    {
+      FlatpakXml *next = child->next_sibling;
+      flatpak_xml_free (child);
+      child = next;
+    }
+
+  g_free (node->element_name);
+  g_free (node->text);
+  g_strfreev (node->attribute_names);
+  g_strfreev (node->attribute_values);
+  g_free (node);
+}
+
+
+void
+flatpak_xml_to_string (FlatpakXml *node, GString *res)
+{
+  int i;
+  FlatpakXml *child;
+
+  if (node->parent == NULL)
+    g_string_append (res, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+
+  if (node->element_name)
+    {
+      if (node->parent != NULL)
+        {
+          g_string_append (res, "<");
+          g_string_append (res, node->element_name);
+          if (node->attribute_names)
+            {
+              for (i = 0; node->attribute_names[i] != NULL; i++)
+                {
+                  g_string_append_printf (res, " %s=\"%s\"",
+                                          node->attribute_names[i],
+                                          node->attribute_values[i]);
+                }
+            }
+          if (node->first_child == NULL)
+            g_string_append (res, "/>");
+          else
+            g_string_append (res, ">");
+        }
+
+      child = node->first_child;
+      while (child != NULL)
+        {
+          flatpak_xml_to_string (child, res);
+          child = child->next_sibling;
+        }
+      if (node->parent != NULL)
+        {
+          if (node->first_child != NULL)
+            g_string_append_printf (res, "</%s>", node->element_name);
+        }
+
+    }
+  else if (node->text)
+    {
+      g_autofree char *escaped = g_markup_escape_text (node->text, -1);
+      g_string_append (res, escaped);
+    }
+}
+
+FlatpakXml *
+flatpak_xml_unlink (FlatpakXml *node,
+                    FlatpakXml *prev_sibling)
+{
+  FlatpakXml *parent = node->parent;
+
+  if (parent == NULL)
+    return node;
+
+  if (parent->first_child == node)
+    parent->first_child = node->next_sibling;
+
+  if (parent->last_child == node)
+    parent->last_child = prev_sibling;
+
+  if (prev_sibling)
+    prev_sibling->next_sibling = node->next_sibling;
+
+  node->parent = NULL;
+  node->next_sibling = NULL;
+
+  return node;
+}
+
+FlatpakXml *
+flatpak_xml_find (FlatpakXml  *node,
+                  const char  *type,
+                  FlatpakXml **prev_child_out)
+{
+  FlatpakXml *child = NULL;
+  FlatpakXml *prev_child = NULL;
+
+  child = node->first_child;
+  prev_child = NULL;
+  while (child != NULL)
+    {
+      FlatpakXml *next = child->next_sibling;
+
+      if (g_strcmp0 (child->element_name, type) == 0)
+        {
+          if (prev_child_out)
+            *prev_child_out = prev_child;
+          return child;
+        }
+
+      prev_child = child;
+      child = next;
+    }
+
+  return NULL;
+}
+
+
+FlatpakXml *
+flatpak_xml_parse (GInputStream *in,
+                   gboolean      compressed,
+                   GCancellable *cancellable,
+                   GError      **error)
+{
+  g_autoptr(GInputStream) real_in = NULL;
+  g_autoptr(FlatpakXml) xml_root = NULL;
+  XmlData data = { 0 };
+  char buffer[32 * 1024];
+  gssize len;
+  g_autoptr(GMarkupParseContext) ctx = NULL;
+
+  if (compressed)
+    {
+      g_autoptr(GZlibDecompressor) decompressor = NULL;
+      decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
+      real_in = g_converter_input_stream_new (in, G_CONVERTER (decompressor));
+    }
+  else
+    {
+      real_in = g_object_ref (in);
+    }
+
+  xml_root = flatpak_xml_new ("root");
+  data.current = xml_root;
+
+  ctx = g_markup_parse_context_new (&xml_parser,
+                                    G_MARKUP_PREFIX_ERROR_POSITION,
+                                    &data,
+                                    NULL);
+
+  while ((len = g_input_stream_read (real_in, buffer, sizeof (buffer),
+                                     cancellable, error)) > 0)
+    {
+      if (!g_markup_parse_context_parse (ctx, buffer, len, error))
+        return NULL;
+    }
+
+  if (len < 0)
+    return NULL;
+
+  return g_steal_pointer (&xml_root);
+}
+
+#define OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "(uayttay)"
+#define OSTREE_STATIC_DELTA_FALLBACK_FORMAT "(yaytt)"
+#define OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT "(a{sv}tayay" OSTREE_COMMIT_GVARIANT_STRING "aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")"
+
+static inline guint64
+maybe_swap_endian_u64 (gboolean swap,
+                       guint64  v)
+{
+  if (!swap)
+    return v;
+  return GUINT64_SWAP_LE_BE (v);
+}
+
+static guint64
+flatpak_bundle_get_installed_size (GVariant *bundle, gboolean byte_swap)
+{
+  guint64 total_usize = 0;
+  g_autoptr(GVariant) meta_entries = NULL;
+  guint i, n_parts;
+
+  g_variant_get_child (bundle, 6, "@a" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT, &meta_entries);
+  n_parts = g_variant_n_children (meta_entries);
+  g_print ("Number of parts: %u\n", n_parts);
+
+  for (i = 0; i < n_parts; i++)
+    {
+      guint32 version;
+      guint64 size, usize;
+      g_autoptr(GVariant) objects = NULL;
+
+      g_variant_get_child (meta_entries, i, "(u@aytt@ay)",
+                           &version, NULL, &size, &usize, &objects);
+
+      total_usize += maybe_swap_endian_u64 (byte_swap, usize);
+    }
+
+  return total_usize;
+}
+
+GVariant *
+flatpak_bundle_load (GFile   *file,
+                     char   **commit,
+                     char   **ref,
+                     char   **origin,
+                     char   **runtime_repo,
+                     char   **app_metadata,
+                     guint64 *installed_size,
+                     GBytes **gpg_keys,
+                     char   **collection_id,
+                     GError **error)
+{
+  g_autoptr(GVariant) delta = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autoptr(GBytes) bytes = NULL;
+  g_autoptr(GBytes) copy = NULL;
+  g_autoptr(GVariant) to_csum_v = NULL;
+  guint8 endianness_char;
+  gboolean byte_swap = FALSE;
+
+  GMappedFile *mfile = g_mapped_file_new (flatpak_file_get_path_cached (file), FALSE, error);
+
+  if (mfile == NULL)
+    return NULL;
+
+  bytes = g_mapped_file_get_bytes (mfile);
+  g_mapped_file_unref (mfile);
+
+  delta = g_variant_new_from_bytes (G_VARIANT_TYPE (OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT), bytes, FALSE);
+  g_variant_ref_sink (delta);
+
+  to_csum_v = g_variant_get_child_value (delta, 3);
+  if (!ostree_validate_structureof_csum_v (to_csum_v, error))
+    return NULL;
+
+  metadata = g_variant_get_child_value (delta, 0);
+
+  if (g_variant_lookup (metadata, "ostree.endianness", "y", &endianness_char))
+    {
+      int file_byte_order = G_BYTE_ORDER;
+      switch (endianness_char)
+        {
+        case 'l':
+          file_byte_order = G_LITTLE_ENDIAN;
+          break;
+
+        case 'B':
+          file_byte_order = G_BIG_ENDIAN;
+          break;
+
+        default:
+          break;
+        }
+      byte_swap = (G_BYTE_ORDER != file_byte_order);
+    }
+
+  if (commit)
+    *commit = ostree_checksum_from_bytes_v (to_csum_v);
+
+  if (installed_size)
+    *installed_size = flatpak_bundle_get_installed_size (delta, byte_swap);
+
+  if (ref != NULL)
+    {
+      if (!g_variant_lookup (metadata, "ref", "s", ref))
+        {
+          flatpak_fail (error, "Invalid bundle, no ref in metadata");
+          return NULL;
+        }
+    }
+
+  if (origin != NULL)
+    {
+      if (!g_variant_lookup (metadata, "origin", "s", origin))
+        *origin = NULL;
+    }
+
+  if (runtime_repo != NULL)
+    {
+      if (!g_variant_lookup (metadata, "runtime-repo", "s", runtime_repo))
+        *runtime_repo = NULL;
+    }
+
+  if (collection_id != NULL)
+    {
+#ifdef FLATPAK_ENABLE_P2P
+      if (!g_variant_lookup (metadata, "collection-id", "s", collection_id))
+        *collection_id = NULL;
+#else  /* if !FLATPAK_ENABLE_P2P */
+      *collection_id = NULL;
+#endif  /* !FLATPAK_ENABLE_P2P */
+    }
+
+  if (app_metadata != NULL)
+    {
+      if (!g_variant_lookup (metadata, "metadata", "s", app_metadata))
+        *app_metadata = NULL;
+    }
+
+  if (gpg_keys != NULL)
+    {
+      g_autoptr(GVariant) gpg_value = g_variant_lookup_value (metadata, "gpg-keys",
+                                                              G_VARIANT_TYPE ("ay"));
+      if (gpg_value)
+        {
+          gsize n_elements;
+          const char *data = g_variant_get_fixed_array (gpg_value, &n_elements, 1);
+          *gpg_keys = g_bytes_new (data, n_elements);
+        }
+      else
+        {
+          *gpg_keys = NULL;
+        }
+    }
+
+  /* Make a copy of the data so we can return it after freeing the file */
+  copy = g_bytes_new (g_variant_get_data (metadata),
+                      g_variant_get_size (metadata));
+  return g_variant_ref_sink (g_variant_new_from_bytes (g_variant_get_type (metadata),
+                                                       copy,
+                                                       FALSE));
+}
+
+gboolean
+flatpak_pull_from_bundle (OstreeRepo   *repo,
+                          GFile        *file,
+                          const char   *remote,
+                          const char   *ref,
+                          gboolean      require_gpg_signature,
+                          GCancellable *cancellable,
+                          GError      **error)
+{
+  g_autofree char *metadata_contents = NULL;
+  g_autofree char *to_checksum = NULL;
+
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(GFile) metadata_file = NULL;
+  g_autoptr(GInputStream) in = NULL;
+  g_autoptr(OstreeGpgVerifyResult) gpg_result = NULL;
+  g_autoptr(GError) my_error = NULL;
+  g_autoptr(GVariant) metadata = NULL;
+  gboolean metadata_valid;
+  g_autofree char *remote_collection_id = NULL;
+  g_autofree char *collection_id = NULL;
+
+  metadata = flatpak_bundle_load (file, &to_checksum, NULL, NULL, NULL, &metadata_contents, NULL, NULL, &collection_id, error);
+  if (metadata == NULL)
+    return FALSE;
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (!ostree_repo_get_remote_option (repo, remote, "collection-id", NULL,
+                                      &remote_collection_id, NULL))
+    remote_collection_id = NULL;
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (remote_collection_id != NULL && collection_id != NULL &&
+      strcmp (remote_collection_id, collection_id) != 0)
+    return flatpak_fail (error, "Collection ‘%s’ of bundle doesn’t match collection ‘%s’ of remote",
+                         collection_id, remote_collection_id);
+
+  if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+    return FALSE;
+
+  /* Don’t need to set the collection ID here, since the remote binds this ref to the collection. */
+  ostree_repo_transaction_set_ref (repo, remote, ref, to_checksum);
+
+  if (!ostree_repo_static_delta_execute_offline (repo,
+                                                 file,
+                                                 FALSE,
+                                                 cancellable,
+                                                 error))
+    return FALSE;
+
+  gpg_result = ostree_repo_verify_commit_ext (repo, to_checksum,
+                                              NULL, NULL, cancellable, &my_error);
+  if (gpg_result == NULL)
+    {
+      /* no gpg signature, we ignore this *if* there is no gpg key
+       * specified in the bundle or by the user */
+      if (g_error_matches (my_error, OSTREE_GPG_ERROR, OSTREE_GPG_ERROR_NO_SIGNATURE) &&
+          !require_gpg_signature)
+        {
+          g_clear_error (&my_error);
+        }
+      else
+        {
+          g_propagate_error (error, g_steal_pointer (&my_error));
+          return FALSE;
+        }
+    }
+  else
+    {
+      /* If there is no valid gpg signature we fail, unless there is no gpg
+         key specified (on the command line or in the file) because then we
+         trust the source bundle. */
+      if (ostree_gpg_verify_result_count_valid (gpg_result) == 0  &&
+          require_gpg_signature)
+        return flatpak_fail (error, "GPG signatures found, but none are in trusted keyring");
+    }
+
+  if (!ostree_repo_read_commit (repo, to_checksum, &root, NULL, NULL, error))
+    return FALSE;
+
+  if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
+    return FALSE;
+
+  /* We ensure that the actual installed metadata matches the one in the
+     header, because you may have made decisions on whether to install it or not
+     based on that data. */
+  metadata_file = g_file_resolve_relative_path (root, "metadata");
+  in = (GInputStream *) g_file_read (metadata_file, cancellable, NULL);
+  if (in != NULL)
+    {
+      g_autoptr(GMemoryOutputStream) data_stream = (GMemoryOutputStream *) g_memory_output_stream_new_resizable ();
+
+      if (g_output_stream_splice (G_OUTPUT_STREAM (data_stream), in,
+                                  G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+                                  cancellable, error) < 0)
+        return FALSE;
+
+      /* Null terminate */
+      g_output_stream_write (G_OUTPUT_STREAM (data_stream), "\0", 1, NULL, NULL);
+
+      metadata_valid =
+        metadata_contents != NULL &&
+        strcmp (metadata_contents, g_memory_output_stream_get_data (data_stream)) == 0;
+    }
+  else
+    {
+      metadata_valid = (metadata_contents == NULL);
+    }
+
+  if (!metadata_valid)
+    {
+      /* Immediately remove this broken commit */
+      ostree_repo_set_ref_immediate (repo, remote, ref, NULL, cancellable, error);
+      return flatpak_fail (error, "Metadata in header and app are inconsistent");
+    }
+
+  return TRUE;
+}
+
+typedef struct {
+  FlatpakOciPullProgress progress_cb;
+  gpointer progress_user_data;
+  guint64 total_size;
+  guint64 previous_layers_size;
+  guint32 n_layers;
+  guint32 pulled_layers;
+} FlatpakOciPullProgressData;
+
+static void
+oci_layer_progress (guint64 downloaded_bytes,
+                    gpointer user_data)
+{
+  FlatpakOciPullProgressData *progress_data = user_data;
+
+  if (progress_data->progress_cb)
+    progress_data->progress_cb (progress_data->total_size, progress_data->previous_layers_size + downloaded_bytes,
+                                progress_data->n_layers, progress_data->pulled_layers,
+                                progress_data->progress_user_data);
+}
+
+gboolean
+flatpak_mirror_image_from_oci (FlatpakOciRegistry *dst_registry,
+                               FlatpakOciRegistry *registry,
+                              const char *oci_repository,
+                               const char *digest,
+                               FlatpakOciPullProgress progress_cb,
+                               gpointer progress_user_data,
+                               GCancellable *cancellable,
+                               GError      **error)
+{
+  FlatpakOciPullProgressData progress_data = { progress_cb, progress_user_data };
+  g_autoptr(FlatpakOciVersioned) versioned = NULL;
+  FlatpakOciManifest *manifest = NULL;
+  g_autoptr(FlatpakOciDescriptor) manifest_desc = NULL;
+  gsize versioned_size;
+  g_autoptr(FlatpakOciIndex) index = NULL;
+  int i;
+
+  if (!flatpak_oci_registry_mirror_blob (dst_registry, registry, oci_repository, TRUE, digest, NULL, NULL, cancellable, error))
+    return FALSE;
+
+  versioned = flatpak_oci_registry_load_versioned (dst_registry, NULL, digest, &versioned_size, cancellable, error);
+  if (versioned == NULL)
+    return FALSE;
+
+  if (!FLATPAK_IS_OCI_MANIFEST (versioned))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Image is not a manifest");
+      return FALSE;
+    }
+
+  manifest = FLATPAK_OCI_MANIFEST (versioned);
+
+  if (manifest->config.digest != NULL)
+    {
+      if (!flatpak_oci_registry_mirror_blob (dst_registry, registry, oci_repository, FALSE, manifest->config.digest, NULL, NULL, cancellable, error))
+        return FALSE;
+    }
+
+  for (i = 0; manifest->layers[i] != NULL; i++)
+    {
+      FlatpakOciDescriptor *layer = manifest->layers[i];
+      progress_data.total_size += layer->size;
+      progress_data.n_layers++;
+    }
+
+  if (progress_cb)
+    progress_cb (progress_data.total_size, 0,
+                 progress_data.n_layers, progress_data.pulled_layers,
+                 progress_user_data);
+
+  for (i = 0; manifest->layers[i] != NULL; i++)
+    {
+      FlatpakOciDescriptor *layer = manifest->layers[i];
+
+      if (!flatpak_oci_registry_mirror_blob (dst_registry, registry, oci_repository, FALSE, layer->digest,
+                                             oci_layer_progress, &progress_data,
+                                             cancellable, error))
+        return FALSE;
+
+      progress_data.pulled_layers++;
+      progress_data.previous_layers_size += layer->size;
+    }
+
+
+  index = flatpak_oci_registry_load_index (dst_registry, NULL, NULL, NULL, NULL);
+  if (index == NULL)
+    index = flatpak_oci_index_new ();
+
+  manifest_desc = flatpak_oci_descriptor_new (versioned->mediatype, digest, versioned_size);
+
+  flatpak_oci_export_annotations (manifest->annotations, manifest_desc->annotations);
+
+  flatpak_oci_index_add_manifest (index, manifest_desc);
+
+  if (!flatpak_oci_registry_save_index (dst_registry, index, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+
+char *
+flatpak_pull_from_oci (OstreeRepo   *repo,
+                       FlatpakOciRegistry *registry,
+                       const char *oci_repository,
+                       const char *digest,
+                       FlatpakOciManifest *manifest,
+                       const char *remote,
+                       const char *ref,
+                       FlatpakOciPullProgress progress_cb,
+                       gpointer progress_user_data,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  g_autoptr(OstreeMutableTree) archive_mtree = NULL;
+  g_autoptr(GFile) archive_root = NULL;
+  g_autofree char *commit_checksum = NULL;
+  const char *parent = NULL;
+  g_autofree char *subject = NULL;
+  g_autofree char *body = NULL;
+  g_autofree char *manifest_ref = NULL;
+  g_autofree char *full_ref = NULL;
+  guint64 timestamp = 0;
+  FlatpakOciPullProgressData progress_data = { progress_cb, progress_user_data };
+  g_autoptr(GVariantBuilder) metadata_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+  g_autoptr(GVariant) metadata = NULL;
+  GHashTable *annotations;
+  int i;
+
+  g_assert (ref != NULL);
+  g_assert (g_str_has_prefix (digest, "sha256:"));
+
+  annotations = flatpak_oci_manifest_get_annotations (manifest);
+  if (annotations)
+    flatpak_oci_parse_commit_annotations (annotations, &timestamp,
+                                          &subject, &body,
+                                          &manifest_ref, NULL, NULL,
+                                          metadata_builder);
+  if (manifest_ref == NULL)
+    {
+      flatpak_fail (error, "No ref specified for OCI image %s\n", digest);
+      return NULL;
+    }
+
+  if (strcmp (manifest_ref, ref) != 0)
+    {
+      flatpak_fail (error, "Wrong ref (%s) specified for OCI image %s, expected %s\n", manifest_ref, digest, ref);
+      return NULL;
+    }
+
+  g_variant_builder_add (metadata_builder, "{s@v}", "xa.alt-id",
+                         g_variant_new_variant (g_variant_new_string (digest + strlen("sha256:"))));
+
+  if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+    return NULL;
+
+  /* There is no way to write a subset of the archive to a mtree, so instead
+     we write all of it and then build a new mtree with the subset */
+  archive_mtree = ostree_mutable_tree_new ();
+
+  for (i = 0; manifest->layers[i] != NULL; i++)
+    {
+      FlatpakOciDescriptor *layer = manifest->layers[i];
+      progress_data.total_size += layer->size;
+      progress_data.n_layers++;
+    }
+
+  if (progress_cb)
+    progress_cb (progress_data.total_size, 0,
+                 progress_data.n_layers, progress_data.pulled_layers,
+                 progress_user_data);
+
+  for (i = 0; manifest->layers[i] != NULL; i++)
+    {
+      FlatpakOciDescriptor *layer = manifest->layers[i];
+      OstreeRepoImportArchiveOptions opts = { 0, };
+      g_autoptr(FlatpakAutoArchiveRead) a = NULL;
+      glnx_autofd int layer_fd = -1;
+      g_autoptr(GChecksum) checksum = g_checksum_new (G_CHECKSUM_SHA256);
+      const char *layer_checksum;
+
+      opts.autocreate_parents = TRUE;
+      opts.ignore_unsupported_content = TRUE;
+
+      layer_fd = flatpak_oci_registry_download_blob (registry, oci_repository, FALSE,
+                                                    layer->digest,
+                                                     oci_layer_progress, &progress_data,
+                                                     cancellable, error);
+      if (layer_fd == -1)
+        goto error;
+
+      a = archive_read_new ();
+#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
+      archive_read_support_filter_all (a);
+#else
+      archive_read_support_compression_all (a);
+#endif
+      archive_read_support_format_all (a);
+
+      if (!flatpak_archive_read_open_fd_with_checksum (a, layer_fd, checksum, error))
+        goto error;
+
+      if (!ostree_repo_import_archive_to_mtree (repo, &opts, a, archive_mtree, NULL, cancellable, error))
+        goto error;
+
+      if (archive_read_close (a) != ARCHIVE_OK)
+        {
+          propagate_libarchive_error (error, a);
+          goto error;
+        }
+
+      layer_checksum = g_checksum_get_string (checksum);
+      if (!g_str_has_prefix (layer->digest, "sha256:") ||
+          strcmp (layer->digest + strlen ("sha256:"), layer_checksum) != 0)
+        {
+          flatpak_fail (error, "Wrong layer checksum, expected %s, was %s\n", layer->digest, layer_checksum);
+          goto error;
+        }
+
+      progress_data.pulled_layers++;
+      progress_data.previous_layers_size += layer->size;
+    }
+
+  if (!ostree_repo_write_mtree (repo, archive_mtree, &archive_root, cancellable, error))
+    goto error;
+
+  if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile *) archive_root, error))
+    goto error;
+
+  metadata = g_variant_ref_sink (g_variant_builder_end (metadata_builder));
+  if (!ostree_repo_write_commit_with_time (repo,
+                                           parent,
+                                           subject,
+                                           body,
+                                           metadata,
+                                           OSTREE_REPO_FILE (archive_root),
+                                           timestamp,
+                                           &commit_checksum,
+                                           cancellable, error))
+    goto error;
+
+  if (remote)
+    full_ref = g_strdup_printf ("%s:%s", remote, ref);
+  else
+    full_ref = g_strdup (ref);
+
+  /* Don’t need to set the collection ID here, since the ref is bound to a
+   * collection via its remote. */
+  ostree_repo_transaction_set_ref (repo, NULL, full_ref, commit_checksum);
+
+  if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
+    return NULL;
+
+  return g_steal_pointer (&commit_checksum);
+
+ error:
+
+  ostree_repo_abort_transaction (repo, cancellable, NULL);
+  return NULL;
+}
+
+/* This allocates and locks a subdir of the tmp dir, using an existing
+ * one with the same prefix if it is not in use already. */
+gboolean
+flatpak_allocate_tmpdir (int           tmpdir_dfd,
+                         const char   *tmpdir_relpath,
+                         const char   *tmpdir_prefix,
+                         char        **tmpdir_name_out,
+                         int          *tmpdir_fd_out,
+                         GLnxLockFile *file_lock_out,
+                         gboolean     *reusing_dir_out,
+                         GCancellable *cancellable,
+                         GError      **error)
+{
+  gboolean reusing_dir = FALSE;
+  g_autofree char *tmpdir_name = NULL;
+  glnx_autofd int tmpdir_fd = -1;
+
+  g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
+
+  /* Look for existing tmpdir (with same prefix) to reuse */
+  if (!glnx_dirfd_iterator_init_at (tmpdir_dfd, tmpdir_relpath ? tmpdir_relpath : ".", FALSE, &dfd_iter, error))
+    return FALSE;
+
+  while (tmpdir_name == NULL)
+    {
+      struct dirent *dent;
+      glnx_autofd int existing_tmpdir_fd = -1;
+      g_autoptr(GError) local_error = NULL;
+      g_autofree char *lock_name = NULL;
+
+      if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
+        return FALSE;
+
+      if (dent == NULL)
+        break;
+
+      if (!g_str_has_prefix (dent->d_name, tmpdir_prefix))
+        continue;
+
+      /* Quickly skip non-dirs, if unknown we ignore ENOTDIR when opening instead */
+      if (dent->d_type != DT_UNKNOWN &&
+          dent->d_type != DT_DIR)
+        continue;
+
+      if (!glnx_opendirat (dfd_iter.fd, dent->d_name, FALSE,
+                           &existing_tmpdir_fd, &local_error))
+        {
+          if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY))
+            {
+              continue;
+            }
+          else
+            {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              return FALSE;
+            }
+        }
+
+      lock_name = g_strconcat (dent->d_name, "-lock", NULL);
+
+      /* We put the lock outside the dir, so we can hold the lock
+       * until the directory is fully removed */
+      if (!glnx_make_lock_file (dfd_iter.fd, lock_name, LOCK_EX | LOCK_NB,
+                                file_lock_out, &local_error))
+        {
+          if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+            {
+              continue;
+            }
+          else
+            {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              return FALSE;
+            }
+        }
+
+      /* Touch the reused directory so that we don't accidentally
+       *   remove it due to being old when cleaning up the tmpdir
+       */
+      (void) futimens (existing_tmpdir_fd, NULL);
+
+      /* We found an existing tmpdir which we managed to lock */
+      tmpdir_name = g_strdup (dent->d_name);
+      tmpdir_fd = glnx_steal_fd (&existing_tmpdir_fd);
+      reusing_dir = TRUE;
+    }
+
+  while (tmpdir_name == NULL)
+    {
+      g_autofree char *tmpdir_name_template = g_strconcat (tmpdir_prefix, "XXXXXX", NULL);
+      g_autoptr(GError) local_error = NULL;
+      g_autofree char *lock_name = NULL;
+      g_auto(GLnxTmpDir) new_tmpdir = { 0, };
+      /* No existing tmpdir found, create a new */
+
+      if (!glnx_mkdtempat (dfd_iter.fd, tmpdir_name_template, 0777,
+                           &new_tmpdir, error))
+        return FALSE;
+
+      lock_name = g_strconcat (new_tmpdir.path, "-lock", NULL);
+
+      /* Note, at this point we can race with another process that picks up this
+       * new directory. If that happens we need to retry, making a new directory. */
+      if (!glnx_make_lock_file (dfd_iter.fd, lock_name, LOCK_EX | LOCK_NB,
+                                file_lock_out, &local_error))
+        {
+          if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+            {
+              glnx_tmpdir_unset (&new_tmpdir); /* Don't delete */
+              continue;
+            }
+          else
+            {
+              g_propagate_error (error, g_steal_pointer (&local_error));
+              return FALSE;
+            }
+        }
+
+      tmpdir_name = g_strdup (new_tmpdir.path);
+      tmpdir_fd = dup (new_tmpdir.fd);
+      glnx_tmpdir_unset (&new_tmpdir); /* Don't delete */
+    }
+
+  if (tmpdir_name_out)
+    *tmpdir_name_out = g_steal_pointer (&tmpdir_name);
+
+  if (tmpdir_fd_out)
+    *tmpdir_fd_out = glnx_steal_fd (&tmpdir_fd);
+
+  if (reusing_dir_out)
+    *reusing_dir_out = reusing_dir;
+
+  return TRUE;
+}
+
+gboolean
+flatpak_yes_no_prompt (const char *prompt, ...)
+{
+  char buf[512];
+  va_list var_args;
+  gchar *s;
+
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+  va_start (var_args, prompt);
+  s = g_strdup_vprintf (prompt, var_args);
+  va_end (var_args);
+#pragma GCC diagnostic pop
+
+  while (TRUE)
+    {
+      g_print ("%s %s: ", s, "[y/n]");
+
+      if (!isatty (STDIN_FILENO) || !isatty (STDOUT_FILENO))
+        {
+          g_print ("n\n");
+          return FALSE;
+        }
+
+      if (fgets (buf, sizeof (buf), stdin) == NULL)
+        return FALSE;
+
+      g_strstrip (buf);
+      if (g_ascii_strcasecmp  (buf, "y") == 0 ||
+          g_ascii_strcasecmp  (buf, "yes") == 0)
+        return TRUE;
+
+      if (g_ascii_strcasecmp  (buf, "n") == 0 ||
+          g_ascii_strcasecmp  (buf, "no") == 0)
+        return FALSE;
+    }
+}
+
+static gboolean
+is_number (const char *s)
+{
+  if (*s == '\0')
+    return FALSE;
+
+  while (*s != 0)
+    {
+      if (!g_ascii_isdigit (*s))
+        return FALSE;
+      s++;
+    }
+
+  return TRUE;
+}
+
+long
+flatpak_number_prompt (int min, int max, const char *prompt, ...)
+{
+  char buf[512];
+  va_list var_args;
+  g_autofree char *s = NULL;
+
+  va_start (var_args, prompt);
+  s = g_strdup_vprintf (prompt, var_args);
+  va_end (var_args);
+
+  while (TRUE)
+    {
+      g_print ("%s [%d-%d]: ", s, min, max);
+
+      if (!isatty (STDIN_FILENO) || !isatty (STDOUT_FILENO))
+        {
+          g_print ("0\n");
+          return 0;
+        }
+
+      if (fgets (buf, sizeof (buf), stdin) == NULL)
+        return 0;
+
+      g_strstrip (buf);
+
+      if (is_number (buf))
+        {
+          long res = strtol (buf, NULL, 10);
+
+          if (res >= min && res <= max)
+            return res;
+        }
+    }
+}
+
+
+typedef struct {
+  GMainLoop *loop;
+  GError *error;
+  GOutputStream *out;
+  guint64 downloaded_bytes;
+  GString *content;
+  char buffer[16*1024];
+  FlatpakLoadUriProgress progress;
+  GCancellable *cancellable;
+  gpointer user_data;
+  guint64 last_progress_time;
+  char *etag;
+} LoadUriData;
+
+static void
+stream_closed (GObject *source, GAsyncResult *res, gpointer user_data)
+{
+  LoadUriData *data = user_data;
+  GInputStream *stream = G_INPUT_STREAM (source);
+  g_autoptr(GError) error = NULL;
+
+  if (!g_input_stream_close_finish (stream, res, &error))
+    g_warning ("Error closing http stream: %s", error->message);
+
+  g_main_loop_quit (data->loop);
+}
+
+static void
+load_uri_read_cb (GObject *source, GAsyncResult *res, gpointer user_data)
+{
+  LoadUriData *data = user_data;
+  GInputStream *stream = G_INPUT_STREAM (source);
+  gsize nread;
+
+  nread = g_input_stream_read_finish (stream, res, &data->error);
+  if (nread == -1 || nread == 0)
+    {
+      if (data->progress)
+        data->progress (data->downloaded_bytes, data->user_data);
+      g_input_stream_close_async (stream,
+                                  G_PRIORITY_DEFAULT, NULL,
+                                  stream_closed, data);
+      return;
+    }
+
+  if (data->out != NULL)
+    {
+      gsize n_written;
+
+      if (!g_output_stream_write_all (data->out, data->buffer, nread, &n_written,
+                                      NULL, &data->error))
+        {
+          data->downloaded_bytes += n_written;
+          g_input_stream_close_async (stream,
+                                      G_PRIORITY_DEFAULT, NULL,
+                                      stream_closed, data);
+          return;
+        }
+
+      data->downloaded_bytes += n_written;
+    }
+  else
+    {
+      data->downloaded_bytes += nread;
+      g_string_append_len (data->content, data->buffer, nread);
+    }
+
+  if (g_get_monotonic_time () - data->last_progress_time > 1 * G_USEC_PER_SEC)
+    {
+      if (data->progress)
+        data->progress (data->downloaded_bytes, data->user_data);
+      data->last_progress_time = g_get_monotonic_time ();
+    }
+
+  g_input_stream_read_async (stream, data->buffer, sizeof (data->buffer),
+                             G_PRIORITY_DEFAULT, data->cancellable,
+                             load_uri_read_cb, data);
+}
+
+static void
+load_uri_callback (GObject *source_object,
+                   GAsyncResult *res,
+                   gpointer user_data)
+{
+  SoupRequestHTTP *request = SOUP_REQUEST_HTTP(source_object);
+  g_autoptr(GInputStream) in = NULL;
+  LoadUriData *data = user_data;
+
+  in = soup_request_send_finish (SOUP_REQUEST (request), res, &data->error);
+  if (in == NULL)
+    {
+      g_main_loop_quit (data->loop);
+      return;
+    }
+
+  g_autoptr(SoupMessage) msg = soup_request_http_get_message ((SoupRequestHTTP*) request);
+  if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
+    {
+      int code;
+      GQuark domain = G_IO_ERROR;
+
+      switch (msg->status_code)
+        {
+        case 304:
+          domain = FLATPAK_OCI_ERROR;
+          code = FLATPAK_OCI_ERROR_NOT_CHANGED;
+          break;
+        case 404:
+        case 410:
+          code = G_IO_ERROR_NOT_FOUND;
+          break;
+        default:
+          code = G_IO_ERROR_FAILED;
+        }
+
+      data->error = g_error_new (domain, code,
+                                 "Server returned status %u: %s",
+                                 msg->status_code,
+                                 soup_status_get_phrase (msg->status_code));
+      g_main_loop_quit (data->loop);
+      return;
+    }
+
+  data->etag = g_strdup (soup_message_headers_get_one (msg->response_headers, "ETag"));
+
+  g_input_stream_read_async (in, data->buffer, sizeof (data->buffer),
+                             G_PRIORITY_DEFAULT, data->cancellable,
+                             load_uri_read_cb, data);
+}
+
+SoupSession *
+flatpak_create_soup_session (const char *user_agent)
+{
+  SoupSession *soup_session;
+  const char *http_proxy;
+
+  soup_session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, user_agent,
+                                                SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
+                                                SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
+                                                SOUP_SESSION_TIMEOUT, 60,
+                                                SOUP_SESSION_IDLE_TIMEOUT, 60,
+                                                NULL);
+  soup_session_remove_feature_by_type (soup_session, SOUP_TYPE_CONTENT_DECODER);
+  http_proxy = g_getenv ("http_proxy");
+  if (http_proxy)
+    {
+      g_autoptr(SoupURI) proxy_uri = soup_uri_new (http_proxy);
+      if (!proxy_uri)
+        g_warning ("Invalid proxy URI '%s'", http_proxy);
+      else
+        g_object_set (soup_session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
+    }
+
+  return soup_session;
+}
+
+GBytes *
+flatpak_load_http_uri (SoupSession *soup_session,
+                       const char *uri,
+                      FlatpakHTTPFlags flags,
+                       const char *etag,
+                       char      **out_etag,
+                       FlatpakLoadUriProgress progress,
+                       gpointer      user_data,
+                       GCancellable *cancellable,
+                       GError      **error)
+{
+  GBytes *bytes = NULL;
+  g_autoptr(GMainContext) context = NULL;
+  g_autoptr(SoupRequestHTTP) request = NULL;
+  g_autoptr(GMainLoop) loop = NULL;
+  g_autoptr(GString) content = g_string_new ("");
+  LoadUriData data = { NULL };
+  SoupMessage *m;
+
+  g_debug ("Loading %s using libsoup", uri);
+
+  context = g_main_context_ref_thread_default ();
+
+  loop = g_main_loop_new (context, TRUE);
+  data.loop = loop;
+  data.content = content;
+  data.progress = progress;
+  data.cancellable = cancellable;
+  data.user_data = user_data;
+  data.last_progress_time = g_get_monotonic_time ();
+
+  request = soup_session_request_http (soup_session, "GET",
+                                       uri, error);
+  if (request == NULL)
+    return NULL;
+
+  m = soup_request_http_get_message (request);
+  if (etag)
+    soup_message_headers_replace (m->request_headers, "If-None-Match", etag);
+
+  if (flags & FLATPAK_HTTP_FLAGS_ACCEPT_OCI)
+    soup_message_headers_replace (m->request_headers, "Accept",
+                                 "application/vnd.oci.image.manifest.v1+json");
+
+  soup_request_send_async (SOUP_REQUEST(request),
+                           cancellable,
+                           load_uri_callback, &data);
+
+  g_main_loop_run (loop);
+
+  if (data.error)
+    {
+      g_propagate_error (error, data.error);
+      g_free (data.etag);
+      return NULL;
+    }
+
+  bytes = g_string_free_to_bytes (g_steal_pointer (&content));
+  g_debug ("Received %" G_GUINT64_FORMAT " bytes", data.downloaded_bytes);
+
+  if (out_etag)
+    *out_etag = g_steal_pointer (&data.etag);
+
+  g_free (data.etag);
+
+  return bytes;
+}
+
+gboolean
+flatpak_download_http_uri (SoupSession *soup_session,
+                           const char   *uri,
+                          FlatpakHTTPFlags flags,
+                           GOutputStream *out,
+                           FlatpakLoadUriProgress progress,
+                           gpointer      user_data,
+                           GCancellable *cancellable,
+                           GError      **error)
+{
+  g_autoptr(SoupRequestHTTP) request = NULL;
+  g_autoptr(GMainLoop) loop = NULL;
+  g_autoptr(GMainContext) context = NULL;
+  LoadUriData data = { NULL };
+  SoupMessage *m;
+
+  g_debug ("Loading %s using libsoup", uri);
+
+  context = g_main_context_ref_thread_default ();
+
+  loop = g_main_loop_new (context, TRUE);
+  data.loop = loop;
+  data.out = out;
+  data.progress = progress;
+  data.cancellable = cancellable;
+  data.user_data = user_data;
+  data.last_progress_time = g_get_monotonic_time ();
+
+  request = soup_session_request_http (soup_session, "GET",
+                                       uri, error);
+  if (request == NULL)
+    return FALSE;
+
+  m = soup_request_http_get_message (request);
+  if (flags & FLATPAK_HTTP_FLAGS_ACCEPT_OCI)
+    soup_message_headers_replace (m->request_headers, "Accept",
+                                 "application/vnd.oci.image.manifest.v1+json");
+
+  soup_request_send_async (SOUP_REQUEST(request),
+                           cancellable,
+                           load_uri_callback, &data);
+
+  g_main_loop_run (loop);
+
+  if (data.error)
+    {
+      g_propagate_error (error, data.error);
+      return FALSE;
+    }
+
+  g_debug ("Received %" G_GUINT64_FORMAT " bytes", data.downloaded_bytes);
+
+  return TRUE;
+}
+
+/* Uncomment to get debug traces in /tmp/flatpak-completion-debug.txt (nice
+ * to not have it interfere with stdout/stderr)
+ */
+#if 0
+void
+flatpak_completion_debug (const gchar *format, ...)
+{
+  va_list var_args;
+  gchar *s;
+  static FILE *f = NULL;
+
+  va_start (var_args, format);
+  s = g_strdup_vprintf (format, var_args);
+  if (f == NULL)
+    f = fopen ("/tmp/flatpak-completion-debug.txt", "a+");
+  fprintf (f, "%s\n", s);
+  fflush (f);
+  g_free (s);
+}
+#else
+void
+flatpak_completion_debug (const gchar *format, ...)
+{
+}
+#endif
+
+static gboolean
+is_word_separator (char c)
+{
+  return g_ascii_isspace (c);
+}
+
+void
+flatpak_complete_file (FlatpakCompletion *completion,
+                       const char        *file_type)
+{
+  flatpak_completion_debug ("completing FILE");
+  g_print ("%s\n", file_type);
+}
+
+void
+flatpak_complete_dir (FlatpakCompletion *completion)
+{
+  flatpak_completion_debug ("completing DIR");
+  g_print ("%s\n", "__FLATPAK_DIR");
+}
+
+void
+flatpak_complete_word (FlatpakCompletion *completion,
+                       char *format, ...)
+{
+  va_list args;
+  const char *rest;
+  const char *shell_cur;
+  const char *shell_cur_end;
+  g_autofree char *string = NULL;
+
+  g_return_if_fail (format != NULL);
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+  va_start (args, format);
+  string = g_strdup_vprintf (format, args);
+  va_end (args);
+#pragma GCC diagnostic pop
+
+  if (!g_str_has_prefix (string, completion->cur))
+    return;
+
+  shell_cur = completion->shell_cur ? completion->shell_cur : "";
+
+  rest = string + strlen (completion->cur);
+
+  shell_cur_end = shell_cur + strlen(shell_cur);
+  while (shell_cur_end > shell_cur &&
+         rest > string &&
+         shell_cur_end[-1] == rest[-1] &&
+         /* I'm not sure exactly what bash is doing here with =, but this seems to work... */
+         shell_cur_end[-1] != '=')
+    {
+      rest--;
+      shell_cur_end--;
+    }
+
+  flatpak_completion_debug ("completing word: '%s' (%s)", string, rest);
+
+  g_print ("%s\n", rest);
+}
+
+void
+flatpak_complete_ref (FlatpakCompletion *completion,
+                      OstreeRepo *repo)
+{
+  g_autoptr(GHashTable) refs = NULL;
+  flatpak_completion_debug ("completing REF");
+
+  if (ostree_repo_list_refs (repo,
+                             NULL,
+                             &refs, NULL, NULL))
+    {
+      GHashTableIter hashiter;
+      gpointer hashkey, hashvalue;
+
+      g_hash_table_iter_init (&hashiter, refs);
+      while ((g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue)))
+        {
+          const char *ref = (const char *)hashkey;
+          if (!(g_str_has_prefix (ref, "runtime/") ||
+                g_str_has_prefix (ref, "app/")))
+            continue;
+          flatpak_complete_word (completion, "%s", ref);
+        }
+    }
+}
+
+static int
+find_current_element (const char *str)
+{
+  int count = 0;
+
+  if (g_str_has_prefix (str, "app/"))
+    str += strlen ("app/");
+  else if (g_str_has_prefix (str, "runtime/"))
+    str += strlen ("runtime/");
+
+  while (str != NULL && count <= 3)
+    {
+      str = strchr (str, '/');
+      count++;
+      if (str != NULL)
+        str = str + 1;
+    }
+
+  return count;
+}
+
+void
+flatpak_complete_partial_ref (FlatpakCompletion *completion,
+                              FlatpakKinds kinds,
+                              const char *only_arch,
+                              FlatpakDir *dir,
+                              const char *remote)
+{
+  FlatpakKinds matched_kinds;
+  const char *pref;
+  g_autofree char *id = NULL;
+  g_autofree char *arch = NULL;
+  g_autofree char *branch = NULL;
+  g_auto(GStrv) refs = NULL;
+  int element;
+  const char *cur_parts[4] = { NULL };
+  g_autoptr(GError) error = NULL;
+  int i;
+
+  pref = completion->cur;
+  element = find_current_element (pref);
+
+  flatpak_split_partial_ref_arg_novalidate (pref, kinds,
+                                            NULL, NULL,
+                                            &matched_kinds, &id, &arch, &branch);
+
+  cur_parts[1] = id;
+  cur_parts[2] = arch ? arch : "";
+  cur_parts[3] = branch ? branch : "";
+
+  if (remote)
+    {
+      refs = flatpak_dir_find_remote_refs (dir, completion->argv[1],
+                                           (element > 1) ? id : NULL,
+                                           (element > 3) ? branch : NULL,
+                                           (element > 2 )? arch : only_arch,
+                                           matched_kinds, NULL, &error);
+    }
+  else
+    {
+      refs = flatpak_dir_find_installed_refs (dir,
+                                              (element > 1) ? id : NULL,
+                                              (element > 3) ? branch : NULL,
+                                              (element > 2 )? arch : only_arch,
+                                              matched_kinds, &error);
+    }
+  if (refs == NULL)
+    flatpak_completion_debug ("find refs error: %s", error->message);
+  for (i = 0; refs != NULL && refs[i] != NULL; i++)
+    {
+      int j;
+      g_autoptr(GString) comp = NULL;
+      g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL);
+      if (parts == NULL)
+        continue;
+
+      if (!g_str_has_prefix (parts[element], cur_parts[element]))
+        continue;
+
+      comp = g_string_new (pref);
+      g_string_append (comp, parts[element] + strlen (cur_parts[element]));
+
+      /* Only complete on the last part if the user explicitly adds a / */
+      if (element >= 2)
+        {
+          for (j = element + 1; j < 4; j++)
+            {
+              g_string_append (comp, "/");
+              g_string_append (comp, parts[j]);
+            }
+        }
+
+      flatpak_complete_word (completion, "%s", comp->str);
+    }
+}
+
+static gboolean
+switch_already_in_line (FlatpakCompletion *completion,
+                        GOptionEntry      *entry)
+{
+  guint i = 0;
+  guint line_part_len = 0;
+
+  for (; i < completion->original_argc; ++i)
+    {
+      line_part_len = strlen (completion->original_argv[i]);
+      if (line_part_len > 2 &&
+          g_strcmp0 (&completion->original_argv[i][2], entry->long_name) == 0)
+        return TRUE;
+
+      if (line_part_len == 2 &&
+          completion->original_argv[i][1] == entry->short_name)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+should_filter_out_option_from_completion (FlatpakCompletion *completion,
+                                          GOptionEntry      *entry)
+{
+  switch (entry->arg)
+    {
+      case G_OPTION_ARG_NONE:
+      case G_OPTION_ARG_STRING:
+      case G_OPTION_ARG_INT:
+      case G_OPTION_ARG_FILENAME:
+      case G_OPTION_ARG_DOUBLE:
+      case G_OPTION_ARG_INT64:
+        return switch_already_in_line (completion, entry);
+      default:
+        return FALSE;
+    }
+}
+
+void
+flatpak_complete_options (FlatpakCompletion *completion,
+                          GOptionEntry *entries)
+{
+  GOptionEntry *e = entries;
+  int i;
+
+  while (e->long_name != NULL)
+    {
+      if (e->arg_description)
+        {
+          g_autofree char *prefix = g_strdup_printf ("--%s=", e->long_name);
+
+          if (g_str_has_prefix (completion->cur, prefix))
+            {
+              if (strcmp (e->arg_description, "ARCH") == 0)
+                {
+                  const char *arches[] = {"i386", "x86_64", "aarch64", "arm"};
+                  for (i = 0; i < G_N_ELEMENTS (arches); i++)
+                    flatpak_complete_word (completion, "%s%s ", prefix, arches[i]);
+                }
+              else if (strcmp (e->arg_description, "SHARE") == 0)
+                {
+                  for (i = 0; flatpak_context_shares[i] != NULL; i++)
+                    flatpak_complete_word (completion, "%s%s ", prefix, flatpak_context_shares[i]);
+                }
+              else if (strcmp (e->arg_description, "DEVICE") == 0)
+                {
+                  for (i = 0; flatpak_context_devices[i] != NULL; i++)
+                    flatpak_complete_word (completion, "%s%s ", prefix, flatpak_context_devices[i]);
+                }
+              else if (strcmp (e->arg_description, "FEATURE") == 0)
+                {
+                  for (i = 0; flatpak_context_features[i] != NULL; i++)
+                    flatpak_complete_word (completion, "%s%s ", prefix, flatpak_context_features[i]);
+                }
+              else if (strcmp (e->arg_description, "SOCKET") == 0)
+                {
+                  for (i = 0; flatpak_context_sockets[i] != NULL; i++)
+                    flatpak_complete_word (completion, "%s%s ", prefix, flatpak_context_sockets[i]);
+                }
+              else if (strcmp (e->arg_description, "FILE") == 0)
+                {
+                  flatpak_complete_file (completion, "__FLATPAK_FILE");
+                }
+              else
+                flatpak_complete_word (completion, "%s", prefix);
+            }
+          else
+            flatpak_complete_word (completion, "%s", prefix);
+        }
+      else
+        {
+          /* If this is just a switch, then don't add it multiple
+           * times */
+          if (!should_filter_out_option_from_completion (completion, e)) {
+            flatpak_complete_word (completion, "--%s ", e->long_name);
+          }  else {
+            flatpak_completion_debug ("switch --%s is already in line %s", e->long_name, completion->line);
+          }
+        }
+
+      /* We may end up checking switch_already_in_line twice, but this is
+       * for simplicity's sake - the alternative solution would be to
+       * continue the loop early and have to increment e. */
+      if (e->short_name != 0)
+        {
+          /* This is a switch, we may not want to add it */
+          if (!e->arg_description)
+            {
+              if (!should_filter_out_option_from_completion (completion, e)) {
+                flatpak_complete_word (completion, "-%c ", e->short_name);
+              } else {
+                flatpak_completion_debug ("switch -%c is already in line %s", e->short_name, completion->line);
+              }
+            }
+          else
+            {
+              flatpak_complete_word (completion, "-%c ", e->short_name);
+            }
+        }
+      e++;
+    }
+}
+
+static gchar *
+pick_word_at (const char  *s,
+              int          cursor,
+              int         *out_word_begins_at)
+{
+  int begin, end;
+
+  if (s[0] == '\0')
+    {
+      if (out_word_begins_at != NULL)
+        *out_word_begins_at = -1;
+      return NULL;
+    }
+
+  if (is_word_separator (s[cursor]) && ((cursor > 0 && is_word_separator(s[cursor-1])) || cursor == 0))
+    {
+      if (out_word_begins_at != NULL)
+        *out_word_begins_at = cursor;
+      return g_strdup ("");
+    }
+
+  while (!is_word_separator (s[cursor - 1]) && cursor > 0)
+    cursor--;
+  begin = cursor;
+
+  end = begin;
+  while (!is_word_separator (s[end]) && s[end] != '\0')
+    end++;
+
+  if (out_word_begins_at != NULL)
+    *out_word_begins_at = begin;
+
+  return g_strndup (s + begin, end - begin);
+}
+
+static gboolean
+parse_completion_line_to_argv (const char        *initial_completion_line,
+                               FlatpakCompletion *completion)
+{
+  gboolean parse_result = g_shell_parse_argv (initial_completion_line,
+                                              &completion->original_argc,
+                                              &completion->original_argv,
+                                              NULL);
+
+  /* Make a shallow copy of argv, which will be our "working set" */
+  completion->argc = completion->original_argc;
+  completion->argv = g_memdup (completion->original_argv,
+                               sizeof (gchar *) * (completion->original_argc + 1));
+
+  return parse_result;
+}
+
+FlatpakCompletion *
+flatpak_completion_new (const char *arg_line,
+                        const char *arg_point,
+                        const char *arg_cur)
+{
+  FlatpakCompletion *completion;
+  g_autofree char *initial_completion_line = NULL;
+  int _point;
+  char *endp;
+  int cur_begin;
+  int i;
+
+  _point = strtol (arg_point, &endp, 10);
+  if (endp == arg_point || *endp != '\0')
+    return NULL;
+
+  completion = g_new0 (FlatpakCompletion, 1);
+  completion->line = g_strdup (arg_line);
+  completion->shell_cur = g_strdup (arg_cur);
+  completion->point = _point;
+
+  flatpak_completion_debug ("========================================");
+  flatpak_completion_debug ("completion_point=%d", completion->point);
+  flatpak_completion_debug ("completion_shell_cur='%s'", completion->shell_cur);
+  flatpak_completion_debug ("----");
+  flatpak_completion_debug (" 0123456789012345678901234567890123456789012345678901234567890123456789");
+  flatpak_completion_debug ("'%s'", completion->line);
+  flatpak_completion_debug (" %*s^", completion->point, "");
+
+  /* compute cur and prev */
+  completion->prev = NULL;
+  completion->cur = pick_word_at (completion->line, completion->point, &cur_begin);
+  if (cur_begin > 0)
+    {
+      gint prev_end;
+      for (prev_end = cur_begin - 1; prev_end >= 0; prev_end--)
+        {
+          if (!is_word_separator (completion->line[prev_end]))
+            {
+              completion->prev = pick_word_at (completion->line, prev_end, NULL);
+              break;
+            }
+        }
+
+      initial_completion_line = g_strndup (completion->line, cur_begin);
+    }
+  else
+    initial_completion_line = g_strdup ("");
+
+  flatpak_completion_debug ("'%s'", initial_completion_line);
+  flatpak_completion_debug ("----");
+
+  flatpak_completion_debug (" cur='%s'", completion->cur);
+  flatpak_completion_debug ("prev='%s'", completion->prev);
+
+  if (!parse_completion_line_to_argv (initial_completion_line,
+                                      completion))
+    {
+      /* it's very possible the command line can't be parsed (for
+       * example, missing quotes etc) - in that case, we just
+       * don't autocomplete at all
+       */
+      flatpak_completion_free (completion);
+      return NULL;
+    }
+
+  flatpak_completion_debug ("completion_argv %i:", completion->original_argc);
+  for (i = 0; i < completion->original_argc; i++)
+    flatpak_completion_debug (completion->original_argv[i]);
+
+  flatpak_completion_debug ("----");
+
+  return completion;
+}
+
+void
+flatpak_completion_free (FlatpakCompletion *completion)
+{
+  g_free (completion->cur);
+  g_free (completion->prev);
+  g_free (completion->line);
+  g_free (completion->argv);
+  g_strfreev (completion->original_argv);
+  g_free (completion);
+}
+
+/* In this NULL means don't care about these paths, while
+   an empty array means match anything */
+char **
+flatpak_subpaths_merge (char **subpaths1,
+                        char **subpaths2)
+{
+  GPtrArray *array;
+  int i;
+
+  /* Maybe either (or both) is unspecified */
+  if (subpaths1 == NULL)
+    return g_strdupv (subpaths2);
+  if (subpaths2 == NULL)
+    return g_strdupv (subpaths1);
+
+  /* Check for any "everything" match */
+  if (subpaths1[0] == NULL)
+    return g_strdupv (subpaths1);
+  if (subpaths2[0] == NULL)
+    return g_strdupv (subpaths2);
+
+  /* Combine both */
+  array = g_ptr_array_new ();
+
+  for (i = 0; subpaths1[i] != NULL; i++)
+    {
+      if (!flatpak_g_ptr_array_contains_string (array, subpaths1[i]))
+        g_ptr_array_add (array, g_strdup (subpaths1[i]));
+    }
+
+  for (i = 0; subpaths2[i] != NULL; i++)
+    {
+      if (!flatpak_g_ptr_array_contains_string (array, subpaths2[i]))
+        g_ptr_array_add (array, g_strdup (subpaths2[i]));
+    }
+
+  g_ptr_array_sort (array, flatpak_strcmp0_ptr);
+  g_ptr_array_add (array, NULL);
+
+  return (char **)g_ptr_array_free (array, FALSE);
+}
+
+char *
+flatpak_get_lang_from_locale (const char *locale)
+{
+  g_autofree char *lang = g_strdup (locale);
+  char *c;
+
+  c = strchr (lang, '@');
+  if (c != NULL)
+    *c = 0;
+  c = strchr (lang, '_');
+  if (c != NULL)
+    *c = 0;
+  c = strchr (lang, '.');
+  if (c != NULL)
+    *c = 0;
+
+  if (strcmp (lang, "C") == 0)
+    return NULL;
+
+  return g_steal_pointer (&lang);
+}
+
+gboolean
+flatpak_g_ptr_array_contains_string (GPtrArray *array, const char *str)
+{
+  int i ;
+  for (i = 0; i < array->len; i++)
+    {
+      if (strcmp (g_ptr_array_index(array, i), str) == 0)
+        return TRUE;
+    }
+  return FALSE;
+}
+
+char **
+flatpak_get_current_locale_langs (void)
+{
+  const gchar * const *locales = g_get_language_names ();
+  GPtrArray *langs = g_ptr_array_new ();
+  int i;
+
+  for (i = 0; locales[i] != NULL; i++)
+    {
+      char *lang = flatpak_get_lang_from_locale (locales[i]);
+      if (lang != NULL && !flatpak_g_ptr_array_contains_string (langs, lang))
+        g_ptr_array_add (langs, lang);
+    }
+
+  g_ptr_array_sort (langs, flatpak_strcmp0_ptr);
+  g_ptr_array_add (langs, NULL);
+
+  return (char **)g_ptr_array_free (langs, FALSE);
+}
+
+#define BAR_LENGTH 20
+#define BAR_CHARS " -=#"
+
+void
+flatpak_terminal_progress_cb (const char *status,
+                              guint       progress,
+                              gboolean    estimating,
+                              gpointer    user_data)
+{
+  g_autoptr(GString) str = g_string_new ("");
+  FlatpakTerminalProgress *term = user_data;
+  int i;
+  int n_full, remainder, partial;
+  int width, padded_width;
+
+  if (!term->inited)
+    {
+      struct winsize w;
+      term->n_columns = 80;
+      if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &w) == 0)
+        term->n_columns = w.ws_col;
+      term->last_width = 0;
+      term->inited = 1;
+    }
+
+  g_string_append (str, "[");
+
+  n_full = (BAR_LENGTH * progress) / 100;
+  remainder = progress - (n_full * 100 / BAR_LENGTH);
+  partial = (remainder * strlen(BAR_CHARS) * BAR_LENGTH) / 100;
+
+  for (i = 0; i < n_full; i++)
+    g_string_append_c (str, BAR_CHARS[strlen(BAR_CHARS)-1]);
+
+  if (i < BAR_LENGTH)
+    {
+      g_string_append_c (str, BAR_CHARS[partial]);
+      i++;
+    }
+
+  for (; i < BAR_LENGTH; i++)
+    g_string_append (str, " ");
+
+  g_string_append (str, "] ");
+  g_string_append (str, status);
+
+  g_print ("\r");
+  width = MIN (strlen (str->str), term->n_columns);
+  padded_width = MAX (term->last_width, width);
+  term->last_width = width;
+  g_print ("%-*.*s", padded_width, padded_width, str->str);
+}
+
+void
+flatpak_terminal_progress_end (FlatpakTerminalProgress *term)
+{
+  if (term->inited)
+    g_print("\n");
+}
+
+static inline guint
+get_write_progress (guint outstanding_writes)
+{
+  return outstanding_writes > 0 ? (guint) (3 / (gdouble) outstanding_writes) : 3;
+}
+
+static void
+progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
+{
+  gboolean last_was_metadata = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "last-was-metadata"));
+  FlatpakProgressCallback progress_cb = g_object_get_data (G_OBJECT (progress), "callback");
+  guint last_progress = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "last_progress"));
+  GString *buf;
+  g_autofree char *status = NULL;
+  guint outstanding_fetches;
+  guint outstanding_metadata_fetches;
+  guint outstanding_writes;
+  guint64 bytes_transferred;
+  guint64 fetched_delta_part_size;
+  guint64 total_delta_part_size;
+  guint outstanding_extra_data;
+  guint64 total_extra_data_bytes;
+  guint64 transferred_extra_data_bytes;
+  guint64 total;
+  guint metadata_fetched;
+  guint64 start_time;
+  guint64 elapsed_time;
+  guint new_progress = 0;
+  gboolean estimating = FALSE;
+  gboolean downloading_extra_data;
+  gboolean scanning;
+  guint n_scanned_metadata;
+  guint fetched_delta_parts;
+  guint total_delta_parts;
+  guint fetched_delta_part_fallbacks;
+  guint total_delta_part_fallbacks;
+  guint fetched;
+  guint requested;
+  guint64 total_transferred;
+  g_autofree gchar *formatted_bytes_total_transferred = NULL;
+
+  /* We get some extra calls before we've really started due to the initialization of the
+     extra data, so ignore those */
+  if (ostree_async_progress_get_variant (progress, "outstanding-fetches") == NULL)
+    return;
+
+  buf = g_string_new ("");
+
+  /* The heuristic here goes as follows:
+   *  - While fetching metadata, grow up to 5%
+   *  - Download goes up to 97%
+   *  - Writing objects adds the last 3%
+   *
+   *
+   * Meaning of each variable:
+   *
+   *   Status:
+   *    - status: only sent by OSTree when the pull ends (with or without an error)
+   *
+   *   Fetches:
+   *    - fetched: sum of content + metadata fetches
+   *    - requested: sum of requested content and metadata fetches
+   *    - bytes_transferred: every and all tranferred data (in bytes)
+   *    - metadata_fetched: the number of fetched metadata objects
+   *    - outstanding_fetches: missing fetches (metadata + content + deltas)
+   *    - outstanding_delta_fetches: missing delta-only fetches
+   *    - outstanding_metadata_fetches: missing metadata-only fetches
+   *    - fetched_content_bytes: the estimated downloaded size of content (in bytes)
+   *    - total_content_bytes: the estimated total size of content, based on average bytes per object (in bytes)
+   *
+   *   Writes:
+   *    - outstanding_writes: all missing writes (sum of outstanding content, metadata and delta writes)
+   *
+   *   Static deltas:
+   *    - total_delta_part_size: the total size (in bytes) of static deltas
+   *    - fetched_delta_part_size: the size (in bytes) of already fetched static deltas
+   *
+   *   Extra data:
+   *    - total_extra_data_bytes: the sum of all extra data file sizes (in bytes)
+   *    - downloading_extra_data: whether extra-data files are being downloaded or not
+   */
+
+  /* We request everything in one go to make sure we don't race with the update from
+     the async download and get mixed results */
+  ostree_async_progress_get (progress,
+                             "outstanding-fetches", "u", &outstanding_fetches,
+                             "outstanding-metadata-fetches", "u", &outstanding_metadata_fetches,
+                             "outstanding-writes", "u", &outstanding_writes,
+                             "scanning", "u", &scanning,
+                             "scanned-metadata", "u", &n_scanned_metadata,
+                             "fetched-delta-parts", "u", &fetched_delta_parts,
+                             "total-delta-parts", "u", &total_delta_parts,
+                             "fetched-delta-fallbacks", "u", &fetched_delta_part_fallbacks,
+                             "total-delta-fallbacks", "u", &total_delta_part_fallbacks,
+                             "fetched-delta-part-size", "t", &fetched_delta_part_size,
+                             "total-delta-part-size", "t", &total_delta_part_size,
+                             "bytes-transferred", "t", &bytes_transferred,
+                             "fetched", "u", &fetched,
+                             "metadata-fetched", "u", &metadata_fetched,
+                             "requested", "u", &requested,
+                             "start-time", "t", &start_time,
+                             "status", "s", &status,
+                             "outstanding-extra-data", "u", &outstanding_extra_data,
+                             "total-extra-data-bytes", "t", &total_extra_data_bytes,
+                             "transferred-extra-data-bytes", "t", &transferred_extra_data_bytes,
+                             "downloading-extra-data", "u", &downloading_extra_data,
+                             NULL);
+
+  elapsed_time = (g_get_monotonic_time () - start_time) / G_USEC_PER_SEC;
+
+  /* When we receive the status, it means that the ostree pull operation is
+   * finished. We only have to be careful about the extra-data fields. */
+  if (status && *status && total_extra_data_bytes == 0)
+    {
+      g_string_append (buf, status);
+      new_progress = 100;
+      goto out;
+    }
+
+  total_transferred = bytes_transferred + transferred_extra_data_bytes;
+  formatted_bytes_total_transferred =  g_format_size_full (total_transferred, 0);
+
+  g_object_set_data (G_OBJECT (progress), "last-was-metadata", GUINT_TO_POINTER (FALSE));
+
+  if (total_delta_parts == 0 &&
+      (outstanding_metadata_fetches > 0 || last_was_metadata)  &&
+      metadata_fetched < 20)
+    {
+      /* We need to hit two callbacks with no metadata outstanding, because
+         sometimes we get called when we just handled a metadata, but did
+         not yet process it and add more metadata */
+      if (outstanding_metadata_fetches > 0)
+        g_object_set_data (G_OBJECT (progress), "last-was-metadata", GUINT_TO_POINTER (TRUE));
+
+      /* At this point we don't really know how much data there is, so we have to make a guess.
+       * Since its really hard to figure out early how much data there is we report 1% until
+       * all objects are scanned. */
+
+      estimating = TRUE;
+
+      g_string_append_printf (buf, _("Downloading metadata: %u/(estimating) %s"),
+                              fetched, formatted_bytes_total_transferred);
+
+      /* Go up to 5% until the metadata is all fetched */
+      new_progress = 0;
+      if (requested > 0)
+        new_progress = fetched * 5 / requested;
+    }
+  else
+    {
+      if (total_delta_parts > 0)
+        {
+          g_autofree gchar *formatted_bytes_total = NULL;
+
+          /* We're only using deltas, so we can ignore regular objects
+           * and get perfect sizes.
+           *
+           * fetched_delta_part_size is the total size of all the
+           * delta parts and fallback objects that were already
+           * available at the start and need not be downloaded.
+           */
+          total = total_delta_part_size - fetched_delta_part_size + total_extra_data_bytes;
+          formatted_bytes_total = g_format_size_full (total, 0);
+
+          g_string_append_printf (buf, _("Downloading: %s/%s"),
+                                  formatted_bytes_total_transferred,
+                                  formatted_bytes_total);
+        }
+      else
+        {
+          /* Non-deltas, so we can't know anything other than object
+             counts, except the additional extra data which we know
+             the byte size of. To be able to compare them with the
+             extra data we use the average object size to estimate a
+             total size. */
+          double average_object_size = 1;
+          if (fetched > 0)
+            average_object_size = bytes_transferred / (double)fetched;
+
+          total = average_object_size * requested + total_extra_data_bytes;
+
+          if (downloading_extra_data)
+            {
+              g_autofree gchar *formatted_bytes_total = g_format_size_full (total, 0);;
+              g_string_append_printf (buf, _("Downloading extra data: %s/%s"),
+                                      formatted_bytes_total_transferred,
+                                      formatted_bytes_total);
+            }
+          else
+            g_string_append_printf (buf, _("Downloading files: %d/%d %s"),
+                                    fetched, requested, formatted_bytes_total_transferred);
+        }
+
+      /* The download progress goes up to 97% */
+      new_progress = 5 + ((total_transferred / (gdouble) total) * 92);
+
+      /* And the writing of the objects adds 3% to the progress */
+      new_progress += get_write_progress (outstanding_writes);
+    }
+
+  if (elapsed_time > 0) // Ignore first second
+    {
+      g_autofree gchar *formatted_bytes_sec = g_format_size (total_transferred / elapsed_time);
+      g_string_append_printf (buf, " (%s/s)", formatted_bytes_sec);
+    }
+
+out:
+  if (new_progress < last_progress)
+    new_progress = last_progress;
+  g_object_set_data (G_OBJECT (progress), "last_progress", GUINT_TO_POINTER (new_progress));
+
+  progress_cb (buf->str, new_progress, estimating, user_data);
+
+  g_string_free (buf, TRUE);
+}
+
+OstreeAsyncProgress *
+flatpak_progress_new (FlatpakProgressCallback progress,
+                      gpointer                progress_data)
+{
+  OstreeAsyncProgress *ostree_progress =
+    ostree_async_progress_new_and_connect (progress_cb,
+                                           progress_data);
+  g_object_set_data (G_OBJECT (ostree_progress), "callback", progress);
+  g_object_set_data (G_OBJECT (ostree_progress), "last_progress", GUINT_TO_POINTER (0));
+
+  if (progress == flatpak_terminal_progress_cb)
+    g_object_set_data (G_OBJECT (ostree_progress), "update-frequency", GUINT_TO_POINTER (FLATPAK_CLI_UPDATE_FREQUENCY));
+
+  return ostree_progress;
+}
+
+void
+flatpak_log_dir_access (FlatpakDir *dir)
+{
+  if (dir != NULL)
+    {
+      GFile *dir_path = NULL;
+      g_autofree char *dir_path_str = NULL;
+      g_autofree char *dir_name = NULL;
+
+      dir_path = flatpak_dir_get_path (dir);
+      if (dir_path != NULL)
+        dir_path_str = g_file_get_path (dir_path);
+      dir_name = flatpak_dir_get_name (dir);
+      g_debug ("Opening %s flatpak installation at path %s", dir_name, dir_path_str);
+    }
+}
diff --git a/common/flatpak-utils.h b/common/flatpak-utils.h
new file mode 100644 (file)
index 0000000..e9ad1e7
--- /dev/null
@@ -0,0 +1,726 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_UTILS_H__
+#define __FLATPAK_UTILS_H__
+
+#include <string.h>
+
+#include "libglnx/libglnx.h"
+#include <flatpak-common-types.h>
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
+#include <libsoup/soup.h>
+#include "flatpak-dbus.h"
+#include <ostree.h>
+#include <json-glib/json-glib.h>
+#include "document-portal/xdp-dbus.h"
+
+typedef enum {
+  FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV = 1 << 0,
+} FlatpakHostCommandFlags;
+
+typedef void (*FlatpakLoadUriProgress) (guint64 downloaded_bytes,
+                                        gpointer user_data);
+
+
+#define FLATPAK_ANSI_BOLD_ON "\x1b[1m"
+#define FLATPAK_ANSI_BOLD_OFF "\x1b[22m"
+#define FLATPAK_ANSI_RED "\x1b[31m"
+#define FLATPAK_ANSI_COLOR_RESET "\x1b[0m"
+
+/* https://bugzilla.gnome.org/show_bug.cgi?id=766370 */
+#if !GLIB_CHECK_VERSION(2, 49, 3)
+#define FLATPAK_VARIANT_BUILDER_INITIALIZER {{0,}}
+#define FLATPAK_VARIANT_DICT_INITIALIZER {{0,}}
+#else
+#define FLATPAK_VARIANT_BUILDER_INITIALIZER {{{0,}}}
+#define FLATPAK_VARIANT_DICT_INITIALIZER {{{0,}}}
+#endif
+
+/* https://github.com/GNOME/libglnx/pull/38
+ * Note by using #define rather than wrapping via a static inline, we
+ * don't have to re-define attributes like G_GNUC_PRINTF.
+ */
+#define flatpak_fail glnx_throw
+
+void flatpak_debug2 (const char *format, ...) G_GNUC_PRINTF(1, 2);
+
+gint flatpak_strcmp0_ptr (gconstpointer a,
+                          gconstpointer b);
+
+gboolean  flatpak_has_path_prefix (const char *str,
+                                   const char *prefix);
+
+const char * flatpak_path_match_prefix (const char *pattern,
+                                        const char *path);
+
+gboolean flatpak_is_in_sandbox (void);
+
+gboolean flatpak_fancy_output (void);
+
+const char * flatpak_get_arch (void);
+const char ** flatpak_get_arches (void);
+gboolean flatpak_is_linux32_arch (const char *arch);
+
+const char ** flatpak_get_gl_drivers (void);
+gboolean flatpak_extension_matches_reason (const char *extension_id,
+                                           const char *reason,
+                                           gboolean default_value);
+
+const char * flatpak_get_bwrap (void);
+
+char **flatpak_subpaths_merge (char **subpaths1,
+                               char **subpaths2);
+
+char *flatpak_get_lang_from_locale (const char *locale);
+char **flatpak_get_current_locale_langs (void);
+
+void flatpak_migrate_from_xdg_app (void);
+
+GFile *flatpak_file_new_tmp_in (GFile *dir,
+                                const char *templatename,
+                                GError        **error);
+gboolean flatpak_break_hardlink (GFile *file, GError **error);
+
+gboolean flatpak_write_update_checksum (GOutputStream  *out,
+                                        gconstpointer   data,
+                                        gsize           len,
+                                        gsize          *out_bytes_written,
+                                        GChecksum      *checksum,
+                                        GCancellable   *cancellable,
+                                        GError        **error);
+
+
+gboolean flatpak_splice_update_checksum (GOutputStream  *out,
+                                         GInputStream   *in,
+                                         GChecksum      *checksum,
+                                         FlatpakLoadUriProgress progress,
+                                         gpointer        progress_data,
+                                         GCancellable   *cancellable,
+                                         GError        **error);
+
+GBytes * flatpak_read_stream (GInputStream *in,
+                              gboolean      null_terminate,
+                              GError      **error);
+
+gboolean flatpak_variant_save (GFile        *dest,
+                               GVariant     *variant,
+                               GCancellable *cancellable,
+                               GError      **error);
+GVariant * flatpak_gvariant_new_empty_string_dict (void);
+void    flatpak_variant_builder_init_from_variant (GVariantBuilder *builder,
+                                                   const char      *type,
+                                                   GVariant        *variant);
+gboolean flatpak_variant_bsearch_str (GVariant   *array,
+                                      const char *str,
+                                      int        *out_pos);
+GVariant *flatpak_repo_load_summary (OstreeRepo *repo,
+                                     GError **error);
+char **  flatpak_summary_match_subrefs (GVariant   *summary,
+                                        const char *collection_id,
+                                        const char *ref);
+gboolean flatpak_summary_lookup_ref (GVariant    *summary,
+                                     const char  *collection_id,
+                                     const char  *ref,
+                                     char       **out_checksum,
+                                     GVariant   **out_variant);
+
+gboolean flatpak_has_name_prefix (const char *string,
+                                  const char *name);
+gboolean flatpak_is_valid_name (const char *string,
+                                GError **error);
+gboolean flatpak_is_valid_branch (const char *string,
+                                  GError **error);
+
+char * flatpak_make_valid_id_prefix (const char *orig_id);
+gboolean flatpak_id_has_subref_suffix (const char *id);
+
+char **flatpak_decompose_ref (const char *ref,
+                              GError    **error);
+
+FlatpakKinds flatpak_kinds_from_bools (gboolean app, gboolean runtime);
+
+gboolean flatpak_split_partial_ref_arg (const char   *partial_ref,
+                                        FlatpakKinds  default_kinds,
+                                        const char   *default_arch,
+                                        const char   *default_branch,
+                                        FlatpakKinds *out_kinds,
+                                        char        **out_id,
+                                        char        **out_arch,
+                                        char        **out_branch,
+                                        GError      **error);
+gboolean flatpak_split_partial_ref_arg_novalidate (const char   *partial_ref,
+                                                   FlatpakKinds  default_kinds,
+                                                   const char   *default_arch,
+                                                   const char   *default_branch,
+                                                   FlatpakKinds *out_kinds,
+                                                   char        **out_id,
+                                                   char        **out_arch,
+                                                   char        **out_branch);
+
+char * flatpak_compose_ref (gboolean    app,
+                            const char *name,
+                            const char *branch,
+                            const char *arch,
+                            GError    **error);
+
+char * flatpak_build_untyped_ref (const char *runtime,
+                                  const char *branch,
+                                  const char *arch);
+char * flatpak_build_runtime_ref (const char *runtime,
+                                  const char *branch,
+                                  const char *arch);
+char * flatpak_build_app_ref (const char *app,
+                              const char *branch,
+                              const char *arch);
+char * flatpak_find_current_ref (const char *app_id,
+                                 GCancellable *cancellable,
+                                 GError      **error);
+GFile *flatpak_find_deploy_dir_for_ref (const char   *ref,
+                                        FlatpakDir **dir_out,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+GFile * flatpak_find_files_dir_for_ref (const char   *ref,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+GFile * flatpak_find_unmaintained_extension_dir_if_exists (const char   *name,
+                                                           const char   *arch,
+                                                           const char   *branch,
+                                                           GCancellable *cancellable);
+FlatpakDeploy * flatpak_find_deploy_for_ref (const char   *ref,
+                                             GCancellable *cancellable,
+                                             GError      **error);
+char ** flatpak_list_deployed_refs (const char   *type,
+                                    const char   *name_prefix,
+                                    const char   *branch,
+                                    const char   *arch,
+                                    GCancellable *cancellable,
+                                    GError      **error);
+char ** flatpak_list_unmaintained_refs (const char   *name_prefix,
+                                        const char   *branch,
+                                        const char   *arch,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+
+gboolean flatpak_overlay_symlink_tree (GFile        *source,
+                                       GFile        *destination,
+                                       const char   *symlink_prefix,
+                                       GCancellable *cancellable,
+                                       GError      **error);
+gboolean flatpak_remove_dangling_symlinks (GFile        *dir,
+                                           GCancellable *cancellable,
+                                           GError      **error);
+
+void  flatpak_invocation_lookup_app_info (GDBusMethodInvocation *invocation,
+                                          GCancellable          *cancellable,
+                                          GAsyncReadyCallback    callback,
+                                          gpointer               user_data);
+
+GKeyFile *flatpak_invocation_lookup_app_info_finish (GDBusMethodInvocation *invocation,
+                                                     GAsyncResult          *result,
+                                                     GError               **error);
+
+void  flatpak_connection_track_name_owners (GDBusConnection *connection);
+
+#if !GLIB_CHECK_VERSION (2, 40, 0)
+static inline gboolean
+g_key_file_save_to_file (GKeyFile    *key_file,
+                         const gchar *filename,
+                         GError     **error)
+{
+  gchar *contents;
+  gboolean success;
+  gsize length;
+
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  success = g_file_set_contents (filename, contents, length, error);
+  g_free (contents);
+
+  return success;
+}
+#endif
+
+gboolean flatpak_g_ptr_array_contains_string (GPtrArray *array, const char *str);
+
+/* Returns the first string in subset that is not in strv */
+static inline const gchar *
+g_strv_subset (const gchar * const *strv,
+               const gchar * const *subset)
+{
+  int i;
+
+  for (i = 0; subset[i]; i++)
+    {
+      const char *key;
+
+      key = subset[i];
+      if (!g_strv_contains (strv, key))
+        return key;
+    }
+
+  return NULL;
+}
+
+static inline void
+flatpak_auto_unlock_helper (GMutex **mutex)
+{
+  if (*mutex)
+    g_mutex_unlock (*mutex);
+}
+
+static inline GMutex *
+flatpak_auto_lock_helper (GMutex *mutex)
+{
+  if (mutex)
+    g_mutex_lock (mutex);
+  return mutex;
+}
+
+gboolean
+flatpak_switch_symlink_and_remove (const char *symlink_path,
+                                   const char *target,
+                                   GError **error);
+gint flatpak_mkstempat (int    dir_fd,
+                        gchar *tmpl,
+                        int    flags,
+                        int    mode);
+
+gboolean flatpak_repo_set_title (OstreeRepo *repo,
+                                 const char *title,
+                                 GError    **error);
+gboolean flatpak_repo_set_redirect_url (OstreeRepo *repo,
+                                        const char *redirect_url,
+                                        GError    **error);
+gboolean flatpak_repo_set_default_branch (OstreeRepo *repo,
+                                          const char *branch,
+                                          GError    **error);
+gboolean flatpak_repo_set_collection_id (OstreeRepo  *repo,
+                                         const char  *collection_id,
+                                         GError     **error);
+gboolean flatpak_repo_set_deploy_collection_id (OstreeRepo  *repo,
+                                                gboolean     deploy_collection_id,
+                                                GError     **error);
+gboolean flatpak_repo_set_gpg_keys (OstreeRepo *repo,
+                                    GBytes *bytes,
+                                    GError    **error);
+gboolean flatpak_repo_update (OstreeRepo   *repo,
+                              const char  **gpg_key_ids,
+                              const char   *gpg_homedir,
+                              GCancellable *cancellable,
+                              GError      **error);
+gboolean flatpak_repo_collect_sizes (OstreeRepo   *repo,
+                                     GFile        *root,
+                                     guint64      *installed_size,
+                                     guint64      *download_size,
+                                     GCancellable *cancellable,
+                                     GError      **error);
+GVariant *flatpak_commit_get_extra_data_sources (GVariant *commitv,
+                                                 GError  **error);
+GVariant *flatpak_repo_get_extra_data_sources (OstreeRepo   *repo,
+                                               const char   *rev,
+                                               GCancellable *cancellable,
+                                               GError      **error);
+void flatpak_repo_parse_extra_data_sources (GVariant *extra_data_sources,
+                                            int index,
+                                            const char **name,
+                                            guint64 *download_size,
+                                            guint64 *installed_size,
+                                            const guchar **sha256,
+                                            const char **uri);
+gboolean flatpak_mtree_create_root (OstreeRepo        *repo,
+                                    OstreeMutableTree *mtree,
+                                    GCancellable      *cancellable,
+                                    GError           **error);
+
+GVariant * flatpak_bundle_load (GFile   *file,
+                                char   **commit,
+                                char   **ref,
+                                char   **origin,
+                                char   **runtime_repo,
+                                char   **app_metadata,
+                                guint64 *installed_size,
+                                GBytes **gpg_keys,
+                                char   **collection_id,
+                                GError **error);
+
+gboolean flatpak_pull_from_bundle (OstreeRepo   *repo,
+                                   GFile        *file,
+                                   const char   *remote,
+                                   const char   *ref,
+                                   gboolean      require_gpg_signature,
+                                   GCancellable *cancellable,
+                                   GError      **error);
+
+typedef void (*FlatpakOciPullProgress) (guint64 total_size, guint64 pulled_size,
+                                        guint32 n_layers, guint32 pulled_layers,
+                                        gpointer data);
+
+char * flatpak_pull_from_oci (OstreeRepo   *repo,
+                              FlatpakOciRegistry *registry,
+                             const char *oci_repository,
+                              const char *digest,
+                              FlatpakOciManifest *manifest,
+                              const char *remote,
+                              const char *ref,
+                              FlatpakOciPullProgress progress_cb,
+                              gpointer progress_data,
+                              GCancellable *cancellable,
+                              GError      **error);
+
+gboolean flatpak_mirror_image_from_oci (FlatpakOciRegistry *dst_registry,
+                                        FlatpakOciRegistry *registry,
+                                        const char *oci_repository,
+                                        const char *digest,
+                                        FlatpakOciPullProgress progress_cb,
+                                        gpointer progress_data,
+                                        GCancellable *cancellable,
+                                        GError      **error);
+
+typedef struct
+{
+  char *id;
+  char *installed_id;
+  char *commit;
+  char *ref;
+  char *directory;
+  char *files_path;
+  char *subdir_suffix;
+  char *add_ld_path;
+  char **merge_dirs;
+  int priority;
+  gboolean needs_tmpfs;
+  gboolean is_unmaintained;
+} FlatpakExtension;
+
+void flatpak_extension_free (FlatpakExtension *extension);
+
+GList *flatpak_list_extensions (GKeyFile   *metakey,
+                                const char *arch,
+                                const char *branch);
+
+char * flatpak_quote_argv (const char *argv[]);
+gboolean flatpak_file_arg_has_suffix (const char *arg, const char *suffix);
+
+gboolean            flatpak_spawn (GFile       *dir,
+                                   char       **output,
+                                   GError     **error,
+                                   const gchar *argv0,
+                                   va_list      args);
+
+gboolean            flatpak_spawnv (GFile                *dir,
+                                    char                **output,
+                                    GSubprocessFlags      flags,
+                                    GError              **error,
+                                    const gchar * const  *argv);
+
+const char *flatpak_file_get_path_cached (GFile *file);
+
+GFile *flatpak_build_file_va (GFile *base,
+                              va_list args);
+GFile *flatpak_build_file (GFile *base, ...) G_GNUC_NULL_TERMINATED;
+
+gboolean flatpak_openat_noatime (int            dfd,
+                                 const char    *name,
+                                 int           *ret_fd,
+                                 GCancellable  *cancellable,
+                                 GError       **error);
+
+typedef enum {
+  FLATPAK_CP_FLAGS_NONE = 0,
+  FLATPAK_CP_FLAGS_MERGE = 1<<0,
+  FLATPAK_CP_FLAGS_NO_CHOWN = 1<<1,
+  FLATPAK_CP_FLAGS_MOVE = 1<<2,
+} FlatpakCpFlags;
+
+gboolean   flatpak_cp_a (GFile         *src,
+                         GFile         *dest,
+                         FlatpakCpFlags flags,
+                         GCancellable  *cancellable,
+                         GError       **error);
+
+gboolean flatpak_zero_mtime (int parent_dfd,
+                             const char *rel_path,
+                             GCancellable  *cancellable,
+                             GError       **error);
+
+gboolean flatpak_mkdir_p (GFile         *dir,
+                          GCancellable  *cancellable,
+                          GError       **error);
+
+gboolean flatpak_rm_rf (GFile         *dir,
+                        GCancellable  *cancellable,
+                        GError       **error);
+
+char * flatpak_readlink (const char *path,
+                         GError       **error);
+char * flatpak_resolve_link (const char *path,
+                             GError **error);
+char * flatpak_canonicalize_filename (const char *path);
+
+gboolean flatpak_file_rename (GFile *from,
+                              GFile *to,
+                              GCancellable  *cancellable,
+                              GError       **error);
+
+gboolean flatpak_open_in_tmpdir_at (int                tmpdir_fd,
+                                    int                mode,
+                                    char              *tmpl,
+                                    GOutputStream    **out_stream,
+                                    GCancellable      *cancellable,
+                                    GError           **error);
+
+static inline void
+flatpak_temp_dir_destroy (void *p)
+{
+  GFile *dir = p;
+
+  if (dir)
+    {
+      flatpak_rm_rf (dir, NULL, NULL);
+      g_object_unref (dir);
+    }
+}
+
+typedef GFile FlatpakTempDir;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakTempDir, flatpak_temp_dir_destroy)
+
+
+typedef OstreeRepo FlatpakRepoTransaction;
+
+static inline void
+flatpak_repo_transaction_cleanup (void *p)
+{
+  OstreeRepo *repo = p;
+
+  if (repo)
+    {
+      g_autoptr(GError) error = NULL;
+      if (!ostree_repo_abort_transaction (repo, NULL, &error))
+        g_warning ("Error aborting ostree transaction: %s", error->message);
+    }
+}
+
+static inline FlatpakRepoTransaction *
+flatpak_repo_transaction_start (OstreeRepo     *repo,
+                                GCancellable   *cancellable,
+                                GError        **error)
+{
+  if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
+    return NULL;
+  return (FlatpakRepoTransaction *)repo;
+}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRepoTransaction, flatpak_repo_transaction_cleanup)
+
+#define AUTOLOCK(name) G_GNUC_UNUSED __attribute__((cleanup (flatpak_auto_unlock_helper))) GMutex * G_PASTE (auto_unlock, __LINE__) = flatpak_auto_lock_helper (&G_LOCK_NAME (name))
+
+/* OSTREE_CHECK_VERSION was added immediately after the 2017.3 release */
+#ifndef OSTREE_CHECK_VERSION
+#define OSTREE_CHECK_VERSION(year, minor) (0)
+#endif
+/* Cleanups are always exported in 2017.4, and some git releases between 2017.3 and 2017.4.
+   We actually check against 2017.3 so that we work on the git releases *after* 2017.3
+   which is safe, because the real OSTREE_CHECK_VERSION macro was added after 2017.3
+   too. */
+#if !OSTREE_CHECK_VERSION(2017, 3)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepo, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeMutableTree, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeAsyncProgress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeGpgVerifyResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoCommitModifier, ostree_repo_commit_modifier_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoDevInoCache, ostree_repo_devino_cache_unref)
+#endif
+
+#ifndef SOUP_AUTOCLEANUPS_H
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupSession, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupMessage, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupRequestHTTP, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupURI, soup_uri_free)
+#endif
+
+#if !JSON_CHECK_VERSION(1,1,2)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonArray, json_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonBuilder, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonGenerator, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonObject, json_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonPath, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonReader, g_object_unref)
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 43, 4)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixFDList, g_object_unref)
+#endif
+
+/* This uses a weird Auto prefix to avoid conflicts with later added autogenerated autoptr support, per:
+ * https://git.gnome.org/browse/glib/commit/?id=1c6cd5f0a3104aa9b62c7f1d3086181f63e71b59
+ */
+typedef FlatpakSessionHelper AutoFlatpakSessionHelper;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoFlatpakSessionHelper, g_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdpDbusDocuments, g_object_unref)
+
+typedef struct FlatpakXml FlatpakXml;
+
+struct FlatpakXml
+{
+  gchar      *element_name; /* NULL == text */
+  char      **attribute_names;
+  char      **attribute_values;
+  char       *text;
+  FlatpakXml *parent;
+  FlatpakXml *first_child;
+  FlatpakXml *last_child;
+  FlatpakXml *next_sibling;
+};
+
+FlatpakXml *flatpak_xml_new (const gchar *element_name);
+FlatpakXml *flatpak_xml_new_text (const gchar *text);
+void       flatpak_xml_add (FlatpakXml *parent,
+                            FlatpakXml *node);
+void       flatpak_xml_free (FlatpakXml *node);
+FlatpakXml *flatpak_xml_parse (GInputStream *in,
+                               gboolean      compressed,
+                               GCancellable *cancellable,
+                               GError      **error);
+void       flatpak_xml_to_string (FlatpakXml *node,
+                                  GString    *res);
+FlatpakXml *flatpak_xml_unlink (FlatpakXml *node,
+                                FlatpakXml *prev_sibling);
+FlatpakXml *flatpak_xml_find (FlatpakXml  *node,
+                              const char  *type,
+                              FlatpakXml **prev_child_out);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakXml, flatpak_xml_free);
+
+
+FlatpakXml *flatpak_appstream_xml_new (void);
+gboolean   flatpak_appstream_xml_migrate (FlatpakXml *source,
+                                          FlatpakXml *dest,
+                                          const char *ref,
+                                          const char *id,
+                                          GKeyFile   *metadata);
+GBytes *flatpak_appstream_xml_root_to_data (FlatpakXml *appstream_root,
+                                            GError    **error);
+gboolean   flatpak_repo_generate_appstream (OstreeRepo   *repo,
+                                            const char  **gpg_key_ids,
+                                            const char   *gpg_homedir,
+                                            guint64       timestamp,
+                                            GCancellable *cancellable,
+                                            GError      **error);
+
+gboolean flatpak_allocate_tmpdir (int           tmpdir_dfd,
+                                  const char   *tmpdir_relpath,
+                                  const char   *tmpdir_prefix,
+                                  char        **tmpdir_name_out,
+                                  int          *tmpdir_fd_out,
+                                  GLnxLockFile *file_lock_out,
+                                  gboolean     *reusing_dir_out,
+                                  GCancellable *cancellable,
+                                  GError      **error);
+
+
+gboolean flatpak_yes_no_prompt (const char *prompt, ...) G_GNUC_PRINTF(1, 2);
+long flatpak_number_prompt (int min, int max, const char *prompt, ...) G_GNUC_PRINTF(3, 4);
+
+SoupSession * flatpak_create_soup_session (const char *user_agent);
+
+typedef enum {
+  FLATPAK_HTTP_FLAGS_NONE = 0,
+  FLATPAK_HTTP_FLAGS_ACCEPT_OCI = 1<<0,
+} FlatpakHTTPFlags;
+
+GBytes * flatpak_load_http_uri (SoupSession *soup_session,
+                                const char   *uri,
+                               FlatpakHTTPFlags flags,
+                                const char   *etag,
+                                char        **out_etag,
+                                FlatpakLoadUriProgress progress,
+                                gpointer      user_data,
+                                GCancellable *cancellable,
+                                GError      **error);
+gboolean flatpak_download_http_uri (SoupSession *soup_session,
+                                    const char   *uri,
+                                   FlatpakHTTPFlags flags,
+                                    GOutputStream *out,
+                                    FlatpakLoadUriProgress progress,
+                                    gpointer      user_data,
+                                    GCancellable *cancellable,
+                                    GError      **error);
+
+typedef struct {
+  char *shell_cur;
+  char *cur;
+  char *prev;
+  char *line;
+  int point;
+  char **argv;
+  char **original_argv;
+  int argc;
+  int original_argc;
+} FlatpakCompletion;
+
+void flatpak_completion_debug (const gchar *format, ...);
+
+FlatpakCompletion *flatpak_completion_new   (const char        *arg_line,
+                                             const char        *arg_point,
+                                             const char        *arg_cur);
+void               flatpak_complete_word    (FlatpakCompletion *completion,
+                                             char              *format,
+                                             ...) G_GNUC_PRINTF(2,3);
+void               flatpak_complete_ref     (FlatpakCompletion *completion,
+                                             OstreeRepo        *repo);
+void               flatpak_complete_partial_ref (FlatpakCompletion *completion,
+                                                 FlatpakKinds kinds,
+                                                 const char *only_arch,
+                                                 FlatpakDir *dir,
+                                                 const char *remote);
+void               flatpak_complete_file    (FlatpakCompletion *completion,
+                                             const char        *file_type);
+void               flatpak_complete_dir     (FlatpakCompletion *completion);
+void               flatpak_complete_options (FlatpakCompletion *completion,
+                                             GOptionEntry      *entries);
+void               flatpak_completion_free  (FlatpakCompletion *completion);
+
+typedef struct {
+  int inited;
+  int n_columns;
+  int last_width;
+} FlatpakTerminalProgress;
+
+void flatpak_terminal_progress_cb (const char *status,
+                                   guint       progress,
+                                   gboolean    estimating,
+                                   gpointer    user_data);
+void flatpak_terminal_progress_end (FlatpakTerminalProgress *term);
+
+typedef void (*FlatpakProgressCallback)(const char *status,
+                                        guint       progress,
+                                        gboolean    estimating,
+                                        gpointer    user_data);
+
+OstreeAsyncProgress *flatpak_progress_new (FlatpakProgressCallback progress,
+                                           gpointer                progress_data);
+
+void flatpak_log_dir_access (FlatpakDir *dir);
+
+#endif /* __FLATPAK_UTILS_H__ */
diff --git a/common/gvdb/gvdb-builder.c b/common/gvdb/gvdb-builder.c
new file mode 100644 (file)
index 0000000..ded7708
--- /dev/null
@@ -0,0 +1,537 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#include "gvdb-builder.h"
+#include "gvdb-format.h"
+
+#include <glib.h>
+#include <fcntl.h>
+#if !defined(G_OS_WIN32) || !defined(_MSC_VER)
+#include <unistd.h>
+#endif
+#include <string.h>
+
+
+struct _GvdbItem
+{
+  gchar *key;
+  guint32 hash_value;
+  guint32_le assigned_index;
+  GvdbItem *parent;
+  GvdbItem *sibling;
+  GvdbItem *next;
+
+  /* one of:
+   * this:
+   */
+  GVariant *value;
+
+  /* this: */
+  GHashTable *table;
+
+  /* or this: */
+  GvdbItem *child;
+};
+
+static void
+gvdb_item_free (gpointer data)
+{
+  GvdbItem *item = data;
+
+  g_free (item->key);
+
+  if (item->value)
+    g_variant_unref (item->value);
+
+  if (item->table)
+    g_hash_table_unref (item->table);
+
+  g_slice_free (GvdbItem, item);
+}
+
+GHashTable *
+gvdb_hash_table_new (GHashTable  *parent,
+                     const gchar *name_in_parent)
+{
+  GHashTable *table;
+
+  table = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                 g_free, gvdb_item_free);
+
+  if (parent)
+    {
+      GvdbItem *item;
+
+      item = gvdb_hash_table_insert (parent, name_in_parent);
+      gvdb_item_set_hash_table (item, table);
+    }
+
+  return table;
+}
+
+static guint32
+djb_hash (const gchar *key)
+{
+  guint32 hash_value = 5381;
+
+  while (*key)
+    hash_value = hash_value * 33 + *(signed char *)key++;
+
+  return hash_value;
+}
+
+GvdbItem *
+gvdb_hash_table_insert (GHashTable  *table,
+                        const gchar *key)
+{
+  GvdbItem *item;
+
+  item = g_slice_new0 (GvdbItem);
+  item->key = g_strdup (key);
+  item->hash_value = djb_hash (key);
+
+  g_hash_table_insert (table, g_strdup (key), item);
+
+  return item;
+}
+
+void
+gvdb_hash_table_insert_string (GHashTable  *table,
+                               const gchar *key,
+                               const gchar *value)
+{
+  GvdbItem *item;
+
+  item = gvdb_hash_table_insert (table, key);
+  gvdb_item_set_value (item, g_variant_new_string (value));
+}
+
+void
+gvdb_item_set_value (GvdbItem *item,
+                     GVariant *value)
+{
+  g_return_if_fail (!item->value && !item->table && !item->child);
+
+  item->value = g_variant_ref_sink (value);
+}
+
+void
+gvdb_item_set_hash_table (GvdbItem   *item,
+                          GHashTable *table)
+{
+  g_return_if_fail (!item->value && !item->table && !item->child);
+
+  item->table = g_hash_table_ref (table);
+}
+
+void
+gvdb_item_set_parent (GvdbItem *item,
+                      GvdbItem *parent)
+{
+  GvdbItem **node;
+
+  g_return_if_fail (g_str_has_prefix (item->key, parent->key));
+  g_return_if_fail (!parent->value && !parent->table);
+  g_return_if_fail (!item->parent && !item->sibling);
+
+  for (node = &parent->child; *node; node = &(*node)->sibling)
+    if (strcmp ((*node)->key, item->key) > 0)
+      break;
+
+  item->parent = parent;
+  item->sibling = *node;
+  *node = item;
+}
+
+typedef struct
+{
+  GvdbItem **buckets;
+  gint n_buckets;
+} HashTable;
+
+static HashTable *
+hash_table_new (gint n_buckets)
+{
+  HashTable *table;
+
+  table = g_slice_new (HashTable);
+  table->buckets = g_new0 (GvdbItem *, n_buckets);
+  table->n_buckets = n_buckets;
+
+  return table;
+}
+
+static void
+hash_table_free (HashTable *table)
+{
+  g_free (table->buckets);
+
+  g_slice_free (HashTable, table);
+}
+
+static void
+hash_table_insert (gpointer key,
+                   gpointer value,
+                   gpointer data)
+{
+  guint32 hash_value, bucket;
+  HashTable *table = data;
+  GvdbItem *item = value;
+
+  hash_value = djb_hash (key);
+  bucket = hash_value % table->n_buckets;
+  item->next = table->buckets[bucket];
+  table->buckets[bucket] = item;
+}
+
+static guint32_le
+item_to_index (GvdbItem *item)
+{
+  if (item != NULL)
+    return item->assigned_index;
+
+  return guint32_to_le (-1u);
+}
+
+typedef struct
+{
+  GQueue *chunks;
+  guint64 offset;
+  gboolean byteswap;
+} FileBuilder;
+
+typedef struct
+{
+  gsize offset;
+  gsize size;
+  gpointer data;
+} FileChunk;
+
+static gpointer
+file_builder_allocate (FileBuilder         *fb,
+                       guint                alignment,
+                       gsize                size,
+                       struct gvdb_pointer *pointer)
+{
+  FileChunk *chunk;
+
+  if (size == 0)
+    return NULL;
+
+  fb->offset += (-fb->offset) & (alignment - 1);
+  chunk = g_slice_new (FileChunk);
+  chunk->offset = fb->offset;
+  chunk->size = size;
+  chunk->data = g_malloc (size);
+
+  pointer->start = guint32_to_le (fb->offset);
+  fb->offset += size;
+  pointer->end = guint32_to_le (fb->offset);
+
+  g_queue_push_tail (fb->chunks, chunk);
+
+  return chunk->data;
+}
+
+static void
+file_builder_add_value (FileBuilder         *fb,
+                        GVariant            *value,
+                        struct gvdb_pointer *pointer)
+{
+  GVariant *variant, *normal;
+  gpointer data;
+  gsize size;
+
+  if (fb->byteswap)
+    {
+      value = g_variant_byteswap (value);
+      variant = g_variant_new_variant (value);
+      g_variant_unref (value);
+    }
+  else
+    variant = g_variant_new_variant (value);
+
+  normal = g_variant_get_normal_form (variant);
+  g_variant_unref (variant);
+
+  size = g_variant_get_size (normal);
+  data = file_builder_allocate (fb, 8, size, pointer);
+  g_variant_store (normal, data);
+  g_variant_unref (normal);
+}
+
+static void
+file_builder_add_string (FileBuilder *fb,
+                         const gchar *string,
+                         guint32_le  *start,
+                         guint16_le  *size)
+{
+  FileChunk *chunk;
+  gsize length;
+
+  length = strlen (string);
+
+  chunk = g_slice_new (FileChunk);
+  chunk->offset = fb->offset;
+  chunk->size = length;
+  chunk->data = g_malloc (length);
+  memcpy (chunk->data, string, length);
+
+  *start = guint32_to_le (fb->offset);
+  *size = guint16_to_le (length);
+  fb->offset += length;
+
+  g_queue_push_tail (fb->chunks, chunk);
+}
+
+static void
+file_builder_allocate_for_hash (FileBuilder            *fb,
+                                gsize                   n_buckets,
+                                gsize                   n_items,
+                                guint                   bloom_shift,
+                                gsize                   n_bloom_words,
+                                guint32_le            **bloom_filter,
+                                guint32_le            **hash_buckets,
+                                struct gvdb_hash_item **hash_items,
+                                struct gvdb_pointer    *pointer)
+{
+  guint32_le bloom_hdr, table_hdr;
+  guchar *data;
+  gsize size;
+
+  g_assert (n_bloom_words < (1u << 27));
+
+  bloom_hdr = guint32_to_le (bloom_shift << 27 | n_bloom_words);
+  table_hdr = guint32_to_le (n_buckets);
+
+  size = sizeof bloom_hdr + sizeof table_hdr +
+         n_bloom_words * sizeof (guint32_le) +
+         n_buckets     * sizeof (guint32_le) +
+         n_items       * sizeof (struct gvdb_hash_item);
+
+  data = file_builder_allocate (fb, 4, size, pointer);
+
+#define chunk(s) (size -= (s), data += (s), data - (s))
+  memcpy (chunk (sizeof bloom_hdr), &bloom_hdr, sizeof bloom_hdr);
+  memcpy (chunk (sizeof table_hdr), &table_hdr, sizeof table_hdr);
+  *bloom_filter = (guint32_le *) chunk (n_bloom_words * sizeof (guint32_le));
+  *hash_buckets = (guint32_le *) chunk (n_buckets * sizeof (guint32_le));
+  *hash_items = (struct gvdb_hash_item *) chunk (n_items *
+                  sizeof (struct gvdb_hash_item));
+  g_assert (size == 0);
+#undef chunk
+
+  memset (*bloom_filter, 0, n_bloom_words * sizeof (guint32_le));
+
+  /* NOTE - the code to actually fill in the bloom filter here is missing.
+   * Patches welcome! 
+   *
+   * http://en.wikipedia.org/wiki/Bloom_filter
+   * http://0pointer.de/blog/projects/bloom.html
+   */
+}
+
+static void
+file_builder_add_hash (FileBuilder         *fb,
+                       GHashTable          *table,
+                       struct gvdb_pointer *pointer)
+{
+  guint32_le *buckets, *bloom_filter;
+  struct gvdb_hash_item *items;
+  HashTable *mytable;
+  GvdbItem *item;
+  guint32 index;
+  gint bucket;
+
+  mytable = hash_table_new (g_hash_table_size (table));
+  g_hash_table_foreach (table, hash_table_insert, mytable);
+  index = 0;
+
+  for (bucket = 0; bucket < mytable->n_buckets; bucket++)
+    for (item = mytable->buckets[bucket]; item; item = item->next)
+      item->assigned_index = guint32_to_le (index++);
+
+  file_builder_allocate_for_hash (fb, mytable->n_buckets, index, 5, 0,
+                                  &bloom_filter, &buckets, &items, pointer);
+
+  index = 0;
+  for (bucket = 0; bucket < mytable->n_buckets; bucket++)
+    {
+      buckets[bucket] = guint32_to_le (index);
+
+      for (item = mytable->buckets[bucket]; item; item = item->next)
+        {
+          struct gvdb_hash_item *entry = items++;
+          const gchar *basename;
+
+          g_assert (index == guint32_from_le (item->assigned_index));
+          entry->hash_value = guint32_to_le (item->hash_value);
+          entry->parent = item_to_index (item->parent);
+          entry->unused = 0;
+
+          if (item->parent != NULL)
+            basename = item->key + strlen (item->parent->key);
+          else
+            basename = item->key;
+
+          file_builder_add_string (fb, basename,
+                                   &entry->key_start,
+                                   &entry->key_size);
+
+          if (item->value != NULL)
+            {
+              g_assert (item->child == NULL && item->table == NULL);
+
+              file_builder_add_value (fb, item->value, &entry->value.pointer);
+              entry->type = 'v';
+            }
+
+          if (item->child != NULL)
+            {
+              guint32 children = 0, i = 0;
+              guint32_le *offsets;
+              GvdbItem *child;
+
+              g_assert (item->table == NULL);
+
+              for (child = item->child; child; child = child->sibling)
+                children++;
+
+              offsets = file_builder_allocate (fb, 4, 4 * children,
+                                               &entry->value.pointer);
+              entry->type = 'L';
+
+              for (child = item->child; child; child = child->sibling)
+                offsets[i++] = child->assigned_index;
+
+              g_assert (children == i);
+            }
+
+          if (item->table != NULL)
+            {
+              entry->type = 'H';
+              file_builder_add_hash (fb, item->table, &entry->value.pointer);
+            }
+
+          index++;
+        }
+    }
+
+  hash_table_free (mytable);
+}
+
+static FileBuilder *
+file_builder_new (gboolean byteswap)
+{
+  FileBuilder *builder;
+
+  builder = g_slice_new (FileBuilder);
+  builder->chunks = g_queue_new ();
+  builder->offset = sizeof (struct gvdb_header);
+  builder->byteswap = byteswap;
+
+  return builder;
+}
+
+static GString *
+file_builder_serialise (FileBuilder          *fb,
+                        struct gvdb_pointer   root)
+{
+  struct gvdb_header header = { { 0, }, };
+  GString *result;
+
+  if (fb->byteswap)
+    {
+      header.signature[0] = GVDB_SWAPPED_SIGNATURE0;
+      header.signature[1] = GVDB_SWAPPED_SIGNATURE1;
+    }
+  else
+    {
+      header.signature[0] = GVDB_SIGNATURE0;
+      header.signature[1] = GVDB_SIGNATURE1;
+    }
+
+  result = g_string_new (NULL);
+
+  header.root = root;
+  g_string_append_len (result, (gpointer) &header, sizeof header);
+
+  while (!g_queue_is_empty (fb->chunks))
+    {
+      FileChunk *chunk = g_queue_pop_head (fb->chunks);
+
+      if (result->len != chunk->offset)
+        {
+          gchar zero[8] = { 0, };
+
+          g_assert (chunk->offset > result->len);
+          g_assert (chunk->offset - result->len < 8);
+
+          g_string_append_len (result, zero, chunk->offset - result->len);
+          g_assert (result->len == chunk->offset);
+        }
+
+      g_string_append_len (result, chunk->data, chunk->size);
+      g_free (chunk->data);
+
+      g_slice_free (FileChunk, chunk);
+    }
+
+  g_queue_free (fb->chunks);
+  g_slice_free (FileBuilder, fb);
+
+  return result;
+}
+
+GBytes *
+gvdb_table_get_content (GHashTable     *table,
+                        gboolean        byteswap)
+{
+  struct gvdb_pointer root;
+  FileBuilder *fb;
+  GString *str;
+  GBytes *res;
+
+  fb = file_builder_new (byteswap);
+  file_builder_add_hash (fb, table, &root);
+  str = file_builder_serialise (fb, root);
+
+  res = g_bytes_new_take (str->str, str->len);
+  g_string_free (str, FALSE);
+
+  return res;
+}
+
+gboolean
+gvdb_table_write_contents (GHashTable   *table,
+                           const gchar  *filename,
+                           gboolean      byteswap,
+                           GError      **error)
+{
+  GBytes *content;
+  gboolean status;
+
+  content = gvdb_table_get_content (table, byteswap);
+
+  status = g_file_set_contents (filename, g_bytes_get_data (content, NULL), g_bytes_get_size (content), error);
+
+  g_bytes_unref (content);
+
+  return status;
+}
diff --git a/common/gvdb/gvdb-builder.h b/common/gvdb/gvdb-builder.h
new file mode 100644 (file)
index 0000000..ad361dc
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __gvdb_builder_h__
+#define __gvdb_builder_h__
+
+#include <gio/gio.h>
+
+typedef struct _GvdbItem GvdbItem;
+
+G_GNUC_INTERNAL
+GHashTable *            gvdb_hash_table_new                             (GHashTable    *parent,
+                                                                         const gchar   *key);
+
+G_GNUC_INTERNAL
+GvdbItem *              gvdb_hash_table_insert                          (GHashTable    *table,
+                                                                         const gchar   *key);
+G_GNUC_INTERNAL
+void                    gvdb_hash_table_insert_string                   (GHashTable    *table,
+                                                                         const gchar   *key,
+                                                                         const gchar   *value);
+
+G_GNUC_INTERNAL
+void                    gvdb_item_set_value                             (GvdbItem      *item,
+                                                                         GVariant      *value);
+G_GNUC_INTERNAL
+void                    gvdb_item_set_hash_table                        (GvdbItem      *item,
+                                                                         GHashTable    *table);
+G_GNUC_INTERNAL
+void                    gvdb_item_set_parent                            (GvdbItem      *item,
+                                                                         GvdbItem      *parent);
+
+G_GNUC_INTERNAL
+gboolean                gvdb_table_write_contents                       (GHashTable     *table,
+                                                                         const gchar    *filename,
+                                                                         gboolean        byteswap,
+                                                                         GError        **error);
+
+G_GNUC_INTERNAL
+GBytes *                gvdb_table_get_content                          (GHashTable     *table,
+                                                                         gboolean        byteswap);
+
+
+#endif /* __gvdb_builder_h__ */
diff --git a/common/gvdb/gvdb-format.h b/common/gvdb/gvdb-format.h
new file mode 100644 (file)
index 0000000..486e854
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __gvdb_format_h__
+#define __gvdb_format_h__
+
+#include <glib.h>
+
+typedef struct { guint16 value; } guint16_le;
+typedef struct { guint32 value; } guint32_le;
+
+struct gvdb_pointer {
+  guint32_le start;
+  guint32_le end;
+};
+
+struct gvdb_hash_header {
+  guint32_le n_bloom_words;
+  guint32_le n_buckets;
+};
+
+struct gvdb_hash_item {
+  guint32_le hash_value;
+  guint32_le parent;
+
+  guint32_le key_start;
+  guint16_le key_size;
+  gchar type;
+  gchar unused;
+
+  union
+  {
+    struct gvdb_pointer pointer;
+    gchar direct[8];
+  } value;
+};
+
+struct gvdb_header {
+  guint32 signature[2];
+  guint32_le version;
+  guint32_le options;
+
+  struct gvdb_pointer root;
+};
+
+static inline guint32_le guint32_to_le (guint32 value) {
+  guint32_le result = { GUINT32_TO_LE (value) };
+  return result;
+}
+
+static inline guint32 guint32_from_le (guint32_le value) {
+  return GUINT32_FROM_LE (value.value);
+}
+
+static inline guint16_le guint16_to_le (guint16 value) {
+  guint16_le result = { GUINT16_TO_LE (value) };
+  return result;
+}
+
+static inline guint16 guint16_from_le (guint16_le value) {
+  return GUINT16_FROM_LE (value.value);
+}
+
+#define GVDB_SIGNATURE0 1918981703
+#define GVDB_SIGNATURE1 1953390953
+#define GVDB_SWAPPED_SIGNATURE0 GUINT32_SWAP_LE_BE (GVDB_SIGNATURE0)
+#define GVDB_SWAPPED_SIGNATURE1 GUINT32_SWAP_LE_BE (GVDB_SIGNATURE1)
+
+#endif /* __gvdb_format_h__ */
diff --git a/common/gvdb/gvdb-reader.c b/common/gvdb/gvdb-reader.c
new file mode 100644 (file)
index 0000000..08b5bc8
--- /dev/null
@@ -0,0 +1,718 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#include "gvdb-reader.h"
+#include "gvdb-format.h"
+
+#include <string.h>
+
+struct _GvdbTable {
+  GBytes *bytes;
+
+  const gchar *data;
+  gsize size;
+
+  gboolean byteswapped;
+  gboolean trusted;
+
+  const guint32_le *bloom_words;
+  guint32 n_bloom_words;
+  guint bloom_shift;
+
+  const guint32_le *hash_buckets;
+  guint32 n_buckets;
+
+  struct gvdb_hash_item *hash_items;
+  guint32 n_hash_items;
+};
+
+static const gchar *
+gvdb_table_item_get_key (GvdbTable                   *file,
+                         const struct gvdb_hash_item *item,
+                         gsize                       *size)
+{
+  guint32 start, end;
+
+  start = guint32_from_le (item->key_start);
+  *size = guint16_from_le (item->key_size);
+  end = start + *size;
+
+  if G_UNLIKELY (start > end || end > file->size)
+    return NULL;
+
+  return file->data + start;
+}
+
+static gconstpointer
+gvdb_table_dereference (GvdbTable                 *file,
+                        const struct gvdb_pointer *pointer,
+                        gint                       alignment,
+                        gsize                     *size)
+{
+  guint32 start, end;
+
+  start = guint32_from_le (pointer->start);
+  end = guint32_from_le (pointer->end);
+
+  if G_UNLIKELY (start > end || end > file->size || start & (alignment - 1))
+    return NULL;
+
+  *size = end - start;
+
+  return file->data + start;
+}
+
+static void
+gvdb_table_setup_root (GvdbTable                 *file,
+                       const struct gvdb_pointer *pointer)
+{
+  const struct gvdb_hash_header *header;
+  guint32 n_bloom_words;
+  guint32 n_buckets;
+  gsize size;
+
+  header = gvdb_table_dereference (file, pointer, 4, &size);
+
+  if G_UNLIKELY (header == NULL || size < sizeof *header)
+    return;
+
+  size -= sizeof *header;
+
+  n_bloom_words = guint32_from_le (header->n_bloom_words);
+  n_buckets = guint32_from_le (header->n_buckets);
+  n_bloom_words &= (1u << 27) - 1;
+
+  if G_UNLIKELY (n_bloom_words * sizeof (guint32_le) > size)
+    return;
+
+  file->bloom_words = (gpointer) (header + 1);
+  size -= n_bloom_words * sizeof (guint32_le);
+  file->n_bloom_words = n_bloom_words;
+
+  if G_UNLIKELY (n_buckets > G_MAXUINT / sizeof (guint32_le) ||
+                 n_buckets * sizeof (guint32_le) > size)
+    return;
+
+  file->hash_buckets = file->bloom_words + file->n_bloom_words;
+  size -= n_buckets * sizeof (guint32_le);
+  file->n_buckets = n_buckets;
+
+  if G_UNLIKELY (size % sizeof (struct gvdb_hash_item))
+    return;
+
+  file->hash_items = (gpointer) (file->hash_buckets + n_buckets);
+  file->n_hash_items = size / sizeof (struct gvdb_hash_item);
+}
+
+/**
+ * gvdb_table_new_from_bytes:
+ * @bytes: the #GBytes with the data
+ * @trusted: if the contents of @bytes are trusted
+ * @error: %NULL, or a pointer to a %NULL #GError
+ * @returns: a new #GvdbTable
+ *
+ * Creates a new #GvdbTable from the contents of @bytes.
+ *
+ * This call can fail if the header contained in @bytes is invalid.
+ *
+ * You should call gvdb_table_free() on the return result when you no
+ * longer require it.
+ **/
+GvdbTable *
+gvdb_table_new_from_bytes (GBytes    *bytes,
+                           gboolean   trusted,
+                           GError   **error)
+{
+  const struct gvdb_header *header;
+  GvdbTable *file;
+
+  file = g_slice_new0 (GvdbTable);
+  file->bytes = g_bytes_ref (bytes);
+  file->data = g_bytes_get_data (bytes, &file->size);
+  file->trusted = trusted;
+
+  if (file->size < sizeof (struct gvdb_header))
+    goto invalid;
+
+  header = (gpointer) file->data;
+
+  if (header->signature[0] == GVDB_SIGNATURE0 &&
+      header->signature[1] == GVDB_SIGNATURE1 &&
+      guint32_from_le (header->version) == 0)
+    file->byteswapped = FALSE;
+
+  else if (header->signature[0] == GVDB_SWAPPED_SIGNATURE0 &&
+           header->signature[1] == GVDB_SWAPPED_SIGNATURE1 &&
+           guint32_from_le (header->version) == 0)
+    file->byteswapped = TRUE;
+
+  else
+    goto invalid;
+
+  gvdb_table_setup_root (file, &header->root);
+
+  return file;
+
+invalid:
+  g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "invalid gvdb header");
+
+  g_bytes_unref (file->bytes);
+
+  g_slice_free (GvdbTable, file);
+
+  return NULL;
+}
+
+/**
+ * gvdb_table_new:
+ * @filename: a filename
+ * @trusted: if the contents of @bytes are trusted
+ * @error: %NULL, or a pointer to a %NULL #GError
+ * @returns: a new #GvdbTable
+ *
+ * Creates a new #GvdbTable using the #GMappedFile for @filename as the
+ * #GBytes.
+ **/
+GvdbTable *
+gvdb_table_new (const gchar  *filename,
+                gboolean      trusted,
+                GError      **error)
+{
+  GMappedFile *mapped;
+  GvdbTable *table;
+  GBytes *bytes;
+
+  mapped = g_mapped_file_new (filename, FALSE, error);
+  if (!mapped)
+    return NULL;
+
+  bytes = g_mapped_file_get_bytes (mapped);
+  table = gvdb_table_new_from_bytes (bytes, trusted, error);
+  g_mapped_file_unref (mapped);
+  g_bytes_unref (bytes);
+
+  g_prefix_error (error, "%s: ", filename);
+
+  return table;
+}
+
+static gboolean
+gvdb_table_bloom_filter (GvdbTable *file,
+                          guint32    hash_value)
+{
+  guint32 word, mask;
+
+  if (file->n_bloom_words == 0)
+    return TRUE;
+
+  word = (hash_value / 32) % file->n_bloom_words;
+  mask = 1 << (hash_value & 31);
+  mask |= 1 << ((hash_value >> file->bloom_shift) & 31);
+
+  return (guint32_from_le (file->bloom_words[word]) & mask) == mask;
+}
+
+static gboolean
+gvdb_table_check_name (GvdbTable             *file,
+                       struct gvdb_hash_item *item,
+                       const gchar           *key,
+                       guint                  key_length)
+{
+  const gchar *this_key;
+  gsize this_size;
+  guint32 parent;
+
+  this_key = gvdb_table_item_get_key (file, item, &this_size);
+
+  if G_UNLIKELY (this_key == NULL || this_size > key_length)
+    return FALSE;
+
+  key_length -= this_size;
+
+  if G_UNLIKELY (memcmp (this_key, key + key_length, this_size) != 0)
+    return FALSE;
+
+  parent = guint32_from_le (item->parent);
+  if (key_length == 0 && parent == 0xffffffffu)
+    return TRUE;
+
+  if G_LIKELY (parent < file->n_hash_items && this_size > 0)
+    return gvdb_table_check_name (file,
+                                   &file->hash_items[parent],
+                                   key, key_length);
+
+  return FALSE;
+}
+
+static const struct gvdb_hash_item *
+gvdb_table_lookup (GvdbTable   *file,
+                   const gchar *key,
+                   gchar        type)
+{
+  guint32 hash_value = 5381;
+  guint key_length;
+  guint32 bucket;
+  guint32 lastno;
+  guint32 itemno;
+
+  if G_UNLIKELY (file->n_buckets == 0 || file->n_hash_items == 0)
+    return NULL;
+
+  for (key_length = 0; key[key_length]; key_length++)
+    hash_value = (hash_value * 33) + ((signed char *) key)[key_length];
+
+  if (!gvdb_table_bloom_filter (file, hash_value))
+    return NULL;
+
+  bucket = hash_value % file->n_buckets;
+  itemno = guint32_from_le (file->hash_buckets[bucket]);
+
+  if (bucket == file->n_buckets - 1 ||
+      (lastno = guint32_from_le(file->hash_buckets[bucket + 1])) > file->n_hash_items)
+    lastno = file->n_hash_items;
+
+  while G_LIKELY (itemno < lastno)
+    {
+      struct gvdb_hash_item *item = &file->hash_items[itemno];
+
+      if (hash_value == guint32_from_le (item->hash_value))
+        if G_LIKELY (gvdb_table_check_name (file, item, key, key_length))
+          if G_LIKELY (item->type == type)
+            return item;
+
+      itemno++;
+    }
+
+  return NULL;
+}
+
+static gboolean
+gvdb_table_list_from_item (GvdbTable                    *table,
+                           const struct gvdb_hash_item  *item,
+                           const guint32_le            **list,
+                           guint                        *length)
+{
+  gsize size;
+
+  *list = gvdb_table_dereference (table, &item->value.pointer, 4, &size);
+
+  if G_LIKELY (*list == NULL || size % 4)
+    return FALSE;
+
+  *length = size / 4;
+
+  return TRUE;
+}
+
+/**
+ * gvdb_table_get_names:
+ * @table: a #GvdbTable
+ * @length: the number of items returned, or %NULL
+ *
+ * Gets a list of all names contained in @table.
+ *
+ * No call to gvdb_table_get_table(), gvdb_table_list() or
+ * gvdb_table_get_value() will succeed unless it is for one of the
+ * names returned by this function.
+ *
+ * Note that some names that are returned may still fail for all of the
+ * above calls in the case of the corrupted file.  Note also that the
+ * returned strings may not be utf8.
+ *
+ * Returns: a %NULL-terminated list of strings, of length @length
+ **/
+gchar **
+gvdb_table_get_names (GvdbTable *table,
+                      gint      *length)
+{
+  gchar **names;
+  gint n_names;
+  gint filled;
+  gint total;
+  gint i;
+
+  /* We generally proceed by iterating over the list of items in the
+   * hash table (in order of appearance) recording them into an array.
+   *
+   * Each item has a parent item (except root items).  The parent item
+   * forms part of the name of the item.  We could go fetching the
+   * parent item chain at the point that we encounter each item but then
+   * we would need to implement some sort of recursion along with checks
+   * for self-referential items.
+   *
+   * Instead, we do a number of passes.  Each pass will build up one
+   * level of names (starting from the root).  We continue to do passes
+   * until no more items are left.  The first pass will only add root
+   * items and each further pass will only add items whose direct parent
+   * is an item added in the immediately previous pass.  It's also
+   * possible that items get filled if they follow their parent within a
+   * particular pass.
+   *
+   * At most we will have a number of passes equal to the depth of the
+   * tree.  Self-referential items will never be filled in (since their
+   * parent will have never been filled in).  We continue until we have
+   * a pass that fills in no additional items.
+   *
+   * This takes an O(n) algorithm and turns it into O(n*m) where m is
+   * the depth of the tree, but in all sane cases the tree won't be very
+   * deep and the constant factor of this algorithm is lower (and the
+   * complexity of coding it, as well).
+   */
+
+  n_names = table->n_hash_items;
+  names = g_new0 (gchar *, n_names + 1);
+
+  /* 'names' starts out all-NULL.  On each pass we record the number
+   * of items changed from NULL to non-NULL in 'filled' so we know if we
+   * should repeat the loop.  'total' counts the total number of items
+   * filled.  If 'total' ends up equal to 'n_names' then we know that
+   * 'names' has been completely filled.
+   */
+
+  total = 0;
+  do
+    {
+      /* Loop until we have filled no more entries */
+      filled = 0;
+
+      for (i = 0; i < n_names; i++)
+        {
+          const struct gvdb_hash_item *item = &table->hash_items[i];
+          const gchar *name;
+          gsize name_length;
+          guint32 parent;
+
+          /* already got it on a previous pass */
+          if (names[i] != NULL)
+            continue;
+
+          parent = guint32_from_le (item->parent);
+
+          if (parent == 0xffffffffu)
+            {
+              /* it's a root item */
+              name = gvdb_table_item_get_key (table, item, &name_length);
+
+              if (name != NULL)
+                {
+                  names[i] = g_strndup (name, name_length);
+                  filled++;
+                }
+            }
+
+          else if (parent < n_names && names[parent] != NULL)
+            {
+              /* It's a non-root item whose parent was filled in already.
+               *
+               * Calculate the name of this item by combining it with
+               * its parent name.
+               */
+              name = gvdb_table_item_get_key (table, item, &name_length);
+
+              if (name != NULL)
+                {
+                  const gchar *parent_name = names[parent];
+                  gsize parent_length;
+                  gchar *fullname;
+
+                  parent_length = strlen (parent_name);
+                  fullname = g_malloc (parent_length + name_length + 1);
+                  memcpy (fullname, parent_name, parent_length);
+                  memcpy (fullname + parent_length, name, name_length);
+                  fullname[parent_length + name_length] = '\0';
+                  names[i] = fullname;
+                  filled++;
+                }
+            }
+        }
+
+      total += filled;
+    }
+  while (filled && total < n_names);
+
+  /* If the table was corrupted then 'names' may have holes in it.
+   * Collapse those.
+   */
+  if G_UNLIKELY (total != n_names)
+    {
+      GPtrArray *fixed_names;
+
+      fixed_names = g_ptr_array_new ();
+      for (i = 0; i < n_names; i++)
+        if (names[i] != NULL)
+          g_ptr_array_add (fixed_names, names[i]);
+
+      g_free (names);
+      n_names = fixed_names->len;
+      g_ptr_array_add (fixed_names, NULL);
+      names = (gchar **) g_ptr_array_free (fixed_names, FALSE);
+    }
+
+  if (length)
+    *length = n_names;
+
+  return names;
+}
+
+/**
+ * gvdb_table_list:
+ * @file: a #GvdbTable
+ * @key: a string
+ * @returns: a %NULL-terminated string array
+ *
+ * List all of the keys that appear below @key.  The nesting of keys
+ * within the hash file is defined by the program that created the hash
+ * file.  One thing is constant: each item in the returned array can be
+ * concatenated to @key to obtain the full name of that key.
+ *
+ * It is not possible to tell from this function if a given key is
+ * itself a path, a value, or another hash table; you are expected to
+ * know this for yourself.
+ *
+ * You should call g_strfreev() on the return result when you no longer
+ * require it.
+ **/
+gchar **
+gvdb_table_list (GvdbTable   *file,
+                 const gchar *key)
+{
+  const struct gvdb_hash_item *item;
+  const guint32_le *list;
+  gchar **strv;
+  guint length;
+  guint i;
+
+  if ((item = gvdb_table_lookup (file, key, 'L')) == NULL)
+    return NULL;
+
+  if (!gvdb_table_list_from_item (file, item, &list, &length))
+    return NULL;
+
+  strv = g_new (gchar *, length + 1);
+  for (i = 0; i < length; i++)
+    {
+      guint32 itemno = guint32_from_le (list[i]);
+
+      if (itemno < file->n_hash_items)
+        {
+          const struct gvdb_hash_item *item;
+          const gchar *string;
+          gsize strsize;
+
+          item = file->hash_items + itemno;
+
+          string = gvdb_table_item_get_key (file, item, &strsize);
+
+          if (string != NULL)
+            strv[i] = g_strndup (string, strsize);
+          else
+            strv[i] = g_malloc0 (1);
+        }
+      else
+        strv[i] = g_malloc0 (1);
+    }
+
+  strv[i] = NULL;
+
+  return strv;
+}
+
+/**
+ * gvdb_table_has_value:
+ * @file: a #GvdbTable
+ * @key: a string
+ * @returns: %TRUE if @key is in the table
+ *
+ * Checks for a value named @key in @file.
+ *
+ * Note: this function does not consider non-value nodes (other hash
+ * tables, for example).
+ **/
+gboolean
+gvdb_table_has_value (GvdbTable    *file,
+                      const gchar  *key)
+{
+  static const struct gvdb_hash_item *item;
+  gsize size;
+
+  item = gvdb_table_lookup (file, key, 'v');
+
+  if (item == NULL)
+    return FALSE;
+
+  return gvdb_table_dereference (file, &item->value.pointer, 8, &size) != NULL;
+}
+
+static GVariant *
+gvdb_table_value_from_item (GvdbTable                   *table,
+                            const struct gvdb_hash_item *item)
+{
+  GVariant *variant, *value;
+  gconstpointer data;
+  GBytes *bytes;
+  gsize size;
+
+  data = gvdb_table_dereference (table, &item->value.pointer, 8, &size);
+
+  if G_UNLIKELY (data == NULL)
+    return NULL;
+
+  bytes = g_bytes_new_from_bytes (table->bytes, ((gchar *) data) - table->data, size);
+  variant = g_variant_new_from_bytes (G_VARIANT_TYPE_VARIANT, bytes, table->trusted);
+  value = g_variant_get_variant (variant);
+  g_variant_unref (variant);
+  g_bytes_unref (bytes);
+
+  return value;
+}
+
+/**
+ * gvdb_table_get_value:
+ * @file: a #GvdbTable
+ * @key: a string
+ * @returns: a #GVariant, or %NULL
+ *
+ * Looks up a value named @key in @file.
+ *
+ * If the value is not found then %NULL is returned.  Otherwise, a new
+ * #GVariant instance is returned.  The #GVariant does not depend on the
+ * continued existence of @file.
+ *
+ * You should call g_variant_unref() on the return result when you no
+ * longer require it.
+ **/
+GVariant *
+gvdb_table_get_value (GvdbTable    *file,
+                      const gchar  *key)
+{
+  const struct gvdb_hash_item *item;
+  GVariant *value;
+
+  if ((item = gvdb_table_lookup (file, key, 'v')) == NULL)
+    return NULL;
+
+  value = gvdb_table_value_from_item (file, item);
+
+  if (value && file->byteswapped)
+    {
+      GVariant *tmp;
+
+      tmp = g_variant_byteswap (value);
+      g_variant_unref (value);
+      value = tmp;
+    }
+
+  return value;
+}
+
+/**
+ * gvdb_table_get_raw_value:
+ * @table: a #GvdbTable
+ * @key: a string
+ * @returns: a #GVariant, or %NULL
+ *
+ * Looks up a value named @key in @file.
+ *
+ * This call is equivalent to gvdb_table_get_value() except that it
+ * never byteswaps the value.
+ **/
+GVariant *
+gvdb_table_get_raw_value (GvdbTable   *table,
+                          const gchar *key)
+{
+  const struct gvdb_hash_item *item;
+
+  if ((item = gvdb_table_lookup (table, key, 'v')) == NULL)
+    return NULL;
+
+  return gvdb_table_value_from_item (table, item);
+}
+
+/**
+ * gvdb_table_get_table:
+ * @file: a #GvdbTable
+ * @key: a string
+ * @returns: a new #GvdbTable, or %NULL
+ *
+ * Looks up the hash table named @key in @file.
+ *
+ * The toplevel hash table in a #GvdbTable can contain reference to
+ * child hash tables (and those can contain further references...).
+ *
+ * If @key is not found in @file then %NULL is returned.  Otherwise, a
+ * new #GvdbTable is returned, referring to the child hashtable as
+ * contained in the file.  This newly-created #GvdbTable does not depend
+ * on the continued existence of @file.
+ *
+ * You should call gvdb_table_free() on the return result when you no
+ * longer require it.
+ **/
+GvdbTable *
+gvdb_table_get_table (GvdbTable   *file,
+                      const gchar *key)
+{
+  const struct gvdb_hash_item *item;
+  GvdbTable *new;
+
+  item = gvdb_table_lookup (file, key, 'H');
+
+  if (item == NULL)
+    return NULL;
+
+  new = g_slice_new0 (GvdbTable);
+  new->bytes = g_bytes_ref (file->bytes);
+  new->byteswapped = file->byteswapped;
+  new->trusted = file->trusted;
+  new->data = file->data;
+  new->size = file->size;
+
+  gvdb_table_setup_root (new, &item->value.pointer);
+
+  return new;
+}
+
+/**
+ * gvdb_table_free:
+ * @file: a #GvdbTable
+ *
+ * Frees @file.
+ **/
+void
+gvdb_table_free (GvdbTable *file)
+{
+  g_bytes_unref (file->bytes);
+  g_slice_free (GvdbTable, file);
+}
+
+/**
+ * gvdb_table_is_valid:
+ * @table: a #GvdbTable
+ * @returns: %TRUE if @table is still valid
+ *
+ * Checks if the table is still valid.
+ *
+ * An on-disk GVDB can be marked as invalid.  This happens when the file
+ * has been replaced.  The appropriate action is typically to reopen the
+ * file.
+ **/
+gboolean
+gvdb_table_is_valid (GvdbTable *table)
+{
+  return !!*table->data;
+}
diff --git a/common/gvdb/gvdb-reader.h b/common/gvdb/gvdb-reader.h
new file mode 100644 (file)
index 0000000..241b41a
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2010 Codethink Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#ifndef __gvdb_reader_h__
+#define __gvdb_reader_h__
+
+#include <glib.h>
+
+typedef struct _GvdbTable GvdbTable;
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL
+GvdbTable *             gvdb_table_new_from_bytes                       (GBytes       *bytes,
+                                                                         gboolean      trusted,
+                                                                         GError      **error);
+G_GNUC_INTERNAL
+GvdbTable *             gvdb_table_new                                  (const gchar  *filename,
+                                                                         gboolean      trusted,
+                                                                         GError      **error);
+G_GNUC_INTERNAL
+void                    gvdb_table_free                                 (GvdbTable    *table);
+G_GNUC_INTERNAL
+gchar **                gvdb_table_get_names                            (GvdbTable    *table,
+                                                                         gint         *length);
+G_GNUC_INTERNAL
+gchar **                gvdb_table_list                                 (GvdbTable    *table,
+                                                                         const gchar  *key);
+G_GNUC_INTERNAL
+GvdbTable *             gvdb_table_get_table                            (GvdbTable    *table,
+                                                                         const gchar  *key);
+G_GNUC_INTERNAL
+GVariant *              gvdb_table_get_raw_value                        (GvdbTable    *table,
+                                                                         const gchar  *key);
+G_GNUC_INTERNAL
+GVariant *              gvdb_table_get_value                            (GvdbTable    *table,
+                                                                         const gchar  *key);
+
+G_GNUC_INTERNAL
+gboolean                gvdb_table_has_value                            (GvdbTable    *table,
+                                                                         const gchar  *key);
+G_GNUC_INTERNAL
+gboolean                gvdb_table_is_valid                             (GvdbTable    *table);
+
+G_END_DECLS
+
+#endif /* __gvdb_reader_h__ */
diff --git a/compile b/compile
new file mode 100755 (executable)
index 0000000..a85b723
--- /dev/null
+++ b/compile
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""       $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+       # lazily determine how to convert abs files
+       case `uname -s` in
+         MINGW*)
+           file_conv=mingw
+           ;;
+         CYGWIN*)
+           file_conv=cygwin
+           ;;
+         *)
+           file_conv=wine
+           ;;
+       esac
+      fi
+      case $file_conv/,$2, in
+       *,$file_conv,*)
+         ;;
+       mingw/*)
+         file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+         ;;
+       cygwin/*)
+         file=`cygpath -m "$file" || echo "$file"`
+         ;;
+       wine/*)
+         file=`winepath -w "$file" || echo "$file"`
+         ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+  func_file_conv "$1"
+  if test -z "$lib_path"; then
+    lib_path=$file
+  else
+    lib_path="$lib_path;$file"
+  fi
+  linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+  lib=$1
+  found=no
+  save_IFS=$IFS
+  IFS=';'
+  for dir in $lib_path $LIB
+  do
+    IFS=$save_IFS
+    if $shared && test -f "$dir/$lib.dll.lib"; then
+      found=yes
+      lib=$dir/$lib.dll.lib
+      break
+    fi
+    if test -f "$dir/$lib.lib"; then
+      found=yes
+      lib=$dir/$lib.lib
+      break
+    fi
+    if test -f "$dir/lib$lib.a"; then
+      found=yes
+      lib=$dir/lib$lib.a
+      break
+    fi
+  done
+  IFS=$save_IFS
+
+  if test "$found" != yes; then
+    lib=$lib.lib
+  fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+       -o)
+         # configure might choose to run compile as 'compile cc -o foo foo.c'.
+         eat=1
+         case $2 in
+           *.o | *.[oO][bB][jJ])
+             func_file_conv "$2"
+             set x "$@" -Fo"$file"
+             shift
+             ;;
+           *)
+             func_file_conv "$2"
+             set x "$@" -Fe"$file"
+             shift
+             ;;
+         esac
+         ;;
+       -I)
+         eat=1
+         func_file_conv "$2" mingw
+         set x "$@" -I"$file"
+         shift
+         ;;
+       -I*)
+         func_file_conv "${1#-I}" mingw
+         set x "$@" -I"$file"
+         shift
+         ;;
+       -l)
+         eat=1
+         func_cl_dashl "$2"
+         set x "$@" "$lib"
+         shift
+         ;;
+       -l*)
+         func_cl_dashl "${1#-l}"
+         set x "$@" "$lib"
+         shift
+         ;;
+       -L)
+         eat=1
+         func_cl_dashL "$2"
+         ;;
+       -L*)
+         func_cl_dashL "${1#-L}"
+         ;;
+       -static)
+         shared=false
+         ;;
+       -Wl,*)
+         arg=${1#-Wl,}
+         save_ifs="$IFS"; IFS=','
+         for flag in $arg; do
+           IFS="$save_ifs"
+           linker_opts="$linker_opts $flag"
+         done
+         IFS="$save_ifs"
+         ;;
+       -Xlinker)
+         eat=1
+         linker_opts="$linker_opts $2"
+         ;;
+       -*)
+         set x "$@" "$1"
+         shift
+         ;;
+       *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+         func_file_conv "$1"
+         set x "$@" -Tp"$file"
+         shift
+         ;;
+       *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+         func_file_conv "$1" mingw
+         set x "$@" "$file"
+         shift
+         ;;
+       *)
+         set x "$@" "$1"
+         shift
+         ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
+case $1 in
+  '')
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as 'compile cc -o foo foo.c'.
+       # So we strip '-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no '-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # '.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/completion/flatpak b/completion/flatpak
new file mode 100755 (executable)
index 0000000..b90ef09
--- /dev/null
@@ -0,0 +1,40 @@
+# Check for bash
+[ -z "$BASH_VERSION" ] && return
+
+####################################################################################################
+
+__flatpak() {
+    local IFS=$'\n'
+    local cur=`_get_cword :`
+    RES=($(flatpak complete "${COMP_LINE}" "${COMP_POINT}" "${cur}"))
+
+    COMPREPLY=()
+    for i in "${!RES[@]}"; do
+        if [[ "${RES[$i]}" = "__FLATPAK_FILE" ]]; then
+            declare -a COMPGEN_OPTS=('-f')
+        elif [[ "${RES[$i]}" = "__FLATPAK_BUNDLE_FILE" ]]; then
+            declare -a COMPGEN_OPTS=('-f' '-G' '*.flatpak')
+        elif [[ "${RES[$i]}" = "__FLATPAK_BUNDLE_OR_REF_FILE" ]]; then
+            declare -a COMPGEN_OPTS=('-f' '-G' '*.flatpak@(|ref)')
+        elif [[ "${RES[$i]}" = "__FLATPAK_DIR" ]]; then
+            declare -a COMPGEN_OPTS=('-d')
+        else
+            declare -a COMPGEN_OPTS=()
+        fi
+
+        if [[ ${#COMPGEN_OPTS[@]} -ne 0 ]]; then
+            if [[ "${cur}" = "=" ]]; then
+                CUR=""
+            else
+                CUR="${cur}"
+            fi
+            COMPREPLY=("${COMPREPLY[@]}" $(compgen ${COMPGEN_OPTS[@]} -- "${CUR}") )
+        else
+            COMPREPLY=("${COMPREPLY[@]}" "${RES[$i]}")
+        fi
+    done
+}
+
+####################################################################################################
+
+complete -o nospace -F __flatpak flatpak
diff --git a/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..2e9ad7f
--- /dev/null
@@ -0,0 +1,1462 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
+
+timestamp='2016-10-02'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+#
+# Please send patches to <config-patches@gnu.org>.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2016 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+       # If the system lacks a compiler, then just pick glibc.
+       # We could probably try harder.
+       LIBC=gnu
+
+       eval $set_cc_for_build
+       cat <<-EOF > $dummy.c
+       #include <features.h>
+       #if defined(__UCLIBC__)
+       LIBC=uclibc
+       #elif defined(__dietlibc__)
+       LIBC=dietlibc
+       #else
+       LIBC=gnu
+       #endif
+       EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+       ;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+           /sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || \
+           echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
+           earmv*)
+               arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+               endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+               machine=${arch}${endian}-unknown
+               ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently (or will in the future) and ABI.
+       case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               os=netbsdelf
+               ;;
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep -q __ELF__
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # Determine ABI tags.
+       case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+               abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}${abi}"
+       exit ;;
+    *:Bitrig:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:LibertyBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:Sortix:*:*)
+       echo ${UNAME_MACHINE}-unknown-sortix
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE=alpha ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE=alpha ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE=alpha ;;
+           "EV5 (21164)")
+               UNAME_MACHINE=alphaev5 ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE=alphaev56 ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE=alphapca56 ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE=alphapca57 ;;
+           "EV6 (21264)")
+               UNAME_MACHINE=alphaev6 ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE=alphaev67 ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE=alphaev68 ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE=alphaev68 ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE=alphaev68 ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE=alphaev69 ;;
+           "EV7 (21364)")
+               UNAME_MACHINE=alphaev7 ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE=alphaev79 ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+       echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    s390x:SunOS:*:*)
+       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+       eval $set_cc_for_build
+       SUN_ARCH=i386
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH=x86_64
+           fi
+       fi
+       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[4567])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/lslpp ] ; then
+               IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+                          awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH=hppa2.0n ;;
+                         64) HP_ARCH=hppa2.0w ;;
+                         '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
+                       esac ;;
+                   esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^            //' << EOF >$dummy.c
+
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
+
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
+
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
+EOF
+                   (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = hppa2.0w ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep -q __LP64__
+           then
+               HP_ARCH=hppa2.0w
+           else
+               HP_ARCH=hppa64
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+       exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+       exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+       exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+       exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    5000:UNIX_System_V:4.*:*)
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       case ${UNAME_PROCESSOR} in
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    *:MINGW64*:*)
+       echo ${UNAME_MACHINE}-pc-mingw64
+       exit ;;
+    *:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    *:MSYS*:*)
+       echo ${UNAME_MACHINE}-pc-msys
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           authenticamd | genuineintel | EM64T)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    8664:Windows_NT:*)
+       echo x86_64-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    aarch64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    aarch64_be:Linux:*:*)
+       UNAME_MACHINE=aarch64_be
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+       esac
+       objdump --private-headers /bin/sh | grep -q ld.so.1
+       if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       else
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+           fi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    cris:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+       exit ;;
+    crisv32:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+       exit ;;
+    e2k:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    frv:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    hexagon:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    i*86:Linux:*:*)
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    k1om:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef ${UNAME_MACHINE}
+       #undef ${UNAME_MACHINE}el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=${UNAME_MACHINE}el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=${UNAME_MACHINE}
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+       ;;
+    mips64el:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    openrisc*:Linux:*:*)
+       echo or1k-unknown-linux-${LIBC}
+       exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-${LIBC}
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+         PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+         *)    echo hppa-unknown-linux-${LIBC} ;;
+       esac
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-${LIBC}
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-${LIBC}
+       exit ;;
+    ppc64le:Linux:*:*)
+       echo powerpc64le-unknown-linux-${LIBC}
+       exit ;;
+    ppcle:Linux:*:*)
+       echo powerpcle-unknown-linux-${LIBC}
+       exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+       exit ;;
+    x86_64:Linux:*:*)
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+       # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
+       # Note: whatever this is, it MUST be the same as what config.sub
+       # prints for the "djgpp" host, or else GDB configure will decide that
+       # this is a cross-build.
+       echo i586-pc-msdosdjgpp
+       exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+       exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
+    x86_64:Haiku:*:*)
+       echo x86_64-unknown-haiku
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-ACE:SUPER-UX:*:*)
+       echo sxace-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       eval $set_cc_for_build
+       if test "$UNAME_PROCESSOR" = unknown ; then
+           UNAME_PROCESSOR=powerpc
+       fi
+       if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+           if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+               if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+                   grep IS_64BIT_ARCH >/dev/null
+               then
+                   case $UNAME_PROCESSOR in
+                       i386) UNAME_PROCESSOR=x86_64 ;;
+                       powerpc) UNAME_PROCESSOR=powerpc64 ;;
+                   esac
+               fi
+           fi
+       elif test "$UNAME_PROCESSOR" = i386 ; then
+           # Avoid executing cc on OS X 10.9, as it ships with a stub
+           # that puts up a graphical alert prompting to install
+           # developer tools.  Any system running Mac OS X 10.7 or
+           # later (Darwin 11 and later) is required to have a 64-bit
+           # processor. This is not true of the ARM version of Darwin
+           # that Apple uses in portable devices.
+           UNAME_PROCESSOR=x86_64
+       fi
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = x86; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = 386; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+       echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
+    x86_64:VMkernel:*:*)
+       echo ${UNAME_MACHINE}-unknown-esx
+       exit ;;
+    amd64:Isilon\ OneFS:*:*)
+       echo x86_64-unknown-onefs
+       exit ;;
+esac
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.h.in b/config.h.in
new file mode 100644 (file)
index 0000000..110aa86
--- /dev/null
@@ -0,0 +1,176 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if we should avoid using O_TMPFILE */
+#undef DISABLE_OTMPFILE
+
+/* Define if sandboxed triggers are disabled */
+#undef DISABLE_SANDBOXED_TRIGGERS
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#undef ENABLE_NLS
+
+/* Define if using seccomp */
+#undef ENABLE_SECCOMP
+
+/* Define if we should be compatible with wrpseudo */
+#undef ENABLE_WRPSEUDO_COMPAT
+
+/* Define if using xauth */
+#undef ENABLE_XAUTH
+
+/* Define if peer to peer support should be enabled */
+#undef FLATPAK_ENABLE_P2P
+
+/* defines how to decorate public symbols while building */
+#undef FLATPAK_EXTERN
+
+/* gettext domain */
+#undef GETTEXT_PACKAGE
+
+/* Define to 1 if you have the `archive_read_support_filter_all' function. */
+#undef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
+
+/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+#undef HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#undef HAVE_DCGETTEXT
+
+/* Define to 1 if you have the declaration of `memfd_create', and to 0 if you
+   don't. */
+#undef HAVE_DECL_MEMFD_CREATE
+
+/* Define to 1 if you have the declaration of `renameat2', and to 0 if you
+   don't. */
+#undef HAVE_DECL_RENAMEAT2
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `fdwalk' function. */
+#undef HAVE_FDWALK
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#undef HAVE_GETTEXT
+
+/* Define if you have the iconv() function and it works. */
+#undef HAVE_ICONV
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#undef LT_OBJDIR
+
+/* Define if libostree experimental API should be enabled */
+#undef OSTREE_ENABLE_EXPERIMENTAL_API
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Extra version */
+#undef PACKAGE_EXTRA_VERSION
+
+/* Major version */
+#undef PACKAGE_MAJOR_VERSION
+
+/* Micro version */
+#undef PACKAGE_MICRO_VERSION
+
+/* Minor version */
+#undef PACKAGE_MINOR_VERSION
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define if using system-helper */
+#undef USE_SYSTEM_HELPER
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
diff --git a/config.rpath b/config.rpath
new file mode 100755 (executable)
index 0000000..c38b914
--- /dev/null
@@ -0,0 +1,690 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2013 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   This file is free software; the Free Software Foundation gives
+#   unlimited permission to copy and/or distribute it, with or without
+#   modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a '.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's _LT_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+        ecc*)
+          wl='-Wl,'
+          ;;
+        icc* | ifort*)
+          wl='-Wl,'
+          ;;
+        lf95*)
+          wl='-Wl,'
+          ;;
+        nagfor*)
+          wl='-Wl,-Wl,,'
+          ;;
+        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        xl* | bgxl* | bgf* | mpixl*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+        *)
+          case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ F* | *Sun*Fortran*)
+              wl=
+              ;;
+            *Sun\ C*)
+              wl='-Wl,'
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+    newsos6)
+      ;;
+    *nto* | *qnx*)
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    rdos*)
+      ;;
+    solaris*)
+      case $cc_basename in
+        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+          wl='-Qoption ld '
+          ;;
+        *)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      wl='-Wl,'
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # Set some defaults for GNU ld with shared library support. These
+  # are reset later if shared libraries are not supported. Putting them
+  # here allows them to be overridden if necessary.
+  # Unlike libtool, we use -rpath here, not --rpath, since the documented
+  # option of GNU ld is called -rpath, not --rpath.
+  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  case "$host_os" in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32* | cegcc*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    haiku*)
+      ;;
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      ;;
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+          ld_shlibs=no
+          ;;
+        *)
+          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+          else
+            ld_shlibs=no
+          fi
+          ;;
+      esac
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = no; then
+    hardcode_libdir_flag_spec=
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+          ;;
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            :
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+          ;;
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        hardcode_direct=yes
+        # hardcode_minus_L: Not really in the search PATH,
+        # but as the default location of the library.
+        hardcode_minus_L=yes
+      fi
+      ;;
+    hpux11*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct=no
+            ;;
+          *)
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    *nto* | *qnx*)
+      ;;
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+        hardcode_direct=yes
+        if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        else
+          case "$host_os" in
+            openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+              hardcode_libdir_flag_spec='-R$libdir'
+              ;;
+            *)
+              hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+              ;;
+          esac
+        fi
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      ;;
+    sysv5* | sco3.2v5* | sco5v6*)
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    library_names_spec='$libname.a'
+    ;;
+  aix[4-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  amigaos*)
+    case "$host_cpu" in
+      powerpc*)
+        library_names_spec='$libname$shrext' ;;
+      m68k)
+        library_names_spec='$libname.a' ;;
+    esac
+    ;;
+  beos*)
+    library_names_spec='$libname$shrext'
+    ;;
+  bsdi[45]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  cygwin* | mingw* | pw32* | cegcc*)
+    shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    library_names_spec='$libname$shrext'
+    ;;
+  dgux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd* | dragonfly*)
+    case "$host_os" in
+      freebsd[123]*)
+        library_names_spec='$libname$shrext$versuffix' ;;
+      *)
+        library_names_spec='$libname$shrext' ;;
+    esac
+    ;;
+  gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  haiku*)
+    library_names_spec='$libname$shrext'
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case $host_cpu in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    library_names_spec='$libname$shrext'
+    ;;
+  interix[3-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  netbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  newsos6)
+    library_names_spec='$libname$shrext'
+    ;;
+  *nto* | *qnx*)
+    library_names_spec='$libname$shrext'
+    ;;
+  openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    library_names_spec='$libname.a'
+    ;;
+  osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  rdos*)
+    ;;
+  solaris*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv4*MP*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  tpf*)
+    library_names_spec='$libname$shrext'
+    ;;
+  uts4*)
+    library_names_spec='$libname$shrext'
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..7b334f9
--- /dev/null
@@ -0,0 +1,1823 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
+
+timestamp='2016-09-05'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2016 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray | -microblaze*)
+               os=
+               basic_machine=$1
+               ;;
+       -bluegene*)
+               os=-cnk
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*178)
+               os=-lynxos178
+               ;;
+       -lynx*5)
+               os=-lynxos5
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | aarch64 | aarch64_be \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arceb \
+       | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+       | avr | avr32 \
+       | ba \
+       | be32 | be64 \
+       | bfin \
+       | c4x | c8051 | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | e2k | epiphany \
+       | fido | fr30 | frv | ft32 \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | hexagon \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | k1om \
+       | le32 | le64 \
+       | lm32 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64octeon | mips64octeonel \
+       | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa32r6 | mipsisa32r6el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64r6 | mipsisa64r6el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipsr5900 | mipsr5900el \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | moxie \
+       | mt \
+       | msp430 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 | nios2eb | nios2el \
+       | ns16k | ns32k \
+       | open8 | or1k | or1knd | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pyramid \
+       | riscv32 | riscv64 \
+       | rl78 | rx \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
+       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | visium \
+       | we32k \
+       | x86 | xc16x | xstormy16 | xtensa \
+       | z8k | z80)
+               basic_machine=$basic_machine-unknown
+               ;;
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       leon|leon[3-9])
+               basic_machine=sparc-$basic_machine
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+       xgate)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | aarch64-* | aarch64_be-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | ba-* \
+       | be32-* | be64-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
+       | c8051-* | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | e2k-* | elxsi-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | hexagon-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | k1om-* \
+       | le32-* | le64-* \
+       | lm32-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+       | microblaze-* | microblazeel-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64octeon-* | mips64octeonel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa32r6-* | mipsisa32r6el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64r6-* | mipsisa64r6el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipsr5900-* | mipsr5900el-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* | nios2eb-* | nios2el-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
+       | or1k*-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pyramid-* \
+       | riscv32-* | riscv64-* \
+       | rl78-* | romp-* | rs6000-* | rx-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
+       | tahoe-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile*-* \
+       | tron-* \
+       | ubicom32-* \
+       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+       | vax-* \
+       | visium-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | xstormy16-* | xtensa*-* \
+       | ymp-* \
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
+       asmjs)
+               basic_machine=asmjs-unknown
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       bluegene*)
+               basic_machine=powerpc-ibm
+               os=-cnk
+               ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16 | cr16-*)
+               basic_machine=cr16-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       e500v[12])
+               basic_machine=powerpc-unknown
+               os=$os"spe"
+               ;;
+       e500v[12]-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=$os"spe"
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       leon-*|leon[3-9]-*)
+               basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+               ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       microblaze*)
+               basic_machine=microblaze-xilinx
+               ;;
+       mingw64)
+               basic_machine=x86_64-pc
+               os=-mingw64
+               ;;
+       mingw32)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       moxiebox)
+               basic_machine=moxie-unknown
+               os=-moxiebox
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       msys)
+               basic_machine=i686-pc
+               os=-msys
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       nacl)
+               basic_machine=le32-unknown
+               os=-nacl
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc | ppcbe)    basic_machine=powerpc-unknown
+               ;;
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos | rdos64)
+               basic_machine=x86_64-pc
+               os=-rdos
+               ;;
+       rdos32)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tile*)
+               basic_machine=$basic_machine-unknown
+               os=-linux-gnu
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+       # First match some system type aliases
+       # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* | -plan9* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* | -aros* | -cloudabi* | -sortix* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+             | -onefs* | -tirtos* | -phoenix*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -dicos*)
+               os=-dicos
+               ;;
+       -nacl*)
+               ;;
+       -ios)
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       score-*)
+               os=-elf
+               ;;
+       spu-*)
+               os=-elf
+               ;;
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       c8051-*)
+               os=-elf
+               ;;
+       hexagon-*)
+               os=-elf
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mep-*)
+               os=-elf
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -cnk*|-aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..97a73b5
--- /dev/null
+++ b/configure
@@ -0,0 +1,20996 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for Flatpak 0.10.2.
+#
+# Report bugs to <https://github.com/flatpak/flatpak/issues>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+            # Try only shells that exist, to save several forks.
+            as_shell=$as_dir/$as_base
+            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+          done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: https://github.com/flatpak/flatpak/issues about your
+$0: system, including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='Flatpak'
+PACKAGE_TARNAME='flatpak'
+PACKAGE_VERSION='0.10.2'
+PACKAGE_STRING='Flatpak 0.10.2'
+PACKAGE_BUGREPORT='https://github.com/flatpak/flatpak/issues'
+PACKAGE_URL='http://flatpak.org/'
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_unique_file="common/flatpak-dir.c"
+gt_needs=
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+LT_CURRENT_MINUS_AGE
+LT_VERSION_INFO
+FLATPAK_VERSION
+FLATPAK_INTERFACE_AGE
+FLATPAK_MICRO_VERSION
+FLATPAK_MINOR_VERSION
+FLATPAK_MAJOR_VERSION
+installed_testdir
+installed_test_metadir
+ENABLE_ALWAYS_BUILD_TESTS_FALSE
+ENABLE_ALWAYS_BUILD_TESTS_TRUE
+ENABLE_INSTALLED_TESTS_FALSE
+ENABLE_INSTALLED_TESTS_TRUE
+HIDDEN_VISIBILITY_CFLAGS
+XMLTO_FLAGS
+DOCBOOK_DOCS_ENABLED_FALSE
+DOCBOOK_DOCS_ENABLED_TRUE
+XMLTO
+ENABLE_GTK_DOC_CHECK_FALSE
+ENABLE_GTK_DOC_CHECK_TRUE
+GTK_DOC_USE_REBASE_FALSE
+GTK_DOC_USE_REBASE_TRUE
+GTK_DOC_USE_LIBTOOL_FALSE
+GTK_DOC_USE_LIBTOOL_TRUE
+GTK_DOC_BUILD_PDF_FALSE
+GTK_DOC_BUILD_PDF_TRUE
+GTK_DOC_BUILD_HTML_FALSE
+GTK_DOC_BUILD_HTML_TRUE
+ENABLE_GTK_DOC_FALSE
+ENABLE_GTK_DOC_TRUE
+HAVE_GTK_DOC_FALSE
+HAVE_GTK_DOC_TRUE
+GTKDOC_DEPS_LIBS
+GTKDOC_DEPS_CFLAGS
+HTML_DIR
+GTKDOC_MKPDF
+GTKDOC_REBASE
+GTKDOC_CHECK_PATH
+GTKDOC_CHECK
+HAVE_INTROSPECTION_FALSE
+HAVE_INTROSPECTION_TRUE
+INTROSPECTION_MAKEFILE
+INTROSPECTION_LIBS
+INTROSPECTION_CFLAGS
+INTROSPECTION_TYPELIBDIR
+INTROSPECTION_GIRDIR
+INTROSPECTION_GENERATE
+INTROSPECTION_COMPILER
+INTROSPECTION_SCANNER
+BUILD_DOCUMENTATION_FALSE
+BUILD_DOCUMENTATION_TRUE
+XMLCATALOG
+XML_CATALOG_FILE
+XSLTPROC
+SYSTEM_INSTALL_DIR
+ENABLE_P2P_FALSE
+ENABLE_P2P_TRUE
+SUDO_BIN
+PRIV_MODE_SETUID_FALSE
+PRIV_MODE_SETUID_TRUE
+LIBSECCOMP_LIBS
+LIBSECCOMP_CFLAGS
+APPSTREAM_GLIB_LIBS
+APPSTREAM_GLIB_CFLAGS
+JSON_LIBS
+JSON_CFLAGS
+FUSE_LIBS
+FUSE_CFLAGS
+OSTREE_LIBS
+OSTREE_CFLAGS
+XAUTH_LIBS
+XAUTH_CFLAGS
+BUILD_SYSTEM_HELPER_FALSE
+BUILD_SYSTEM_HELPER_TRUE
+POLKIT_LIBS
+POLKIT_CFLAGS
+GPGME_PTHREAD_LIBS
+GPGME_PTHREAD_CFLAGS
+GPGME_CONFIG
+DEP_GPGME_LIBS
+DEP_GPGME_CFLAGS
+SOUP_LIBS
+SOUP_CFLAGS
+BASE_LIBS
+BASE_CFLAGS
+GDBUS_CODEGEN
+GLIB_COMPILE_RESOURCES
+GLIB_MKENUMS
+WITH_SYSTEM_BWRAP_FALSE
+WITH_SYSTEM_BWRAP_TRUE
+BWRAP
+PROFILE_DIR
+SYSTEM_FONT_CACHE_DIRS
+SYSTEM_FONTS_DIR
+systemdsystemunitdir
+systemduserunitdir
+DBUS_CONFIG_DIR
+DBUS_SERVICE_DIR
+PRIVILEGED_GROUP
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+VALGRIND_CHECK_RULES
+VALGRIND_HAVE_TOOL_memcheck
+VALGRIND_ENABLED
+VALGRIND_ENABLED_FALSE
+VALGRIND_ENABLED_TRUE
+VALGRIND
+WARN_CFLAGS
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+POSUB
+LTLIBINTL
+LIBINTL
+INTLLIBS
+LTLIBICONV
+LIBICONV
+INTL_MACOSX_LIBS
+XGETTEXT_EXTRA_OPTIONS
+MSGMERGE
+XGETTEXT_015
+XGETTEXT
+GMSGFMT_015
+MSGFMT_015
+GMSGFMT
+MSGFMT
+GETTEXT_MACRO_VERSION
+USE_NLS
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+LT_SYS_LIBRARY_PATH
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+AWK
+RANLIB
+STRIP
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBTOOL
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_largefile
+enable_static
+enable_shared
+with_pic
+enable_fast_install
+with_aix_soname
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+enable_dependency_tracking
+enable_silent_rules
+enable_nls
+enable_rpath
+with_libiconv_prefix
+with_libintl_prefix
+enable_maintainer_mode
+enable_valgrind
+with_privileged_group
+with_dbus_service_dir
+with_dbus_config_dir
+with_systemduserunitdir
+with_systemdsystemunitdir
+with_system_fonts_dir
+with_system_font_cache_dirs
+with_profile_dir
+with_system_bubblewrap
+enable_otmpfile
+enable_wrpseudo_compat
+with_gpgme_prefix
+enable_system_helper
+enable_xauth
+enable_sandboxed_triggers
+enable_seccomp
+with_priv_mode
+enable_sudo
+enable_p2p
+with_system_install_dir
+enable_documentation
+with_xml_catalog
+enable_introspection
+with_html_dir
+enable_gtk_doc
+enable_gtk_doc_html
+enable_gtk_doc_pdf
+enable_gtk_doc_check
+enable_docbook_docs
+enable_installed_tests
+enable_always_build_tests
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+LT_SYS_LIBRARY_PATH
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+BWRAP
+BASE_CFLAGS
+BASE_LIBS
+SOUP_CFLAGS
+SOUP_LIBS
+DEP_GPGME_CFLAGS
+DEP_GPGME_LIBS
+POLKIT_CFLAGS
+POLKIT_LIBS
+XAUTH_CFLAGS
+XAUTH_LIBS
+OSTREE_CFLAGS
+OSTREE_LIBS
+FUSE_CFLAGS
+FUSE_LIBS
+JSON_CFLAGS
+JSON_LIBS
+APPSTREAM_GLIB_CFLAGS
+APPSTREAM_GLIB_LIBS
+LIBSECCOMP_CFLAGS
+LIBSECCOMP_LIBS
+GTKDOC_DEPS_CFLAGS
+GTKDOC_DEPS_LIBS
+XMLTO
+XMLTO_FLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures Flatpak 0.10.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/flatpak]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of Flatpak 0.10.2:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-largefile     omit support for large files
+  --enable-static[=PKGS]  build static libraries [default=no]
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
+  --disable-nls           do not use Native Language Support
+  --disable-rpath         do not hardcode runtime library paths
+  --disable-maintainer-mode
+                          disable make rules and dependencies not useful (and
+                          sometimes confusing) to the casual installer
+  --enable-valgrind       Whether to enable Valgrind on the unit tests
+  --disable-otmpfile      Disable use of O_TMPFILE [default=no]
+  --enable-wrpseudo-compat
+                          Disable use syscall() and filesystem calls to for
+                          compatibility with wrpseudo [default=no]
+  --disable-system-helper Disable system helper
+  --disable-xauth         Disable Xauth use
+  --disable-sandboxed-triggers
+                          Disable sandboxed triggers
+  --disable-seccomp       Disable seccomp
+  --enable-sudo           Use sudo to set setuid flags on binaries during
+                          install (only needed if userns disabled)
+  --enable-p2p            Enable unstable peer to peer support [default=no]
+  --enable-documentation  Build documentation
+  --enable-introspection=[no/auto/yes]
+                          Enable introspection for this build
+  --enable-gtk-doc        use gtk-doc to build documentation [[default=no]]
+  --enable-gtk-doc-html   build documentation in html format [[default=yes]]
+  --enable-gtk-doc-pdf    build documentation in pdf format [[default=no]]
+  --enable-gtk-doc-check  Check completeness of documentation in 'make check'
+  --enable-docbook-docs   build documentation (requires xmlto)
+  --enable-installed-tests
+                          Enable installation of some test cases
+  --enable-always-build-tests
+                          Enable always building tests during 'make all'
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-aix-soname=aix|svr4|both
+                          shared library versioning (aka "SONAME") variant to
+                          provide on AIX, [default=aix].
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
+                          compiler's sysroot if not specified).
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
+  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
+  --without-libintl-prefix     don't search for libintl in includedir and libdir
+  --with-privileged-group=GROUP
+                          Name of privileged group, [default=wheel]
+  --with-dbus-service-dir=PATH
+                          choose directory for dbus service files,
+                          [default=PREFIX/share/dbus-1/services]
+  --with-dbus-config-dir=PATH
+                          choose directory for dbus config files,
+                          [default=SYSCONFDIR/dbus-1/system.d]
+  --with-systemduserunitdir=DIR
+                          Directory for systemd user service files
+                          (default=PREFIX/lib/systemd/user)
+  --with-systemdsystemunitdir=DIR
+                          Directory for systemd system service files
+                          (default=PREFIX/lib/systemd/system)
+  --with-system-fonts-dir=PATH
+                          Directory where system fonts are,
+                          [default=/usr/share/fonts]
+  --with-system-font-cache-dirs=PATHS
+                          Directory where the system font cache is,
+                          [default=/var/cache/fontconfig:/usr/lib/fontconfig/cache]
+  --with-profile-dir=PATH choose directory for profile.d files,
+                          [default=SYSCONFDIR/profile.d]
+  --with-system-bubblewrap
+                          Use system bwrap executable [default=check $BWRAP]
+  --with-gpgme-prefix=PFX prefix where GPGME is installed (optional)
+  --with-priv-mode=setuid/none
+                          How to set privilege-raising during install (only
+                          needed if userns not working)
+  --with-system-install-dir=DIR
+                          Location of system installation
+                          [LOCALSTATEDIR/lib/flatpak]
+  --with-xml-catalog=CATALOG
+                          path to xml catalog to use
+  --with-html-dir=PATH    path to installed docs
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  LT_SYS_LIBRARY_PATH
+              User-defined run-time library search path.
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
+  BWRAP       Bubblewrap executable
+  BASE_CFLAGS C compiler flags for BASE, overriding pkg-config
+  BASE_LIBS   linker flags for BASE, overriding pkg-config
+  SOUP_CFLAGS C compiler flags for SOUP, overriding pkg-config
+  SOUP_LIBS   linker flags for SOUP, overriding pkg-config
+  DEP_GPGME_CFLAGS
+              C compiler flags for DEP_GPGME, overriding pkg-config
+  DEP_GPGME_LIBS
+              linker flags for DEP_GPGME, overriding pkg-config
+  POLKIT_CFLAGS
+              C compiler flags for POLKIT, overriding pkg-config
+  POLKIT_LIBS linker flags for POLKIT, overriding pkg-config
+  XAUTH_CFLAGS
+              C compiler flags for XAUTH, overriding pkg-config
+  XAUTH_LIBS  linker flags for XAUTH, overriding pkg-config
+  OSTREE_CFLAGS
+              C compiler flags for OSTREE, overriding pkg-config
+  OSTREE_LIBS linker flags for OSTREE, overriding pkg-config
+  FUSE_CFLAGS C compiler flags for FUSE, overriding pkg-config
+  FUSE_LIBS   linker flags for FUSE, overriding pkg-config
+  JSON_CFLAGS C compiler flags for JSON, overriding pkg-config
+  JSON_LIBS   linker flags for JSON, overriding pkg-config
+  APPSTREAM_GLIB_CFLAGS
+              C compiler flags for APPSTREAM_GLIB, overriding pkg-config
+  APPSTREAM_GLIB_LIBS
+              linker flags for APPSTREAM_GLIB, overriding pkg-config
+  LIBSECCOMP_CFLAGS
+              C compiler flags for LIBSECCOMP, overriding pkg-config
+  LIBSECCOMP_LIBS
+              linker flags for LIBSECCOMP, overriding pkg-config
+  GTKDOC_DEPS_CFLAGS
+              C compiler flags for GTKDOC_DEPS, overriding pkg-config
+  GTKDOC_DEPS_LIBS
+              linker flags for GTKDOC_DEPS, overriding pkg-config
+  XMLTO       Define/override the 'xmlto' location.
+  XMLTO_FLAGS Define/override 'xmlto' options, like '--skip-validation'.
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <https://github.com/flatpak/flatpak/issues>.
+Flatpak home page: <http://flatpak.org/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+Flatpak configure 0.10.2
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## -------------------------------------------------------- ##
+## Report this to https://github.com/flatpak/flatpak/issues ##
+## -------------------------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Flatpak $as_me 0.10.2, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       $as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+gt_needs="$gt_needs "
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+GLIB_REQS=2.44
+SYSTEM_BWRAP_REQS=0.1.8
+OSTREE_REQS=2017.14
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
+    * )
+       break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+  if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
+else
+  ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+        # IRIX 6.2 and later do not support large files by default,
+        # so use the C compiler's -n32 option if that helps.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+        if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        CC="$CC -n32"
+        if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac
+else
+  enable_static=no
+fi
+
+
+
+
+
+
+
+
+
+
+
+case `pwd` in
+  *\ * | *\    *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.6'
+macro_revision='2.4.6'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain=$ac_aux_dir/ltmain.sh
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case $ECHO in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test yes = "$GCC"; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return, which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD=$ac_prog
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test yes = "$with_gnu_ld"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD=$ac_dir/$ac_prog
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test no != "$with_gnu_ld" && break
+       ;;
+      *)
+       test yes != "$with_gnu_ld" && break
+       ;;
+      esac
+    fi
+  done
+  IFS=$lt_save_ifs
+else
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
+fi
+fi
+
+LD=$lt_cv_path_LD
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM=$NM
+else
+  lt_nm_to_check=${ac_tool_prefix}nm
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS=$lt_save_ifs
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+       case $build_os in
+       mingw*) lt_bad_file=conftest.nm/nofile ;;
+       *) lt_bad_file=/dev/null ;;
+       esac
+       case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+       *$lt_bad_file* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break 2
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break 2
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS=$lt_save_ifs
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols -headers"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring=ABCD
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[         ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
+                = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+             test 17 != "$i" # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n "$lt_cv_sys_max_cmd_len"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test yes != "$GCC"; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# 'unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$AR" && break
+  done
+fi
+if test -z "$AR"; then
+  ac_ct_AR=$AR
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_AR" && break
+done
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test 0 -eq "$ac_status"; then
+       # Ensure the archiver fails upon bogus file names.
+       rm -f conftest.$ac_objext libconftest.a
+       { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+       if test 0 -ne "$ac_status"; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test no = "$lt_cv_ar_at_file"; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  bitrig* | openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test ia64 = "$host_cpu"; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[     ]\($symcode$symcode*\)[         ][      ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined __osf__
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+         cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+         $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_globsym_save_LIBS=$LIBS
+         lt_globsym_save_CFLAGS=$CFLAGS
+         LIBS=conftstm.$ac_objext
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest$ac_exeext; then
+           pipe_works=yes
+         fi
+         LIBS=$lt_globsym_save_LIBS
+         CFLAGS=$lt_globsym_save_CFLAGS
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test yes = "$pipe_works"; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case $with_sysroot in #(
+ yes)
+   if test yes = "$GCC"; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5
+$as_echo "$with_sysroot" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5
+$as_echo_n "checking for a working dd... " >&6; }
+if ${ac_cv_path_lt_DD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+if test -z "$lt_DD"; then
+  ac_path_lt_DD_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in dd; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_lt_DD" || continue
+if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi
+      $ac_path_lt_DD_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_lt_DD"; then
+    :
+  fi
+else
+  ac_cv_path_lt_DD=$lt_DD
+fi
+
+rm -f conftest.i conftest2.i conftest.out
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5
+$as_echo "$ac_cv_path_lt_DD" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5
+$as_echo_n "checking how to truncate binary pipes... " >&6; }
+if ${lt_cv_truncate_bin+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5
+$as_echo "$lt_cv_truncate_bin" >&6; }
+
+
+
+
+
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE=32
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE=64
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+       emul="${emul}32"
+       ;;
+      *64-bit*)
+       emul="${emul}64"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+       emul="${emul}btsmip"
+       ;;
+      *LSB*)
+       emul="${emul}ltsmip"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+       emul="${emul}n32"
+       ;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           case `/usr/bin/file conftest.o` in
+             *x86-64*)
+               LD="${LD-ld} -m elf32_x86_64"
+               ;;
+             *)
+               LD="${LD-ld} -m elf_i386"
+               ;;
+           esac
+           ;;
+         powerpc64le-*linux*)
+           LD="${LD-ld} -m elf32lppclinux"
+           ;;
+         powerpc64-*linux*)
+           LD="${LD-ld} -m elf32ppclinux"
+           ;;
+         s390x-*linux*)
+           LD="${LD-ld} -m elf_s390"
+           ;;
+         sparc64-*linux*)
+           LD="${LD-ld} -m elf32_sparc"
+           ;;
+       esac
+       ;;
+      *64-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_x86_64_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_x86_64"
+           ;;
+         powerpcle-*linux*)
+           LD="${LD-ld} -m elf64lppc"
+           ;;
+         powerpc-*linux*)
+           LD="${LD-ld} -m elf64ppc"
+           ;;
+         s390*-*linux*|s390*-*tpf*)
+           LD="${LD-ld} -m elf64_s390"
+           ;;
+         sparc*-*linux*)
+           LD="${LD-ld} -m elf64_sparc"
+           ;;
+       esac
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS=$CFLAGS
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test yes != "$lt_cv_cc_needs_belf"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS=$SAVE_CFLAGS
+  fi
+  ;;
+*-*solaris*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*|x86_64-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD=${LD-ld}_sol2
+        fi
+        ;;
+      *)
+       if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+         LD="${LD-ld} -64"
+       fi
+       ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks=$enable_libtool_lock
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test yes != "$lt_cv_path_mainfest_tool"; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "$LT_MULTI_MODULE"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       # If there is a non-empty error log, and "single_module"
+       # appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+         cat conftest.err >&5
+       # Otherwise, if the output was created with a 0 exit code from
+       # the compiler, it worked.
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&5
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS=$save_LDFLAGS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+       cat conftest.err >&5
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       10.[012][,.]*)
+         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+       10.*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
+    fi
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac
+else
+  enable_static=no
+fi
+
+
+
+
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for lt_pkg in $withval; do
+       IFS=$lt_save_ifs
+       if test "X$lt_pkg" = "X$lt_p"; then
+         pic_mode=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac
+else
+  pic_mode=default
+fi
+
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+  shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[5-9]*,yes)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5
+$as_echo_n "checking which variant of shared library versioning to provide... " >&6; }
+
+# Check whether --with-aix-soname was given.
+if test "${with_aix_soname+set}" = set; then :
+  withval=$with_aix_soname; case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname
+else
+  if ${lt_cv_with_aix_soname+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_with_aix_soname=aix
+fi
+
+    with_aix_soname=$lt_cv_with_aix_soname
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5
+$as_echo "$with_aix_soname" >&6; }
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS=$ltmain
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}"; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test set != "${COLLECT_NAMES+set}"; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a '.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+old_CC=$CC
+old_CFLAGS=$CFLAGS
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/${ac_tool_prefix}file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
+  ;;
+esac
+fi
+
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
+  ;;
+esac
+fi
+
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC=$CC
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test yes = "$GCC"; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"  ## exclude from sc_useless_quotes_in_assignment
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+  if test yes = "$GCC"; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+       lt_prog_compiler_static='$wl-static'
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        lt_prog_compiler_wl='-Wl,-Wl,,'
+        lt_prog_compiler_pic='-PIC'
+        lt_prog_compiler_static='-Bstatic'
+        ;;
+      esac
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+       lt_prog_compiler_static='$wl-static'
+       ;;
+      esac
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='$wl-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+      case $cc_basename in
+      # old Intel for x86_64, which still supported -KPIC.
+      ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='--shared'
+       lt_prog_compiler_static='--static'
+       ;;
+      nagfor*)
+       # NAG Fortran compiler
+       lt_prog_compiler_wl='-Wl,-Wl,,'
+       lt_prog_compiler_pic='-PIC'
+       lt_prog_compiler_static='-Bstatic'
+       ;;
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fpic'
+       lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-qpic'
+       lt_prog_compiler_static='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl=''
+         ;;
+       *Sun\ F* | *Sun*Fortran*)
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl='-Qoption ld '
+         ;;
+       *Sun\ C*)
+         # Sun C 5.9
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+        *Intel*\ [CF]*Compiler*)
+         lt_prog_compiler_wl='-Wl,'
+         lt_prog_compiler_pic='-fPIC'
+         lt_prog_compiler_static='-static'
+         ;;
+       *Portland\ Group*)
+         lt_prog_compiler_wl='-Wl,'
+         lt_prog_compiler_pic='-fpic'
+         lt_prog_compiler_static='-Bstatic'
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+       lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms that do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"  ## exclude from sc_useless_quotes_in_assignment
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test yes = "$lt_cv_prog_compiler_pic_works"; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS=$LDFLAGS
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS=$save_LDFLAGS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test yes = "$lt_cv_prog_compiler_static_works"; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links=nottested
+if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test no = "$hard_links"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test yes != "$GCC"; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd* | bitrig*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test yes = "$with_gnu_ld"; then
+    case $host_os in
+      aix*)
+       # The AIX port of GNU ld has always aspired to compatibility
+       # with the native linker.  However, as the warning in the GNU ld
+       # block says, versions before 2.19.5* couldn't really create working
+       # shared libraries, regardless of the interface used.
+       case `$LD -v 2>&1` in
+         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+         *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+         *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+         *)
+           lt_use_gnu_ld_interface=yes
+           ;;
+       esac
+       ;;
+      *)
+       lt_use_gnu_ld_interface=yes
+       ;;
+    esac
+  fi
+
+  if test yes = "$lt_use_gnu_ld_interface"; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='$wl'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+    export_dynamic_flag_spec='$wl--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test ia64 != "$host_cpu"; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='$wl--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file, use it as
+       # is; otherwise, prepend EXPORTS...
+       archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[   ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+      export_dynamic_flag_spec='$wl-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test linux-dietlibc = "$host_os"; then
+       case $cc_basename in
+         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
+       esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+        && test no = "$tmp_diet"
+      then
+       tmp_addflag=' $pic_flag'
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95* | pgfortran*)
+                                       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         whole_archive_flag_spec=
+         tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
+       xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         compiler_needs_object=yes
+         ;;
+       esac
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)                       # Sun C 5.9
+         whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         compiler_needs_object=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+
+        if test yes = "$supports_anon_versioning"; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       tcc*)
+         export_dynamic_flag_spec='-rdynamic'
+         ;;
+       xlf* | bgf* | bgxlf* | mpixlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+         hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+         archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+         if test yes = "$supports_anon_versioning"; then
+           archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         # For security reasons, it is highly recommended that you always
+         # use absolute paths for naming shared libraries, and exclude the
+         # DT_RUNPATH tag from executables and libraries.  But doing so
+         # requires that you compile everything twice, which is a pain.
+         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           ld_shlibs=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test no = "$ld_shlibs"; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test ia64 = "$host_cpu"; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+       # Without the "-l" option, or with the "-B" option, AIX nm treats
+       # weak defined symbols like other global defined symbols, whereas
+       # GNU nm marks them as "W".
+       # While the 'weak' keyword is ignored in the Export File, we need
+       # it in the Import File for the 'aix-soname' feature, so we have
+       # to replace the "-B" option with "-P" for AIX nm.
+       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # have runtime linking enabled, and use it for executables.
+       # For shared libraries, we enable/disable runtime linking
+       # depending on the kind of the shared library created -
+       # when "with_aix_soname,aix_use_runtimelinking" is:
+       # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "aix,yes"  lib.so          shared, rtl:yes, for executables
+       #            lib.a           static archive
+       # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+       #            lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a(lib.so.V) shared, rtl:no
+       # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a           static archive
+       case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+         for ld_flag in $LDFLAGS; do
+         if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+           # With aix-soname=svr4, we create the lib.so.V shared archives only,
+           # so we don't have lib.a shared libs to link our executables.
+           # We have to force runtime linking in this case.
+           aix_use_runtimelinking=yes
+           LDFLAGS="$LDFLAGS -Wl,-brtl"
+         fi
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+       # The Import File defines what to hardcode.
+       hardcode_direct=no
+       hardcode_direct_absolute=no
+       ;;
+      esac
+
+      if test yes = "$GCC"; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`$CC -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         :
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test yes = "$aix_use_runtimelinking"; then
+         shared_flag="$shared_flag "'$wl-G'
+       fi
+       # Need to ensure runtime linking is disabled for the traditional
+       # shared library, or the linker may eventually find shared libraries
+       # /with/ Import File - we do not want to mix them.
+       shared_flag_aix='-shared'
+       shared_flag_svr4='-shared $wl-G'
+      else
+       # not using gcc
+       if test ia64 = "$host_cpu"; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag='$wl-G'
+         else
+           shared_flag='$wl-bM:SRE'
+         fi
+         shared_flag_aix='$wl-bM:SRE'
+         shared_flag_svr4='$wl-G'
+       fi
+      fi
+
+      export_dynamic_flag_spec='$wl-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test set = "${lt_cv_aix_libpath+set}"; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=/usr/lib:/lib
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+        hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
+      else
+       if test ia64 = "$host_cpu"; then
+         hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test set = "${lt_cv_aix_libpath+set}"; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=/usr/lib:/lib
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+        hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' $wl-bernotok'
+         allow_undefined_flag=' $wl-berok'
+         if test yes = "$with_gnu_ld"; then
+           # We only use this code for GNU lds that support --whole-archive.
+           whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive'
+         else
+           # Exported symbols can be pulled into shared objects from archives
+           whole_archive_flag_spec='$convenience'
+         fi
+         archive_cmds_need_lc=yes
+         archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+         # -brtl affects multiple linker settings, -berok does not and is overridden later
+         compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
+         if test svr4 != "$with_aix_soname"; then
+           # This is similar to how AIX traditionally builds its shared libraries.
+           archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+         fi
+         if test aix != "$with_aix_soname"; then
+           archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+         else
+           # used by -dlpreopen to get the symbols
+           archive_expsym_cmds="$archive_expsym_cmds"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+         fi
+         archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+       # Native MSVC
+       hardcode_libdir_flag_spec=' '
+       allow_undefined_flag=unsupported
+       always_export_symbols=yes
+       file_list_spec='@'
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=.dll
+       # FIXME: Setting linknames here is a bad hack.
+       archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+       archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[   ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
+       # The linker will not automatically build a static lib if we build a DLL.
+       # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+       enable_shared_with_static_runtimes=yes
+       exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+       export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+       # Don't use ranlib
+       old_postinstall_cmds='chmod 644 $oldlib'
+       postlink_cmds='lt_outputfile="@OUTPUT@"~
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
+       ;;
+      *)
+       # Assume MSVC wrapper
+       hardcode_libdir_flag_spec=' '
+       allow_undefined_flag=unsupported
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=.dll
+       # FIXME: Setting linknames here is a bad hack.
+       archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+       # The linker will automatically build a .lib file if we build a DLL.
+       old_archive_from_new_cmds='true'
+       # FIXME: Should let the user specify the lib program.
+       old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+       enable_shared_with_static_runtimes=yes
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test yes = "$lt_cv_ld_force_load"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag=$_lt_dar_allow_undefined
+  case $cc_basename in
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test yes = "$_lt_dar_can_shared"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test yes = "$GCC"; then
+       archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='$wl+b $wl$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='$wl-E'
+      ;;
+
+    hpux10*)
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test no = "$with_gnu_ld"; then
+       hardcode_libdir_flag_spec='$wl+b $wl$libdir'
+       hardcode_libdir_separator=:
+       hardcode_direct=yes
+       hardcode_direct_absolute=yes
+       export_dynamic_flag_spec='$wl-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+
+         # Older versions of the 11.00 compiler do not understand -b yet
+         # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS=$LDFLAGS
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS=$save_LDFLAGS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test yes = "$lt_cv_prog_compiler__b"; then
+    archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+         ;;
+       esac
+      fi
+      if test no = "$with_gnu_ld"; then
+       hardcode_libdir_flag_spec='$wl+b $wl$libdir'
+       hardcode_libdir_separator=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       *)
+         hardcode_direct=yes
+         hardcode_direct_absolute=yes
+         export_dynamic_flag_spec='$wl-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       # Try to use the -exported_symbol ld option, if it does not
+       # work, assume that -exports_file does not work either and
+       # implicitly export all symbols.
+       # This should be the same for all languages, so no per-tag cache variable.
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS=$LDFLAGS
+          LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS=$save_LDFLAGS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+       if test yes = "$lt_cv_irix_exported_symbol"; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
+       fi
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    linux*)
+      case $cc_basename in
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       ld_shlibs=yes
+       archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      esac
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd* | bitrig*)
+      if test -f /usr/libexec/ld.so; then
+       hardcode_direct=yes
+       hardcode_shlibpath_var=no
+       hardcode_direct_absolute=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+         archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+         hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+         export_dynamic_flag_spec='$wl-E'
+       else
+         archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+       fi
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    osf3*)
+      if test yes = "$GCC"; then
+       allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test yes = "$GCC"; then
+       allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+       archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test yes = "$GCC"; then
+       wlarc='$wl'
+       archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='$wl'
+         archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands '-z linker_flag'.  GCC discards it without '$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test yes = "$GCC"; then
+         whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
+       else
+         whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test sequent = "$host_vendor"; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='$wl-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We CANNOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='$wl-z,text'
+      allow_undefined_flag='$wl-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='$wl-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='$wl-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test sni = "$host_vendor"; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       export_dynamic_flag_spec='$wl-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test no = "$ld_shlibs" && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test yes,yes = "$GCC,$enable_shared"; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$lt_prog_compiler_wl
+         pic_flag=$lt_prog_compiler_pic
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$allow_undefined_flag
+         allow_undefined_flag=
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+         then
+           lt_cv_archive_cmds_need_lc=no
+         else
+           lt_cv_archive_cmds_need_lc=yes
+         fi
+         allow_undefined_flag=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test yes = "$GCC"; then
+  case $host_os in
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary...
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
+      test -d "$lt_sys_path" && \
+       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo = "/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's|/\([A-Za-z]:\)|\1|g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=.so
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='$libname$release$shared_ext$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test ia64 = "$host_cpu"; then
+    # AIX 5 supports IA64
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a(lib.so.V)'
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='$libname$shared_ext'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec=$LIB
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
+    fi
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test yes = "$lt_cv_prog_gnu_ld"; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  hardcode_libdir_flag_spec='-L$libdir'
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd* | bitrig*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec=/usr/lib
+  need_lib_prefix=no
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
+  else
+    need_version=yes
+  fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+os2*)
+  libname_spec='$name'
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test yes = "$with_gnu_ld"; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec; then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=sco
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test yes = "$with_gnu_ld"; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test no = "$dynamic_linker" && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test yes = "$GCC"; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
+fi
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
+fi
+
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test yes = "$hardcode_automatic"; then
+
+  # We can hardcode non-existent directories.
+  if test no != "$hardcode_direct" &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" &&
+     test no != "$hardcode_minus_L"; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test relink = "$hardcode_action" ||
+   test yes = "$inherit_rpath"; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test yes != "$enable_dlopen"; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen=load_add_on
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen=LoadLibrary
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+    # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
+else
+
+    lt_cv_dlopen=dyld
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+  lt_cv_dlopen=shl_load
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+  lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+  lt_cv_dlopen=dlopen
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+  lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test no = "$lt_cv_dlopen"; then
+    enable_dlopen=no
+  else
+    enable_dlopen=yes
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS=$LDFLAGS
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS=$LIBS
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test yes = "$cross_compiling"; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisibility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test yes = "$lt_cv_dlopen_self"; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test yes = "$cross_compiling"; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisibility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP"; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report what library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test no = "$can_build_shared" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test yes = "$enable_shared" && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;                  # shared object as lib.so file only
+      yes,svr4,*) ;;                   # shared object as lib.so archive member only
+      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
+      esac
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test yes = "$enable_shared" || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+am__api_version='1.15'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \    ]*)
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+       # -L didn't work.
+       set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+       && test "$*" != "X conftest.file $srcdir/configure"; then
+
+       # If neither matched, then we have a broken ls.  This can happen
+       # if, for instance, CONFIG_SHELL is bash and it inherits a
+       # broken ls alias from the environment.  This has actually
+       # happened.  Such a system could not be considered "sane".
+       as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if ${ac_cv_path_mkdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+            'mkdir (GNU coreutils) '* | \
+            'mkdir (coreutils) '* | \
+            'mkdir (fileutils) '4.1*)
+              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+              break 3;;
+          esac
+        done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='flatpak'
+ VERSION='0.10.2'
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar plaintar pax cpio none'
+
+# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5
+$as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; }
+      if test $am_uid -le $am_max_uid; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+         _am_tools=none
+      fi
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5
+$as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; }
+      if test $am_gid -le $am_max_gid; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        _am_tools=none
+      fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
+$as_echo_n "checking how to create a ustar tar archive... " >&6; }
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_ustar-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        { echo "$as_me:$LINENO: $_am_tar --version" >&5
+   ($_am_tar --version) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } && break
+      done
+      am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x ustar -w "$$tardir"'
+      am__tar_='pax -L -x ustar -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
+      am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
+      am__untar='cpio -i -H ustar -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
+
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_ustar}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
+   (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
+   ($am__untar <conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+      { echo "$as_me:$LINENO: cat conftest.dir/file" >&5
+   (cat conftest.dir/file) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
+  rm -rf conftest.dir
+
+  if ${am_cv_prog_tar_ustar+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  am_cv_prog_tar_ustar=$_am_tool
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
+$as_echo "$am_cv_prog_tar_ustar" >&6; }
+
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+  fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
+    # Check whether --enable-nls was given.
+if test "${enable_nls+set}" = set; then :
+  enableval=$enable_nls; USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
+
+
+
+
+      GETTEXT_MACRO_VERSION=0.18
+
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$MSGFMT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+    ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test "$MSGFMT" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GMSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+    case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
+    *) MSGFMT_015=$MSGFMT ;;
+  esac
+
+  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+    *) GMSGFMT_015=$GMSGFMT ;;
+  esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XGETTEXT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$XGETTEXT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+    ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test "$XGETTEXT" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+    rm -f messages.po
+
+    case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+    *) XGETTEXT_015=$XGETTEXT ;;
+  esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGMERGE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$MSGMERGE" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then
+            ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
+    ;;
+esac
+fi
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
+$as_echo "$MSGMERGE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+        test -n "$localedir" || localedir='${datadir}/locale'
+
+
+    test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
+
+
+  ac_config_commands="$ac_config_commands po-directories"
+
+
+
+      if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${acl_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$acl_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+        test "$with_gnu_ld" != no && break
+        ;;
+      *)
+        test "$with_gnu_ld" != yes && break
+        ;;
+      esac
+    fi
+  done
+  IFS="$acl_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${acl_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes
+  ;;
+*)
+  acl_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
+$as_echo "$acl_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$acl_cv_prog_gnu_ld
+
+
+
+
+                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+$as_echo_n "checking for shared library run path origin... " >&6; }
+if ${acl_cv_rpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
+$as_echo "$acl_cv_rpath" >&6; }
+  wl="$acl_cv_wl"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+    # Check whether --enable-rpath was given.
+if test "${enable_rpath+set}" = set; then :
+  enableval=$enable_rpath; :
+else
+  enable_rpath=yes
+fi
+
+
+
+
+  acl_libdirstem=lib
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+                                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5
+$as_echo_n "checking for 64-bit host... " >&6; }
+if ${gl_cv_solaris_64bit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef _LP64
+sixtyfour bits
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "sixtyfour bits" >/dev/null 2>&1; then :
+  gl_cv_solaris_64bit=yes
+else
+  gl_cv_solaris_64bit=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5
+$as_echo "$gl_cv_solaris_64bit" >&6; }
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+        esac
+      fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS=   }"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+
+
+
+
+
+
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then :
+  withval=$with_libiconv_prefix;
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
+
+fi
+
+      LIBICONV=
+  LTLIBICONV=
+  INCICONV=
+  LIBICONV_PREFIX=
+      HAVE_LIBICONV=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='iconv '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+                                    if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+                        if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                                    if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                                    if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$acl_hardcode_direct" = yes; then
+                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+              else
+                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+    done
+  fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5
+$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; }
+if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <CoreFoundation/CFPreferences.h>
+int
+main ()
+{
+CFPreferencesCopyAppValue(NULL, NULL)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_CFPreferencesCopyAppValue=yes
+else
+  gt_cv_func_CFPreferencesCopyAppValue=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="$gt_save_LIBS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
+$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+
+$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h
+
+  fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5
+$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; }
+if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <CoreFoundation/CFLocale.h>
+int
+main ()
+{
+CFLocaleCopyCurrent();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_CFLocaleCopyCurrent=yes
+else
+  gt_cv_func_CFLocaleCopyCurrent=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="$gt_save_LIBS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
+$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; }
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+
+$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h
+
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+
+
+
+
+
+
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+    case " $gt_needs " in
+    *" need-formatstring-macros "*) gt_api_version=3 ;;
+    *" need-ngettext "*) gt_api_version=2 ;;
+    *) gt_api_version=1 ;;
+  esac
+  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
+  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
+
+    if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+
+
+        if test $gt_api_version -ge 3; then
+          gt_revision_test_code='
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+'
+        else
+          gt_revision_test_code=
+        fi
+        if test $gt_api_version -ge 2; then
+          gt_expression_test_code=' + * ngettext ("", "", 0)'
+        else
+          gt_expression_test_code=
+        fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5
+$as_echo_n "checking for GNU gettext in libc... " >&6; }
+if eval \${$gt_func_gnugettext_libc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$gt_func_gnugettext_libc=yes"
+else
+  eval "$gt_func_gnugettext_libc=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$gt_func_gnugettext_libc
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+
+
+
+
+
+          am_save_CPPFLAGS="$CPPFLAGS"
+
+  for element in $INCICONV; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
+$as_echo_n "checking for iconv... " >&6; }
+if ${am_cv_func_iconv+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      LIBS="$am_save_LIBS"
+    fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
+$as_echo "$am_cv_func_iconv" >&6; }
+  if test "$am_cv_func_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5
+$as_echo_n "checking for working iconv... " >&6; }
+if ${am_cv_func_iconv_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                  am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      if test "$cross_compiling" = yes; then :
+
+         case "$host_os" in
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  am_cv_func_iconv_works=yes
+else
+  am_cv_func_iconv_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      LIBS="$am_save_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5
+$as_echo "$am_cv_func_iconv_works" >&6; }
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+
+$as_echo "#define HAVE_ICONV 1" >>confdefs.h
+
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
+$as_echo_n "checking how to link with libiconv... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
+$as_echo "$LIBICONV" >&6; }
+  else
+            CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+
+
+
+
+
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libintl-prefix was given.
+if test "${with_libintl_prefix+set}" = set; then :
+  withval=$with_libintl_prefix;
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
+
+fi
+
+      LIBINTL=
+  LTLIBINTL=
+  INCINTL=
+  LIBINTL_PREFIX=
+      HAVE_LIBINTL=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='intl '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+                                    if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+                        if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                                    if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                                    if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$acl_hardcode_direct" = yes; then
+                                                      LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                                                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a"
+              else
+                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = 'intl'; then
+                  LIBINTL_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = 'intl'; then
+                  LIBINTL_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$dep"
+                    LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+            LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir"
+    done
+  fi
+
+
+
+
+
+
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5
+$as_echo_n "checking for GNU gettext in libintl... " >&6; }
+if eval \${$gt_func_gnugettext_libintl+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$gt_func_gnugettext_libintl=yes"
+else
+  eval "$gt_func_gnugettext_libintl=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+                        if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  LIBINTL="$LIBINTL $LIBICONV"
+                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                 eval "$gt_func_gnugettext_libintl=yes"
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"
+fi
+eval ac_res=\$$gt_func_gnugettext_libintl
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+        fi
+
+                                        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+                    LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+
+
+    if test -n "$INTL_MACOSX_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+                LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+      fi
+    fi
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+
+$as_echo "#define ENABLE_NLS 1" >>confdefs.h
+
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5
+$as_echo_n "checking whether to use NLS... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
+  if test "$USE_NLS" = "yes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5
+$as_echo_n "checking where the gettext function comes from... " >&6; }
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5
+$as_echo "$gt_source" >&6; }
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5
+$as_echo_n "checking how to link with libintl... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5
+$as_echo "$LIBINTL" >&6; }
+
+  for element in $INCINTL; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+      fi
+
+
+$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h
+
+    fi
+
+        POSUB=po
+  fi
+
+
+
+    INTLLIBS="$LIBINTL"
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define GETTEXT_PACKAGE "$PACKAGE"
+_ACEOF
+
+
+# Enable silent rules is available
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+       @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=yes
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+  for flag in \
+-pipe \
+-Wall \
+-Werror=empty-body \
+-Werror=strict-prototypes \
+-Werror=missing-prototypes \
+-Werror=implicit-function-declaration \
+"-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \
+-Werror=pointer-arith -Werror=init-self \
+-Werror=missing-declarations \
+-Werror=return-type \
+-Werror=overflow \
+-Werror=int-conversion \
+-Werror=parenthesis \
+-Werror=incompatible-pointer-types \
+-Werror=misleading-indentation \
+-Werror=missing-include-dirs \
+; do
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports flag $flag in envvar CFLAGS" >&5
+$as_echo_n "checking if $CC supports flag $flag in envvar CFLAGS... " >&6; }
+if { as_var=`$as_echo "cc_cv_CFLAGS_$flag" | $as_tr_sh`; eval \${$as_var+:} false; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "cc_save_CFLAGS='${CFLAGS}'"
+           eval "CFLAGS='${cc_save_CFLAGS} -Werror `echo "$flag" | sed 's/^-Wno-/-W/'`'"
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "`$as_echo "cc_cv_CFLAGS_$flag" | $as_tr_sh`='yes'"
+else
+  eval "`$as_echo "cc_cv_CFLAGS_$flag" | $as_tr_sh`='no'"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           eval "CFLAGS='$cc_save_CFLAGS'"
+fi
+eval ac_res=\$`$as_echo "cc_cv_CFLAGS_$flag" | $as_tr_sh`
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+  if eval test x$`$as_echo "cc_cv_CFLAGS_$flag" | $as_tr_sh` = xyes; then :
+  eval "WARN_CFLAGS='${WARN_CFLAGS} $flag'"
+fi
+
+  done
+
+
+
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Valgrind on the unit tests" >&5
+$as_echo_n "checking whether to enable Valgrind on the unit tests... " >&6; }
+       # Check whether --enable-valgrind was given.
+if test "${enable_valgrind+set}" = set; then :
+  enableval=$enable_valgrind; enable_valgrind=$enableval
+else
+  enable_valgrind=
+fi
+
+
+       # Check for Valgrind.
+       # Extract the first word of "valgrind", so it can be a program name with args.
+set dummy valgrind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_VALGRIND+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$VALGRIND"; then
+  ac_cv_prog_VALGRIND="$VALGRIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_VALGRIND="valgrind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+VALGRIND=$ac_cv_prog_VALGRIND
+if test -n "$VALGRIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5
+$as_echo "$VALGRIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+       if test "$enable_valgrind" = "yes" -a "$VALGRIND" = ""; then :
+
+               as_fn_error $? "Could not find valgrind; either install it or reconfigure with --disable-valgrind" "$LINENO" 5
+
+fi
+       if test "$enable_valgrind" != "no"; then :
+  enable_valgrind=yes
+fi
+
+        if test "$enable_valgrind" = "yes"; then
+  VALGRIND_ENABLED_TRUE=
+  VALGRIND_ENABLED_FALSE='#'
+else
+  VALGRIND_ENABLED_TRUE='#'
+  VALGRIND_ENABLED_FALSE=
+fi
+
+       VALGRIND_ENABLED=$enable_valgrind
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_valgrind" >&5
+$as_echo "$enable_valgrind" >&6; }
+
+       # Check for Valgrind tools we care about.
+        #m4_define([valgrind_tool_list],[[memcheck], [helgrind], [drd], [exp-sgcheck]])
+        # I trimmed this, because we fail on all the thread stuff
+
+
+       if test "$VALGRIND" != ""; then :
+
+
+
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Valgrind tool memcheck" >&5
+$as_echo_n "checking for Valgrind tool memcheck... " >&6; }
+if ${ax_cv_valgrind_tool_memcheck+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                               ax_cv_valgrind_tool_memcheck=
+                               if `$VALGRIND --tool=memcheck --help >/dev/null 2>&1`; then :
+
+                                       ax_cv_valgrind_tool_memcheck="memcheck"
+
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_valgrind_tool_memcheck" >&5
+$as_echo "$ax_cv_valgrind_tool_memcheck" >&6; }
+
+                       VALGRIND_HAVE_TOOL_memcheck=$ax_cv_valgrind_tool_memcheck
+
+
+
+fi
+
+VALGRIND_CHECK_RULES='
+# Valgrind check
+#
+# Optional:
+#  - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions
+#    files to load. (Default: empty)
+#  - VALGRIND_FLAGS: General flags to pass to all Valgrind tools.
+#    (Default: --num-callers=30)
+#  - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of:
+#    memcheck, helgrind, drd, sgcheck). (Default: various)
+
+# Optional variables
+VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES))
+VALGRIND_FLAGS ?= --num-callers=30
+VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no
+VALGRIND_helgrind_FLAGS ?= --history-level=approx
+VALGRIND_drd_FLAGS ?=
+VALGRIND_sgcheck_FLAGS ?=
+
+# Internal use
+valgrind_tools = memcheck helgrind drd sgcheck
+valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools)))
+
+valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS)
+valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS)
+valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS)
+valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS)
+
+valgrind_quiet = $(valgrind_quiet_$(V))
+valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY))
+valgrind_quiet_0 = --quiet
+
+# Support running with and without libtool.
+ifneq ($(LIBTOOL),)
+valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute
+else
+valgrind_lt =
+endif
+
+# Use recursive makes in order to ignore errors during check
+check-valgrind:
+ifeq ($(VALGRIND_ENABLED),yes)
+       -$(foreach tool,$(valgrind_tools), \
+               $(if $(VALGRIND_HAVE_TOOL_$(tool))$(VALGRIND_HAVE_TOOL_exp_$(tool)), \
+                       $(MAKE) $(AM_MAKEFLAGS) -k check-valgrind-tool VALGRIND_TOOL=$(tool); \
+               ) \
+       )
+else
+       @echo "Need to reconfigure with --enable-valgrind"
+endif
+
+# Valgrind running
+VALGRIND_TESTS_ENVIRONMENT = \
+       $(TESTS_ENVIRONMENT) \
+       env VALGRIND=$(VALGRIND) \
+       G_SLICE=always-malloc,debug-blocks \
+       G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly
+
+VALGRIND_LOG_COMPILER = \
+       $(valgrind_lt) \
+       $(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
+
+check-valgrind-tool:
+ifeq ($(VALGRIND_ENABLED),yes)
+       $(MAKE) check-TESTS \
+               TESTS_ENVIRONMENT="$(VALGRIND_TESTS_ENVIRONMENT)" \
+               LOG_COMPILER="$(VALGRIND_LOG_COMPILER)" \
+               LOG_FLAGS="$(valgrind_$(VALGRIND_TOOL)_flags)" \
+               TEST_SUITE_LOG=test-suite-$(VALGRIND_TOOL).log
+else
+       @echo "Need to reconfigure with --enable-valgrind"
+endif
+
+DISTCHECK_CONFIGURE_FLAGS ?=
+DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind
+
+MOSTLYCLEANFILES ?=
+MOSTLYCLEANFILES += $(valgrind_log_files)
+
+.PHONY: check-valgrind check-valgrind-tool
+'
+
+
+
+
+
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=0.24
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               PKG_CONFIG=""
+       fi
+fi
+
+
+# Check whether --with-privileged_group was given.
+if test "${with_privileged_group+set}" = set; then :
+  withval=$with_privileged_group; with_privileged_group="$withval"
+else
+  with_privileged_group=wheel
+fi
+
+PRIVILEGED_GROUP=$with_privileged_group
+
+
+
+# Check whether --with-dbus_service_dir was given.
+if test "${with_dbus_service_dir+set}" = set; then :
+  withval=$with_dbus_service_dir; with_dbus_service_dir="$withval"
+else
+  with_dbus_service_dir=$datadir/dbus-1/services
+fi
+
+DBUS_SERVICE_DIR=$with_dbus_service_dir
+
+
+
+# Check whether --with-dbus_config_dir was given.
+if test "${with_dbus_config_dir+set}" = set; then :
+  withval=$with_dbus_config_dir; with_dbus_config_dir="$withval"
+else
+  with_dbus_config_dir=${sysconfdir}/dbus-1/system.d
+fi
+
+DBUS_CONFIG_DIR=$with_dbus_config_dir
+
+
+
+# Check whether --with-systemduserunitdir was given.
+if test "${with_systemduserunitdir+set}" = set; then :
+  withval=$with_systemduserunitdir;
+else
+          with_systemduserunitdir='${prefix}/lib/systemd/user'
+fi
+
+systemduserunitdir=$with_systemduserunitdir
+
+
+
+# Check whether --with-systemdsystemunitdir was given.
+if test "${with_systemdsystemunitdir+set}" = set; then :
+  withval=$with_systemdsystemunitdir;
+else
+          with_systemdsystemunitdir='${prefix}/lib/systemd/system'
+fi
+
+systemdsystemunitdir=$with_systemdsystemunitdir
+
+
+
+# Check whether --with-system_fonts_dir was given.
+if test "${with_system_fonts_dir+set}" = set; then :
+  withval=$with_system_fonts_dir; with_system_fonts_dir="$withval"
+else
+  with_system_fonts_dir=/usr/share/fonts
+fi
+
+SYSTEM_FONTS_DIR=$with_system_fonts_dir
+
+
+
+# Check whether --with-system_font_cache_dirs was given.
+if test "${with_system_font_cache_dirs+set}" = set; then :
+  withval=$with_system_font_cache_dirs; with_system_font_cache_dirs="$withval"
+else
+  with_system_font_cache_dirs=/var/cache/fontconfig:/usr/lib/fontconfig/cache
+fi
+
+SYSTEM_FONT_CACHE_DIRS=$with_system_font_cache_dirs
+
+
+
+# Check whether --with-profile_dir was given.
+if test "${with_profile_dir+set}" = set; then :
+  withval=$with_profile_dir; with_profile_dir="$withval"
+else
+  with_profile_dir=${sysconfdir}/profile.d
+fi
+
+PROFILE_DIR=$with_profile_dir
+
+
+
+
+# Check whether --with-system-bubblewrap was given.
+if test "${with_system_bubblewrap+set}" = set; then :
+  withval=$with_system_bubblewrap; BWRAP="$withval"
+else
+  BWRAP="${BWRAP:-false}"
+fi
+
+case $BWRAP in #(
+  yes) :
+    BWRAP=bwrap ;; #(
+  no) :
+    BWRAP=false ;; #(
+  auto) :
+    # Extract the first word of "bwrap", so it can be a program name with args.
+set dummy bwrap; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_BWRAP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$BWRAP"; then
+  ac_cv_prog_BWRAP="$BWRAP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_BWRAP="bwrap"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_BWRAP" && ac_cv_prog_BWRAP="false"
+fi
+fi
+BWRAP=$ac_cv_prog_BWRAP
+if test -n "$BWRAP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BWRAP" >&5
+$as_echo "$BWRAP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ ;; #(
+  *) :
+     ;;
+esac
+if test "x$BWRAP" != xfalse; then
+   BWRAP_VERSION=`$BWRAP --version | sed 's,.*\ \(0-9*\.0-9*\.0-9*\)$,\1,'`
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$SYSTEM_BWRAP_REQS" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "$BWRAP_VERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+    as_fn_error $? "You need at least version $SYSTEM_BWRAP_REQS of bubblewrap to use the system installed version" "$LINENO" 5
+      fi
+
+    if true; then
+  WITH_SYSTEM_BWRAP_TRUE=
+  WITH_SYSTEM_BWRAP_FALSE='#'
+else
+  WITH_SYSTEM_BWRAP_TRUE='#'
+  WITH_SYSTEM_BWRAP_FALSE=
+fi
+
+else
+    if false; then
+  WITH_SYSTEM_BWRAP_TRUE=
+  WITH_SYSTEM_BWRAP_FALSE='#'
+else
+  WITH_SYSTEM_BWRAP_TRUE='#'
+  WITH_SYSTEM_BWRAP_FALSE=
+fi
+
+fi
+
+for ac_func in fdwalk
+do :
+  ac_fn_c_check_func "$LINENO" "fdwalk" "ac_cv_func_fdwalk"
+if test "x$ac_cv_func_fdwalk" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_FDWALK 1
+_ACEOF
+
+fi
+done
+
+
+ac_fn_c_check_decl "$LINENO" "renameat2" "ac_cv_have_decl_renameat2" "
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/mount.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <linux/loop.h>
+#include <linux/random.h>
+
+"
+if test "x$ac_cv_have_decl_renameat2" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_RENAMEAT2 $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "memfd_create" "ac_cv_have_decl_memfd_create" "
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/mount.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <linux/loop.h>
+#include <linux/random.h>
+
+"
+if test "x$ac_cv_have_decl_memfd_create" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MEMFD_CREATE $ac_have_decl
+_ACEOF
+
+
+# Check whether --enable-otmpfile was given.
+if test "${enable_otmpfile+set}" = set; then :
+  enableval=$enable_otmpfile;
+else
+  enable_otmpfile=yes
+fi
+
+if test $enable_otmpfile = yes; then :
+
+else
+
+
+$as_echo "#define DISABLE_OTMPFILE 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-wrpseudo-compat was given.
+if test "${enable_wrpseudo_compat+set}" = set; then :
+  enableval=$enable_wrpseudo_compat;
+else
+  enable_wrpseudo_compat=no
+fi
+
+if test $enable_wrpseudo_compat = no; then :
+
+else
+
+
+$as_echo "#define ENABLE_WRPSEUDO_COMPAT 1" >>confdefs.h
+
+fi
+
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_xattr_h" = xyes; then :
+
+else
+  as_fn_error $? "You must have sys/xattr.h from glibc" "$LINENO" 5
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_capability_h" = xyes; then :
+  have_caps=yes
+else
+  as_fn_error $? "sys/capability.h header not found" "$LINENO" 5
+fi
+
+
+
+GLIB_MKENUMS=`$PKG_CONFIG --variable glib_mkenums glib-2.0`
+
+GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
+
+GDBUS_CODEGEN=`$PKG_CONFIG --variable gdbus_codegen gio-2.0`
+
+
+POLKIT_GOBJECT_REQUIRED=0.98
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BASE" >&5
+$as_echo_n "checking for BASE... " >&6; }
+
+if test -n "$BASE_CFLAGS"; then
+    pkg_cv_BASE_CFLAGS="$BASE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 \""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BASE_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 " 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$BASE_LIBS"; then
+    pkg_cv_BASE_LIBS="$BASE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 \""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BASE_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 " 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               BASE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 " 2>&1`
+        else
+               BASE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 " 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$BASE_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 ) were not met:
+
+$BASE_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables BASE_CFLAGS
+and BASE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables BASE_CFLAGS
+and BASE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       BASE_CFLAGS=$pkg_cv_BASE_CFLAGS
+       BASE_LIBS=$pkg_cv_BASE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOUP" >&5
+$as_echo_n "checking for SOUP... " >&6; }
+
+if test -n "$SOUP_CFLAGS"; then
+    pkg_cv_SOUP_CFLAGS="$SOUP_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsoup-2.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libsoup-2.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SOUP_CFLAGS=`$PKG_CONFIG --cflags "libsoup-2.4" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$SOUP_LIBS"; then
+    pkg_cv_SOUP_LIBS="$SOUP_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsoup-2.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libsoup-2.4") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SOUP_LIBS=`$PKG_CONFIG --libs "libsoup-2.4" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               SOUP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsoup-2.4" 2>&1`
+        else
+               SOUP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsoup-2.4" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$SOUP_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (libsoup-2.4) were not met:
+
+$SOUP_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables SOUP_CFLAGS
+and SOUP_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables SOUP_CFLAGS
+and SOUP_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       SOUP_CFLAGS=$pkg_cv_SOUP_CFLAGS
+       SOUP_LIBS=$pkg_cv_SOUP_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+save_LIBS=$LIBS
+LIBS=$BASE_LIBS
+for ac_func in archive_read_support_filter_all
+do :
+  ac_fn_c_check_func "$LINENO" "archive_read_support_filter_all" "ac_cv_func_archive_read_support_filter_all"
+if test "x$ac_cv_func_archive_read_support_filter_all" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL 1
+_ACEOF
+
+fi
+done
+
+LIBS=$save_LIBS
+
+LIBGPGME_DEPENDENCY="1.1.8"
+
+# Check whether --with-gpgme-prefix was given.
+if test "${with_gpgme_prefix+set}" = set; then :
+  withval=$with_gpgme_prefix; gpgme_config_prefix="$withval"
+else
+  gpgme_config_prefix=""
+fi
+
+  if test x"${GPGME_CONFIG}" = x ; then
+     if test x"${gpgme_config_prefix}" != x ; then
+        GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config"
+     else
+       case "${SYSROOT}" in
+         /*)
+           if test -x "${SYSROOT}/bin/gpgme-config" ; then
+             GPGME_CONFIG="${SYSROOT}/bin/gpgme-config"
+           fi
+           ;;
+         '')
+           ;;
+          *)
+           { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5
+$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;}
+           ;;
+       esac
+     fi
+  fi
+
+  # Extract the first word of "gpgme-config", so it can be a program name with args.
+set dummy gpgme-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GPGME_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GPGME_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GPGME_CONFIG="$GPGME_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GPGME_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GPGME_CONFIG" && ac_cv_path_GPGME_CONFIG="no"
+  ;;
+esac
+fi
+GPGME_CONFIG=$ac_cv_path_GPGME_CONFIG
+if test -n "$GPGME_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGME_CONFIG" >&5
+$as_echo "$GPGME_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+  if test "$GPGME_CONFIG" != "no" ; then
+    gpgme_version=`$GPGME_CONFIG --version`
+  fi
+  gpgme_version_major=`echo $gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
+  gpgme_version_minor=`echo $gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
+  gpgme_version_micro=`echo $gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEP_GPGME" >&5
+$as_echo_n "checking for DEP_GPGME... " >&6; }
+
+if test -n "$DEP_GPGME_CFLAGS"; then
+    pkg_cv_DEP_GPGME_CFLAGS="$DEP_GPGME_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme-pthread >= \$LIBGPGME_DEPENDENCY\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gpgme-pthread >= $LIBGPGME_DEPENDENCY") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEP_GPGME_CFLAGS=`$PKG_CONFIG --cflags "gpgme-pthread >= $LIBGPGME_DEPENDENCY" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$DEP_GPGME_LIBS"; then
+    pkg_cv_DEP_GPGME_LIBS="$DEP_GPGME_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme-pthread >= \$LIBGPGME_DEPENDENCY\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gpgme-pthread >= $LIBGPGME_DEPENDENCY") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEP_GPGME_LIBS=`$PKG_CONFIG --libs "gpgme-pthread >= $LIBGPGME_DEPENDENCY" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               DEP_GPGME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gpgme-pthread >= $LIBGPGME_DEPENDENCY" 2>&1`
+        else
+               DEP_GPGME_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gpgme-pthread >= $LIBGPGME_DEPENDENCY" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$DEP_GPGME_PKG_ERRORS" >&5
+
+
+
+          tmp=$LIBGPGME_DEPENDENCY
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_gpgme_api=0
+     min_gpgme_version="$tmp"
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGME pthread - version >= $min_gpgme_version" >&5
+$as_echo_n "checking for GPGME pthread - version >= $min_gpgme_version... " >&6; }
+  ok=no
+  if test "$GPGME_CONFIG" != "no" ; then
+    if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
+      req_major=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
+      req_minor=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
+      req_micro=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
+      if test "$gpgme_version_major" -gt "$req_major"; then
+        ok=yes
+      else
+        if test "$gpgme_version_major" -eq "$req_major"; then
+          if test "$gpgme_version_minor" -gt "$req_minor"; then
+            ok=yes
+          else
+            if test "$gpgme_version_minor" -eq "$req_minor"; then
+              if test "$gpgme_version_micro" -ge "$req_micro"; then
+                ok=yes
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+  if test $ok = yes; then
+     # If we have a recent GPGME, we should also check that the
+     # API is compatible.
+     if test "$req_gpgme_api" -gt 0 ; then
+        tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        if test "$tmp" -gt 0 ; then
+           if test "$req_gpgme_api" -ne "$tmp" ; then
+             ok=no
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
+    GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    have_gpgme=yes
+
+    gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
+    if test x"$gpgme_config_host" != xnone ; then
+      if test x"$gpgme_config_host" != x"$host" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+***
+*** The config script $GPGME_CONFIG was
+*** built for $gpgme_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-gpgme-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&5
+$as_echo "$as_me: WARNING:
+***
+*** The config script $GPGME_CONFIG was
+*** built for $gpgme_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-gpgme-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&2;}
+        gpg_config_script_warn="$gpg_config_script_warn gpgme"
+      fi
+    fi
+
+  else
+    GPGME_PTHREAD_CFLAGS=""
+    GPGME_PTHREAD_LIBS=""
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    have_gpgme=no
+  fi
+
+
+
+
+
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+          tmp=$LIBGPGME_DEPENDENCY
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_gpgme_api=0
+     min_gpgme_version="$tmp"
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGME pthread - version >= $min_gpgme_version" >&5
+$as_echo_n "checking for GPGME pthread - version >= $min_gpgme_version... " >&6; }
+  ok=no
+  if test "$GPGME_CONFIG" != "no" ; then
+    if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
+      req_major=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
+      req_minor=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
+      req_micro=`echo $min_gpgme_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
+      if test "$gpgme_version_major" -gt "$req_major"; then
+        ok=yes
+      else
+        if test "$gpgme_version_major" -eq "$req_major"; then
+          if test "$gpgme_version_minor" -gt "$req_minor"; then
+            ok=yes
+          else
+            if test "$gpgme_version_minor" -eq "$req_minor"; then
+              if test "$gpgme_version_micro" -ge "$req_micro"; then
+                ok=yes
+              fi
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+  if test $ok = yes; then
+     # If we have a recent GPGME, we should also check that the
+     # API is compatible.
+     if test "$req_gpgme_api" -gt 0 ; then
+        tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        if test "$tmp" -gt 0 ; then
+           if test "$req_gpgme_api" -ne "$tmp" ; then
+             ok=no
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
+    GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    have_gpgme=yes
+
+    gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
+    if test x"$gpgme_config_host" != xnone ; then
+      if test x"$gpgme_config_host" != x"$host" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+***
+*** The config script $GPGME_CONFIG was
+*** built for $gpgme_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-gpgme-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&5
+$as_echo "$as_me: WARNING:
+***
+*** The config script $GPGME_CONFIG was
+*** built for $gpgme_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-gpgme-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&2;}
+        gpg_config_script_warn="$gpg_config_script_warn gpgme"
+      fi
+    fi
+
+  else
+    GPGME_PTHREAD_CFLAGS=""
+    GPGME_PTHREAD_LIBS=""
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    have_gpgme=no
+  fi
+
+
+
+
+
+else
+       DEP_GPGME_CFLAGS=$pkg_cv_DEP_GPGME_CFLAGS
+       DEP_GPGME_LIBS=$pkg_cv_DEP_GPGME_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       have_gpgme=yes
+fi
+if  test x$have_gpgme = xno ; then :
+
+   as_fn_error $? "Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later" "$LINENO" 5
+
+fi
+
+# Check whether --enable-system-helper was given.
+if test "${enable_system_helper+set}" = set; then :
+  enableval=$enable_system_helper;
+else
+  enable_system_helper=yes
+fi
+
+if test "x$enable_system_helper" = "xyes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POLKIT" >&5
+$as_echo_n "checking for POLKIT... " >&6; }
+
+if test -n "$POLKIT_CFLAGS"; then
+    pkg_cv_POLKIT_CFLAGS="$POLKIT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\\
+                   polkit-gobject-1 >= \$POLKIT_GOBJECT_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_POLKIT_CFLAGS=`$PKG_CONFIG --cflags "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$POLKIT_LIBS"; then
+    pkg_cv_POLKIT_LIBS="$POLKIT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\\
+                   polkit-gobject-1 >= \$POLKIT_GOBJECT_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_POLKIT_LIBS=`$PKG_CONFIG --libs "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               POLKIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED" 2>&1`
+        else
+               POLKIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$POLKIT_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (\
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED) were not met:
+
+$POLKIT_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables POLKIT_CFLAGS
+and POLKIT_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables POLKIT_CFLAGS
+and POLKIT_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       POLKIT_CFLAGS=$pkg_cv_POLKIT_CFLAGS
+       POLKIT_LIBS=$pkg_cv_POLKIT_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define USE_SYSTEM_HELPER 1" >>confdefs.h
+
+fi
+ if test x$enable_system_helper = xyes; then
+  BUILD_SYSTEM_HELPER_TRUE=
+  BUILD_SYSTEM_HELPER_FALSE='#'
+else
+  BUILD_SYSTEM_HELPER_TRUE='#'
+  BUILD_SYSTEM_HELPER_FALSE=
+fi
+
+
+# Check whether --enable-xauth was given.
+if test "${enable_xauth+set}" = set; then :
+  enableval=$enable_xauth;
+else
+  enable_xauth=yes
+fi
+
+if test "x$enable_xauth" = "xyes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XAUTH" >&5
+$as_echo_n "checking for XAUTH... " >&6; }
+
+if test -n "$XAUTH_CFLAGS"; then
+    pkg_cv_XAUTH_CFLAGS="$XAUTH_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xau\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "xau") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_XAUTH_CFLAGS=`$PKG_CONFIG --cflags "xau" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$XAUTH_LIBS"; then
+    pkg_cv_XAUTH_LIBS="$XAUTH_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xau\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "xau") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_XAUTH_LIBS=`$PKG_CONFIG --libs "xau" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               XAUTH_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xau" 2>&1`
+        else
+               XAUTH_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xau" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$XAUTH_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (xau) were not met:
+
+$XAUTH_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables XAUTH_CFLAGS
+and XAUTH_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables XAUTH_CFLAGS
+and XAUTH_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       XAUTH_CFLAGS=$pkg_cv_XAUTH_CFLAGS
+       XAUTH_LIBS=$pkg_cv_XAUTH_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define ENABLE_XAUTH 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-sandboxed-triggers was given.
+if test "${enable_sandboxed_triggers+set}" = set; then :
+  enableval=$enable_sandboxed_triggers;
+else
+  enable_sandboxed_triggers=yes
+fi
+
+if test "x$enable_sandboxed_triggers" = "xno"; then
+
+$as_echo "#define DISABLE_SANDBOXED_TRIGGERS 1" >>confdefs.h
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSTREE" >&5
+$as_echo_n "checking for OSTREE... " >&6; }
+
+if test -n "$OSTREE_CFLAGS"; then
+    pkg_cv_OSTREE_CFLAGS="$OSTREE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ostree-1 >= \$OSTREE_REQS\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "ostree-1 >= $OSTREE_REQS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OSTREE_CFLAGS=`$PKG_CONFIG --cflags "ostree-1 >= $OSTREE_REQS" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$OSTREE_LIBS"; then
+    pkg_cv_OSTREE_LIBS="$OSTREE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ostree-1 >= \$OSTREE_REQS\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "ostree-1 >= $OSTREE_REQS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OSTREE_LIBS=`$PKG_CONFIG --libs "ostree-1 >= $OSTREE_REQS" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               OSTREE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ostree-1 >= $OSTREE_REQS" 2>&1`
+        else
+               OSTREE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ostree-1 >= $OSTREE_REQS" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$OSTREE_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (ostree-1 >= $OSTREE_REQS) were not met:
+
+$OSTREE_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables OSTREE_CFLAGS
+and OSTREE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables OSTREE_CFLAGS
+and OSTREE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       OSTREE_CFLAGS=$pkg_cv_OSTREE_CFLAGS
+       OSTREE_LIBS=$pkg_cv_OSTREE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FUSE" >&5
+$as_echo_n "checking for FUSE... " >&6; }
+
+if test -n "$FUSE_CFLAGS"; then
+    pkg_cv_FUSE_CFLAGS="$FUSE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "fuse") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FUSE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$FUSE_LIBS"; then
+    pkg_cv_FUSE_LIBS="$FUSE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "fuse") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FUSE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               FUSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fuse" 2>&1`
+        else
+               FUSE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fuse" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$FUSE_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (fuse) were not met:
+
+$FUSE_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables FUSE_CFLAGS
+and FUSE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables FUSE_CFLAGS
+and FUSE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       FUSE_CFLAGS=$pkg_cv_FUSE_CFLAGS
+       FUSE_LIBS=$pkg_cv_FUSE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5
+$as_echo_n "checking for JSON... " >&6; }
+
+if test -n "$JSON_CFLAGS"; then
+    pkg_cv_JSON_CFLAGS="$JSON_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-glib-1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-glib-1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json-glib-1.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$JSON_LIBS"; then
+    pkg_cv_JSON_LIBS="$JSON_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-glib-1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-glib-1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json-glib-1.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-glib-1.0" 2>&1`
+        else
+               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-glib-1.0" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$JSON_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (json-glib-1.0) were not met:
+
+$JSON_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables JSON_CFLAGS
+and JSON_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables JSON_CFLAGS
+and JSON_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       JSON_CFLAGS=$pkg_cv_JSON_CFLAGS
+       JSON_LIBS=$pkg_cv_JSON_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for APPSTREAM_GLIB" >&5
+$as_echo_n "checking for APPSTREAM_GLIB... " >&6; }
+
+if test -n "$APPSTREAM_GLIB_CFLAGS"; then
+    pkg_cv_APPSTREAM_GLIB_CFLAGS="$APPSTREAM_GLIB_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"appstream-glib >= 0.5.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "appstream-glib >= 0.5.10") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_APPSTREAM_GLIB_CFLAGS=`$PKG_CONFIG --cflags "appstream-glib >= 0.5.10" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$APPSTREAM_GLIB_LIBS"; then
+    pkg_cv_APPSTREAM_GLIB_LIBS="$APPSTREAM_GLIB_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"appstream-glib >= 0.5.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "appstream-glib >= 0.5.10") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_APPSTREAM_GLIB_LIBS=`$PKG_CONFIG --libs "appstream-glib >= 0.5.10" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               APPSTREAM_GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "appstream-glib >= 0.5.10" 2>&1`
+        else
+               APPSTREAM_GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "appstream-glib >= 0.5.10" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$APPSTREAM_GLIB_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (appstream-glib >= 0.5.10) were not met:
+
+$APPSTREAM_GLIB_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables APPSTREAM_GLIB_CFLAGS
+and APPSTREAM_GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables APPSTREAM_GLIB_CFLAGS
+and APPSTREAM_GLIB_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       APPSTREAM_GLIB_CFLAGS=$pkg_cv_APPSTREAM_GLIB_CFLAGS
+       APPSTREAM_GLIB_LIBS=$pkg_cv_APPSTREAM_GLIB_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+# Check whether --enable-seccomp was given.
+if test "${enable_seccomp+set}" = set; then :
+  enableval=$enable_seccomp;
+else
+  enable_seccomp=yes
+fi
+
+
+if test "x$enable_seccomp" = "xyes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBSECCOMP" >&5
+$as_echo_n "checking for LIBSECCOMP... " >&6; }
+
+if test -n "$LIBSECCOMP_CFLAGS"; then
+    pkg_cv_LIBSECCOMP_CFLAGS="$LIBSECCOMP_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libseccomp\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libseccomp") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBSECCOMP_CFLAGS=`$PKG_CONFIG --cflags "libseccomp" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$LIBSECCOMP_LIBS"; then
+    pkg_cv_LIBSECCOMP_LIBS="$LIBSECCOMP_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libseccomp\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libseccomp") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBSECCOMP_LIBS=`$PKG_CONFIG --libs "libseccomp" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               LIBSECCOMP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libseccomp" 2>&1`
+        else
+               LIBSECCOMP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libseccomp" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$LIBSECCOMP_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (libseccomp) were not met:
+
+$LIBSECCOMP_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LIBSECCOMP_CFLAGS
+and LIBSECCOMP_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LIBSECCOMP_CFLAGS
+and LIBSECCOMP_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       LIBSECCOMP_CFLAGS=$pkg_cv_LIBSECCOMP_CFLAGS
+       LIBSECCOMP_LIBS=$pkg_cv_LIBSECCOMP_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+$as_echo "#define ENABLE_SECCOMP 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-priv-mode was given.
+if test "${with_priv_mode+set}" = set; then :
+  withval=$with_priv_mode;
+else
+  with_priv_mode="none"
+fi
+
+
+ if test "x$with_priv_mode" = "xsetuid"; then
+  PRIV_MODE_SETUID_TRUE=
+  PRIV_MODE_SETUID_FALSE='#'
+else
+  PRIV_MODE_SETUID_TRUE='#'
+  PRIV_MODE_SETUID_FALSE=
+fi
+
+
+# Check whether --enable-sudo was given.
+if test "${enable_sudo+set}" = set; then :
+  enableval=$enable_sudo; SUDO_BIN="sudo"
+else
+  SUDO_BIN=""
+fi
+
+
+
+# Do we enable building peer to peer support using libostree’s experimental (non-stable) API?
+# If so, OSTREE_ENABLE_EXPERIMENTAL_API needs to be #defined before ostree.h is
+# included.
+# Check whether --enable-p2p was given.
+if test "${enable_p2p+set}" = set; then :
+  enableval=$enable_p2p;
+else
+  enable_p2p=no
+fi
+
+if test x$enable_p2p = xyes; then :
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSTREE" >&5
+$as_echo_n "checking for OSTREE... " >&6; }
+
+if test -n "$OSTREE_CFLAGS"; then
+    pkg_cv_OSTREE_CFLAGS="$OSTREE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ostree-1 >= \$OSTREE_REQS\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "ostree-1 >= $OSTREE_REQS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OSTREE_CFLAGS=`$PKG_CONFIG --cflags "ostree-1 >= $OSTREE_REQS" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$OSTREE_LIBS"; then
+    pkg_cv_OSTREE_LIBS="$OSTREE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ostree-1 >= \$OSTREE_REQS\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "ostree-1 >= $OSTREE_REQS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OSTREE_LIBS=`$PKG_CONFIG --libs "ostree-1 >= $OSTREE_REQS" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               OSTREE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ostree-1 >= $OSTREE_REQS" 2>&1`
+        else
+               OSTREE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ostree-1 >= $OSTREE_REQS" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$OSTREE_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (ostree-1 >= $OSTREE_REQS) were not met:
+
+$OSTREE_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables OSTREE_CFLAGS
+and OSTREE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables OSTREE_CFLAGS
+and OSTREE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       OSTREE_CFLAGS=$pkg_cv_OSTREE_CFLAGS
+       OSTREE_LIBS=$pkg_cv_OSTREE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+  ostree_features=$($PKG_CONFIG --variable=features ostree-1)
+  case "$ostree_features" in #(
+  *experimental*) :
+    have_ostree_experimental=yes ;; #(
+  *) :
+     ;;
+esac
+
+  if test "x$have_ostree_experimental" != "xyes"; then :
+  as_fn_error $? "Experimental API not found in ostree-1, which is needed for --enable-p2p. OSTree must be compiled with --enable-experimental-api." "$LINENO" 5
+fi
+
+
+$as_echo "#define OSTREE_ENABLE_EXPERIMENTAL_API 1" >>confdefs.h
+
+
+$as_echo "#define FLATPAK_ENABLE_P2P 1" >>confdefs.h
+
+
+fi
+ if test x$enable_p2p = xyes; then
+  ENABLE_P2P_TRUE=
+  ENABLE_P2P_FALSE='#'
+else
+  ENABLE_P2P_TRUE='#'
+  ENABLE_P2P_FALSE=
+fi
+
+
+
+# Check whether --with-system-install-dir was given.
+if test "${with_system_install_dir+set}" = set; then :
+  withval=$with_system_install_dir;
+else
+  with_system_install_dir='$(localstatedir)/lib/flatpak'
+fi
+
+SYSTEM_INSTALL_DIR=$with_system_install_dir
+
+
+# Check whether --enable-documentation was given.
+if test "${enable_documentation+set}" = set; then :
+  enableval=$enable_documentation;
+else
+  enable_documentation=yes
+fi
+
+if test x$enable_documentation = xyes; then
+   # Extract the first word of "xsltproc", so it can be a program name with args.
+set dummy xsltproc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XSLTPROC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XSLTPROC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+XSLTPROC=$ac_cv_path_XSLTPROC
+if test -n "$XSLTPROC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5
+$as_echo "$XSLTPROC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+   if test x$XSLTPROC = x; then
+      as_fn_error $? "xsltproc is required to build documentation" "$LINENO" 5
+   fi
+
+
+  # check for the presence of the XML catalog
+
+# Check whether --with-xml-catalog was given.
+if test "${with_xml_catalog+set}" = set; then :
+  withval=$with_xml_catalog;
+else
+  with_xml_catalog=/etc/xml/catalog
+fi
+
+  jh_found_xmlcatalog=true
+  XML_CATALOG_FILE="$with_xml_catalog"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML catalog ($XML_CATALOG_FILE)" >&5
+$as_echo_n "checking for XML catalog ($XML_CATALOG_FILE)... " >&6; }
+  if test -f "$XML_CATALOG_FILE"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+  else
+    jh_found_xmlcatalog=false
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+  fi
+
+  # check for the xmlcatalog program
+  # Extract the first word of "xmlcatalog", so it can be a program name with args.
+set dummy xmlcatalog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XMLCATALOG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XMLCATALOG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XMLCATALOG="$XMLCATALOG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XMLCATALOG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XMLCATALOG" && ac_cv_path_XMLCATALOG="no"
+  ;;
+esac
+fi
+XMLCATALOG=$ac_cv_path_XMLCATALOG
+if test -n "$XMLCATALOG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLCATALOG" >&5
+$as_echo "$XMLCATALOG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  if test "x$XMLCATALOG" = xno; then
+    jh_found_xmlcatalog=false
+  fi
+
+  if $jh_found_xmlcatalog; then
+    :
+  else
+    :
+  fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DocBook XML DTD V4.1.2 in XML catalog" >&5
+$as_echo_n "checking for DocBook XML DTD V4.1.2 in XML catalog... " >&6; }
+  if $jh_found_xmlcatalog && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$XMLCATALOG --noout \"\$XML_CATALOG_FILE\" \"-//OASIS//DTD DocBook XML V4.1.2//EN\" >&2"; } >&5
+  ($XMLCATALOG --noout "$XML_CATALOG_FILE" "-//OASIS//DTD DocBook XML V4.1.2//EN" >&2) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    have_docbook_dtd=yes
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+    have_docbook_dtd=no
+  fi
+
+  if test "$have_docbook_dtd" != yes; then
+    as_fn_error $? "DocBook DTD is required for --enable-documentation" "$LINENO" 5
+  fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DocBook XSL Stylesheets in XML catalog" >&5
+$as_echo_n "checking for DocBook XSL Stylesheets in XML catalog... " >&6; }
+  if $jh_found_xmlcatalog && \
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$XMLCATALOG --noout \"\$XML_CATALOG_FILE\" \"http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl\" >&2"; } >&5
+  ($XMLCATALOG --noout "$XML_CATALOG_FILE" "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" >&2) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    have_docbook_style=yes
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+    have_docbook_style=no
+  fi
+
+  if test "$have_docbook_style" != yes; then
+    as_fn_error $? "DocBook XSL Stylesheets are required for --enable-documentation" "$LINENO" 5
+  fi
+fi
+ if test x$enable_documentation = xyes; then
+  BUILD_DOCUMENTATION_TRUE=
+  BUILD_DOCUMENTATION_FALSE='#'
+else
+  BUILD_DOCUMENTATION_TRUE='#'
+  BUILD_DOCUMENTATION_FALSE=
+fi
+
+
+
+
+
+                # Check whether --enable-introspection was given.
+if test "${enable_introspection+set}" = set; then :
+  enableval=$enable_introspection;
+else
+  enable_introspection=auto
+fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5
+$as_echo_n "checking for gobject-introspection... " >&6; }
+
+        case $enable_introspection in #(
+  no) :
+            found_introspection="no (disabled, use --enable-introspection to enable)"
+     ;; #(
+      yes) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  :
+else
+  as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5
+fi
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.40.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.40.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  found_introspection=yes
+else
+  as_fn_error $? "You need to have gobject-introspection >= 1.40.0 installed to build Flatpak" "$LINENO" 5
+fi
+     ;; #(
+      auto) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.40.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.40.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  found_introspection=yes
+else
+  found_introspection=no
+fi
+               enable_introspection=$found_introspection
+     ;; #(
+  *) :
+                as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5
+     ;;
+esac
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5
+$as_echo "$found_introspection" >&6; }
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+
+
+
+
+
+
+
+
+
+     if test "x$found_introspection" = "xyes"; then
+  HAVE_INTROSPECTION_TRUE=
+  HAVE_INTROSPECTION_FALSE='#'
+else
+  HAVE_INTROSPECTION_TRUE='#'
+  HAVE_INTROSPECTION_FALSE=
+fi
+
+
+
+
+# gtkdocize greps for ^GTK_DOC_CHECK, so we need to put it on its own line
+
+
+
+
+  gtk_doc_requires="gtk-doc >= 1.20"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gtk-doc" >&5
+$as_echo_n "checking for gtk-doc... " >&6; }
+  if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$gtk_doc_requires\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$gtk_doc_requires") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  have_gtk_doc=yes
+else
+  have_gtk_doc=no
+fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gtk_doc" >&5
+$as_echo "$have_gtk_doc" >&6; }
+
+  if test "$have_gtk_doc" = "no"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+  You will not be able to create source packages with 'make dist'
+  because $gtk_doc_requires is not found." >&5
+$as_echo "$as_me: WARNING:
+  You will not be able to create source packages with 'make dist'
+  because $gtk_doc_requires is not found." >&2;}
+  fi
+
+            # Extract the first word of "gtkdoc-check", so it can be a program name with args.
+set dummy gtkdoc-check; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GTKDOC_CHECK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$GTKDOC_CHECK"; then
+  ac_cv_prog_GTKDOC_CHECK="$GTKDOC_CHECK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_GTKDOC_CHECK="gtkdoc-check.test"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+GTKDOC_CHECK=$ac_cv_prog_GTKDOC_CHECK
+if test -n "$GTKDOC_CHECK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_CHECK" >&5
+$as_echo "$GTKDOC_CHECK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  # Extract the first word of "gtkdoc-check", so it can be a program name with args.
+set dummy gtkdoc-check; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GTKDOC_CHECK_PATH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GTKDOC_CHECK_PATH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GTKDOC_CHECK_PATH="$GTKDOC_CHECK_PATH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GTKDOC_CHECK_PATH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+GTKDOC_CHECK_PATH=$ac_cv_path_GTKDOC_CHECK_PATH
+if test -n "$GTKDOC_CHECK_PATH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_CHECK_PATH" >&5
+$as_echo "$GTKDOC_CHECK_PATH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  for ac_prog in gtkdoc-rebase
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GTKDOC_REBASE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GTKDOC_REBASE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GTKDOC_REBASE="$GTKDOC_REBASE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GTKDOC_REBASE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+GTKDOC_REBASE=$ac_cv_path_GTKDOC_REBASE
+if test -n "$GTKDOC_REBASE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_REBASE" >&5
+$as_echo "$GTKDOC_REBASE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$GTKDOC_REBASE" && break
+done
+test -n "$GTKDOC_REBASE" || GTKDOC_REBASE="true"
+
+  # Extract the first word of "gtkdoc-mkpdf", so it can be a program name with args.
+set dummy gtkdoc-mkpdf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GTKDOC_MKPDF+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GTKDOC_MKPDF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GTKDOC_MKPDF="$GTKDOC_MKPDF" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GTKDOC_MKPDF="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+GTKDOC_MKPDF=$ac_cv_path_GTKDOC_MKPDF
+if test -n "$GTKDOC_MKPDF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_MKPDF" >&5
+$as_echo "$GTKDOC_MKPDF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+# Check whether --with-html-dir was given.
+if test "${with_html_dir+set}" = set; then :
+  withval=$with_html_dir;
+else
+  with_html_dir='${datadir}/gtk-doc/html'
+fi
+
+  HTML_DIR="$with_html_dir"
+
+
+    # Check whether --enable-gtk-doc was given.
+if test "${enable_gtk_doc+set}" = set; then :
+  enableval=$enable_gtk_doc;
+else
+  enable_gtk_doc=no
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build gtk-doc documentation" >&5
+$as_echo_n "checking whether to build gtk-doc documentation... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk_doc" >&5
+$as_echo "$enable_gtk_doc" >&6; }
+
+  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
+    as_fn_error $? "
+  You must have $gtk_doc_requires installed to build documentation for
+  $PACKAGE_NAME. Please install gtk-doc or disable building the
+  documentation by adding '--disable-gtk-doc' to '$0'." "$LINENO" 5
+  fi
+
+    if test "x$PACKAGE_NAME" != "xglib"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTKDOC_DEPS" >&5
+$as_echo_n "checking for GTKDOC_DEPS... " >&6; }
+
+if test -n "$GTKDOC_DEPS_CFLAGS"; then
+    pkg_cv_GTKDOC_DEPS_CFLAGS="$GTKDOC_DEPS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GTKDOC_DEPS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$GTKDOC_DEPS_LIBS"; then
+    pkg_cv_GTKDOC_DEPS_LIBS="$GTKDOC_DEPS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GTKDOC_DEPS_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0" 2>&1`
+        else
+               GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$GTKDOC_DEPS_PKG_ERRORS" >&5
+
+       :
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       :
+else
+       GTKDOC_DEPS_CFLAGS=$pkg_cv_GTKDOC_DEPS_CFLAGS
+       GTKDOC_DEPS_LIBS=$pkg_cv_GTKDOC_DEPS_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+  fi
+
+    # Check whether --enable-gtk-doc-html was given.
+if test "${enable_gtk_doc_html+set}" = set; then :
+  enableval=$enable_gtk_doc_html;
+else
+  enable_gtk_doc_html=yes
+fi
+
+    # Check whether --enable-gtk-doc-pdf was given.
+if test "${enable_gtk_doc_pdf+set}" = set; then :
+  enableval=$enable_gtk_doc_pdf;
+else
+  enable_gtk_doc_pdf=no
+fi
+
+
+  if test -z "$GTKDOC_MKPDF"; then
+    enable_gtk_doc_pdf=no
+  fi
+
+  if test -z "$AM_DEFAULT_VERBOSITY"; then
+    AM_DEFAULT_VERBOSITY=1
+  fi
+
+
+   if test x$have_gtk_doc = xyes; then
+  HAVE_GTK_DOC_TRUE=
+  HAVE_GTK_DOC_FALSE='#'
+else
+  HAVE_GTK_DOC_TRUE='#'
+  HAVE_GTK_DOC_FALSE=
+fi
+
+   if test x$enable_gtk_doc = xyes; then
+  ENABLE_GTK_DOC_TRUE=
+  ENABLE_GTK_DOC_FALSE='#'
+else
+  ENABLE_GTK_DOC_TRUE='#'
+  ENABLE_GTK_DOC_FALSE=
+fi
+
+   if test x$enable_gtk_doc_html = xyes; then
+  GTK_DOC_BUILD_HTML_TRUE=
+  GTK_DOC_BUILD_HTML_FALSE='#'
+else
+  GTK_DOC_BUILD_HTML_TRUE='#'
+  GTK_DOC_BUILD_HTML_FALSE=
+fi
+
+   if test x$enable_gtk_doc_pdf = xyes; then
+  GTK_DOC_BUILD_PDF_TRUE=
+  GTK_DOC_BUILD_PDF_FALSE='#'
+else
+  GTK_DOC_BUILD_PDF_TRUE='#'
+  GTK_DOC_BUILD_PDF_FALSE=
+fi
+
+   if test -n "$LIBTOOL"; then
+  GTK_DOC_USE_LIBTOOL_TRUE=
+  GTK_DOC_USE_LIBTOOL_FALSE='#'
+else
+  GTK_DOC_USE_LIBTOOL_TRUE='#'
+  GTK_DOC_USE_LIBTOOL_FALSE=
+fi
+
+   if test -n "$GTKDOC_REBASE"; then
+  GTK_DOC_USE_REBASE_TRUE=
+  GTK_DOC_USE_REBASE_FALSE='#'
+else
+  GTK_DOC_USE_REBASE_TRUE='#'
+  GTK_DOC_USE_REBASE_FALSE=
+fi
+
+
+
+# Check whether --enable-gtk-doc-check was given.
+if test "${enable_gtk_doc_check+set}" = set; then :
+  enableval=$enable_gtk_doc_check;
+else
+  enable_gtk_doc_check=no
+fi
+
+
+ if test "x$enable_gtk_doc_check" = xyes; then
+  ENABLE_GTK_DOC_CHECK_TRUE=
+  ENABLE_GTK_DOC_CHECK_FALSE='#'
+else
+  ENABLE_GTK_DOC_CHECK_TRUE='#'
+  ENABLE_GTK_DOC_CHECK_FALSE=
+fi
+
+
+
+# Check whether --enable-docbook-docs was given.
+if test "${enable_docbook_docs+set}" = set; then :
+  enableval=$enable_docbook_docs; enable_docbook_docs=$enableval
+else
+  enable_docbook_docs=auto
+fi
+
+# Extract the first word of "xmlto", so it can be a program name with args.
+set dummy xmlto; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XMLTO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XMLTO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XMLTO="$XMLTO" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XMLTO="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XMLTO" && ac_cv_path_XMLTO="no"
+  ;;
+esac
+fi
+XMLTO=$ac_cv_path_XMLTO
+if test -n "$XMLTO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLTO" >&5
+$as_echo "$XMLTO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build DocBook documentation" >&5
+$as_echo_n "checking whether to build DocBook documentation... " >&6; }
+if test x$XMLTO = xno ; then
+        have_docbook=no
+else
+        have_docbook=yes
+fi
+if test x$enable_docbook_docs = xauto ; then
+        if test x$have_docbook = xno ; then
+                enable_docbook_docs=no
+        else
+                enable_docbook_docs=yes
+        fi
+fi
+if test x$enable_docbook_docs = xyes; then
+        if test x$have_docbook = xno; then
+                as_fn_error $? "Building DocBook docs explicitly required, but DocBook not found" "$LINENO" 5
+        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+ if test x$enable_docbook_docs = xyes; then
+  DOCBOOK_DOCS_ENABLED_TRUE=
+  DOCBOOK_DOCS_ENABLED_FALSE='#'
+else
+  DOCBOOK_DOCS_ENABLED_TRUE='#'
+  DOCBOOK_DOCS_ENABLED_FALSE=
+fi
+
+
+
+
+
+##################################################
+# Visibility handling
+##################################################
+
+HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+  *)
+        SAVED_CFLAGS="${CFLAGS}"
+    CFLAGS="-fvisibility=hidden"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5
+$as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int main (void) { return 0; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                   enable_fvisibility_hidden=yes
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                   enable_fvisibility_hidden=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    CFLAGS="${SAVED_CFLAGS}"
+
+    if test "${enable_fvisibility_hidden}" = "yes"; then :
+
+
+$as_echo "#define FLATPAK_EXTERN __attribute__((visibility(\"default\"))) extern" >>confdefs.h
+
+      HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+
+else
+
+
+$as_echo "#define FLATPAK_EXTERN extern" >>confdefs.h
+
+
+fi
+    ;;
+esac
+
+
+
+  # Check whether --enable-installed-tests was given.
+if test "${enable_installed_tests+set}" = set; then :
+  enableval=$enable_installed_tests; case ${enableval} in
+                  yes) ENABLE_INSTALLED_TESTS="1"  ;;
+                  no)  ENABLE_INSTALLED_TESTS="" ;;
+                  *) as_fn_error $? "bad value ${enableval} for --enable-installed-tests" "$LINENO" 5 ;;
+                 esac
+fi
+
+   if test "$ENABLE_INSTALLED_TESTS" = "1"; then
+  ENABLE_INSTALLED_TESTS_TRUE=
+  ENABLE_INSTALLED_TESTS_FALSE='#'
+else
+  ENABLE_INSTALLED_TESTS_TRUE='#'
+  ENABLE_INSTALLED_TESTS_FALSE=
+fi
+
+  # Check whether --enable-always-build-tests was given.
+if test "${enable_always_build_tests+set}" = set; then :
+  enableval=$enable_always_build_tests; case ${enableval} in
+                  yes) ENABLE_ALWAYS_BUILD_TESTS="1"  ;;
+                  no)  ENABLE_ALWAYS_BUILD_TESTS="" ;;
+                  *) as_fn_error $? "bad value ${enableval} for --enable-always-build-tests" "$LINENO" 5 ;;
+                 esac
+fi
+
+   if test "$ENABLE_ALWAYS_BUILD_TESTS" = "1"; then
+  ENABLE_ALWAYS_BUILD_TESTS_TRUE=
+  ENABLE_ALWAYS_BUILD_TESTS_FALSE='#'
+else
+  ENABLE_ALWAYS_BUILD_TESTS_TRUE='#'
+  ENABLE_ALWAYS_BUILD_TESTS_FALSE=
+fi
+
+  if test "$ENABLE_INSTALLED_TESTS" = "1"; then
+    installed_test_metadir=${datadir}/installed-tests/Flatpak
+
+    installed_testdir=${libexecdir}/installed-tests/Flatpak
+
+  fi
+
+
+FLATPAK_MAJOR_VERSION=0
+FLATPAK_MINOR_VERSION=10
+FLATPAK_MICRO_VERSION=2
+FLATPAK_EXTRA_VERSION=
+FLATPAK_INTERFACE_AGE=0
+FLATPAK_VERSION=0.10.2
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_MAJOR_VERSION $FLATPAK_MAJOR_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_MINOR_VERSION $FLATPAK_MINOR_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_MICRO_VERSION $FLATPAK_MICRO_VERSION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_EXTRA_VERSION $FLATPAK_EXTRA_VERSION
+_ACEOF
+
+
+# libtool versioning
+#LT_RELEASE=$FLATPAK_MAJOR_VERSION.$FLATPAK_MINOR_VERSION
+#LT_CURRENT=`expr $FLATPAK_MICRO_VERSION - $FLATPAK_INTERFACE_AGE`
+#LT_REVISION=$FLATPAK_INTERFACE_AGE
+#LT_AGE=`expr $FLATPAK_BINARY_AGE - $FLATPAK_INTERFACE_AGE`
+#LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
+
+
+
+
+LT_VERSION_INFO="1002:0:1002"
+LT_CURRENT_MINUS_AGE=0
+
+
+
+ac_config_files="$ac_config_files Makefile doc/Makefile doc/reference/Makefile flatpak.pc lib/flatpak-version-macros.h doc/reference/version.xml doc/flatpak-docs.xml po/Makefile.in"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+       cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+         mv -f confcache "$cache_file"$$ &&
+         mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+         mv -f confcache "$cache_file" ;;
+       esac
+      fi
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${VALGRIND_ENABLED_TRUE}" && test -z "${VALGRIND_ENABLED_FALSE}"; then
+  as_fn_error $? "conditional \"VALGRIND_ENABLED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_SYSTEM_BWRAP_TRUE}" && test -z "${WITH_SYSTEM_BWRAP_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_SYSTEM_BWRAP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${WITH_SYSTEM_BWRAP_TRUE}" && test -z "${WITH_SYSTEM_BWRAP_FALSE}"; then
+  as_fn_error $? "conditional \"WITH_SYSTEM_BWRAP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_SYSTEM_HELPER_TRUE}" && test -z "${BUILD_SYSTEM_HELPER_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_SYSTEM_HELPER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${PRIV_MODE_SETUID_TRUE}" && test -z "${PRIV_MODE_SETUID_FALSE}"; then
+  as_fn_error $? "conditional \"PRIV_MODE_SETUID\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_P2P_TRUE}" && test -z "${ENABLE_P2P_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_P2P\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_DOCUMENTATION_TRUE}" && test -z "${BUILD_DOCUMENTATION_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_DOCUMENTATION\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_GTK_DOC_TRUE}" && test -z "${HAVE_GTK_DOC_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_GTK_DOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_GTK_DOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GTK_DOC_BUILD_HTML_TRUE}" && test -z "${GTK_DOC_BUILD_HTML_FALSE}"; then
+  as_fn_error $? "conditional \"GTK_DOC_BUILD_HTML\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GTK_DOC_BUILD_PDF_TRUE}" && test -z "${GTK_DOC_BUILD_PDF_FALSE}"; then
+  as_fn_error $? "conditional \"GTK_DOC_BUILD_PDF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GTK_DOC_USE_LIBTOOL_TRUE}" && test -z "${GTK_DOC_USE_LIBTOOL_FALSE}"; then
+  as_fn_error $? "conditional \"GTK_DOC_USE_LIBTOOL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GTK_DOC_USE_REBASE_TRUE}" && test -z "${GTK_DOC_USE_REBASE_FALSE}"; then
+  as_fn_error $? "conditional \"GTK_DOC_USE_REBASE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_GTK_DOC_CHECK_TRUE}" && test -z "${ENABLE_GTK_DOC_CHECK_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_GTK_DOC_CHECK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DOCBOOK_DOCS_ENABLED_TRUE}" && test -z "${DOCBOOK_DOCS_ENABLED_FALSE}"; then
+  as_fn_error $? "conditional \"DOCBOOK_DOCS_ENABLED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_INSTALLED_TESTS_TRUE}" && test -z "${ENABLE_INSTALLED_TESTS_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_INSTALLED_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_ALWAYS_BUILD_TESTS_TRUE}" && test -z "${ENABLE_ALWAYS_BUILD_TESTS_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_ALWAYS_BUILD_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by Flatpak $as_me 0.10.2, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <https://github.com/flatpak/flatpak/issues>.
+Flatpak home page: <http://flatpak.org/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+Flatpak config.status 0.10.2
+configured by $0, generated by GNU Autoconf 2.69,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`'
+configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_import \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_cv_nm_interface \
+nm_file_list_spec \
+lt_cv_truncate_bin \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+configure_time_dlsearch_path \
+configure_time_lt_sys_library_path; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+
+# See if we are running on zsh, and set the options that allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}"; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+    # from automake < 1.5.
+    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+    "doc/reference/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/Makefile" ;;
+    "flatpak.pc") CONFIG_FILES="$CONFIG_FILES flatpak.pc" ;;
+    "lib/flatpak-version-macros.h") CONFIG_FILES="$CONFIG_FILES lib/flatpak-version-macros.h" ;;
+    "doc/reference/version.xml") CONFIG_FILES="$CONFIG_FILES doc/reference/version.xml" ;;
+    "doc/flatpak-docs.xml") CONFIG_FILES="$CONFIG_FILES doc/flatpak-docs.xml" ;;
+    "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp= ac_tmp=
+  trap 'exit_status=$?
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = "\a"
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=[    ]*/{
+h
+s///
+s/^/:/
+s/[     ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[  ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[    ]*#[    ]*define[       ][      ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$ac_tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+       `' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$ac_tmp/stdin"
+  case $ac_file in
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$ac_tmp/config.h" "$ac_file" \
+       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "libtool":C)
+
+    # See if we are running on zsh, and set the options that allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}"; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile=${ofile}T
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+# Generated automatically by $as_me ($PACKAGE) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=''
+
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shared archive member basename,for filename based shared library versioning on AIX.
+shared_archive_member_spec=$shared_archive_member_spec
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm into a list of symbols to manually relocate.
+global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name lister interface.
+nm_interface=$lt_lt_cv_nm_interface
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and where our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# Command to truncate a binary pipe.
+lt_truncate_bin=$lt_lt_cv_truncate_bin
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Detected run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path
+
+# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
+configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \$shlibpath_var if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test set != "${COLLECT_NAMES+set}"; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain=$ac_aux_dir/ltmain.sh
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+ ;;
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Older Autoconf quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named 'Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running 'make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "$am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+ ;;
+    "po-directories":C)
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        # Treat a directory as a PO directory if and only if it has a
+        # POTFILES.in file. This allows packages to have multiple PO
+        # directories under different names or in different locations.
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          gt_tab=`printf '\t'`
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          POMAKEFILEDEPS="POTFILES.in"
+          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$OBSOLETE_ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+          else
+            # The set of available languages was given in configure.in.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
+            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+          fi
+          # Compute POFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+          # Compute UPDATEPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+          # Compute DUMMYPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+          # Compute GMOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          GMOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+if test x$BWRAP = xfalse ; then
+  build_bwrap="yes"
+else
+  build_bwrap="no"
+fi
+
+echo ""
+echo "          Flatpak $FLATPAK_VERSION"
+echo "          ============="
+echo ""
+echo "          Build system helper:    $enable_system_helper"
+echo "          Build bubblewrap:       $build_bwrap"
+echo "          Use sandboxed triggers: $enable_sandboxed_triggers"
+echo "          Use seccomp:            $enable_seccomp"
+echo "          Privileged group:       $PRIVILEGED_GROUP"
+echo "          Privilege mode:         $with_priv_mode"
+echo "          Peer to peer support:   $enable_p2p"
+echo ""
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..93a4b89
--- /dev/null
@@ -0,0 +1,452 @@
+AC_PREREQ([2.63])
+
+# Making releases:
+#   FLATPAK_MICRO_VERSION += 1;
+#   FLATPAK_INTERFACE_AGE += 1;
+#   FLATPAK_BINARY_AGE += 1;
+# if any functions have been added, set FLATPAK_INTERFACE_AGE to 0.
+# if backwards compatibility has been broken,
+# set FLATPAK_BINARY_AGE and FLATPAK_INTERFACE_AGE to 0.
+#
+# in easier to understand terms:
+#
+# on the stable branch, interface age == micro
+# on the unstable (ie master), interface age = 0
+
+m4_define([flatpak_major_version], [0])
+m4_define([flatpak_minor_version], [10])
+m4_define([flatpak_micro_version], [2])
+m4_define([flatpak_extra_version], [])
+m4_define([flatpak_interface_age], [0])
+m4_define([flatpak_binary_age],
+          [m4_eval(10000 * flatpak_major_version + 100 * flatpak_minor_version + flatpak_micro_version)])
+m4_define([flatpak_version],
+          [flatpak_major_version.flatpak_minor_version.flatpak_micro_version()flatpak_extra_version])
+
+AC_INIT([Flatpak],
+        [flatpak_version],
+        [https://github.com/flatpak/flatpak/issues],
+        [flatpak],
+        [http://flatpak.org/])
+
+GLIB_REQS=2.44
+SYSTEM_BWRAP_REQS=0.1.8
+OSTREE_REQS=2017.14
+
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_DISABLE_STATIC
+
+LT_PREREQ([2.2.6])
+LT_INIT([disable-static])
+
+AC_CONFIG_SRCDIR([common/flatpak-dir.c])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([1.13.4 no-define no-dist-gzip dist-xz tar-ustar foreign subdir-objects])
+AC_PROG_SED
+
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.18.2])
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$PACKAGE", [gettext domain])
+
+# Enable silent rules is available
+AM_SILENT_RULES([yes])
+AM_MAINTAINER_MODE([enable])
+
+dnl This list is shared with https://github.com/ostreedev/ostree
+CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\
+-pipe \
+-Wall \
+-Werror=empty-body \
+-Werror=strict-prototypes \
+-Werror=missing-prototypes \
+-Werror=implicit-function-declaration \
+"-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \
+-Werror=pointer-arith -Werror=init-self \
+-Werror=missing-declarations \
+-Werror=return-type \
+-Werror=overflow \
+-Werror=int-conversion \
+-Werror=parenthesis \
+-Werror=incompatible-pointer-types \
+-Werror=misleading-indentation \
+-Werror=missing-include-dirs \
+])
+AC_SUBST(WARN_CFLAGS)
+
+AX_VALGRIND_CHECK
+
+PKG_PROG_PKG_CONFIG([0.24])
+
+AC_ARG_WITH(privileged_group,
+               AS_HELP_STRING([--with-privileged-group=GROUP],[Name of privileged group, [default=wheel]]),
+            with_privileged_group="$withval", with_privileged_group=wheel)
+PRIVILEGED_GROUP=$with_privileged_group
+AC_SUBST(PRIVILEGED_GROUP)
+
+AC_ARG_WITH(dbus_service_dir,
+               AS_HELP_STRING([--with-dbus-service-dir=PATH],[choose directory for dbus service files, [default=PREFIX/share/dbus-1/services]]),
+            with_dbus_service_dir="$withval", with_dbus_service_dir=$datadir/dbus-1/services)
+DBUS_SERVICE_DIR=$with_dbus_service_dir
+AC_SUBST(DBUS_SERVICE_DIR)
+
+AC_ARG_WITH(dbus_config_dir,
+               AS_HELP_STRING([--with-dbus-config-dir=PATH],[choose directory for dbus config files, [default=SYSCONFDIR/dbus-1/system.d]]),
+            with_dbus_config_dir="$withval", with_dbus_config_dir=${sysconfdir}/dbus-1/system.d)
+DBUS_CONFIG_DIR=$with_dbus_config_dir
+AC_SUBST(DBUS_CONFIG_DIR)
+
+AC_ARG_WITH([systemduserunitdir],
+            [AS_HELP_STRING([--with-systemduserunitdir=DIR],
+                            [Directory for systemd user service files (default=PREFIX/lib/systemd/user)])],
+    [],
+    dnl This is deliberately not ${libdir}: systemd units always go in
+    dnl .../lib, never .../lib64 or .../lib/x86_64-linux-gnu
+    [with_systemduserunitdir='${prefix}/lib/systemd/user'])
+AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
+
+AC_ARG_WITH([systemdsystemunitdir],
+            [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+                            [Directory for systemd system service files (default=PREFIX/lib/systemd/system)])],
+    [],
+    dnl This is deliberately not ${libdir}: systemd units always go in
+    dnl .../lib, never .../lib64 or .../lib/x86_64-linux-gnu
+    [with_systemdsystemunitdir='${prefix}/lib/systemd/system'])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+
+AC_ARG_WITH(system_fonts_dir,
+               AS_HELP_STRING([--with-system-fonts-dir=PATH],[Directory where system fonts are, [default=/usr/share/fonts]]),
+            with_system_fonts_dir="$withval", with_system_fonts_dir=/usr/share/fonts)
+SYSTEM_FONTS_DIR=$with_system_fonts_dir
+AC_SUBST(SYSTEM_FONTS_DIR)
+
+AC_ARG_WITH(system_font_cache_dirs,
+               AS_HELP_STRING([--with-system-font-cache-dirs=PATHS],[Directory where the system font cache is, [default=/var/cache/fontconfig:/usr/lib/fontconfig/cache]]),
+            with_system_font_cache_dirs="$withval", with_system_font_cache_dirs=/var/cache/fontconfig:/usr/lib/fontconfig/cache)
+SYSTEM_FONT_CACHE_DIRS=$with_system_font_cache_dirs
+AC_SUBST(SYSTEM_FONT_CACHE_DIRS)
+
+AC_ARG_WITH(profile_dir,
+               AS_HELP_STRING([--with-profile-dir=PATH],[choose directory for profile.d files, [default=SYSCONFDIR/profile.d]]),
+            with_profile_dir="$withval", with_profile_dir=${sysconfdir}/profile.d)
+PROFILE_DIR=$with_profile_dir
+AC_SUBST(PROFILE_DIR)
+
+AC_ARG_VAR([BWRAP], [Bubblewrap executable])
+AC_ARG_WITH([system-bubblewrap],
+            [AS_HELP_STRING([--with-system-bubblewrap], [Use system bwrap executable [default=check $BWRAP]])],
+            [BWRAP="$withval"],
+            [BWRAP="${BWRAP:-false}"])
+AS_CASE([$BWRAP],
+        [yes],
+            [BWRAP=bwrap],
+        [no],
+            [BWRAP=false],
+        [auto],
+            [AC_CHECK_PROG([BWRAP], [bwrap], [bwrap], [false])])
+if test "x$BWRAP" != xfalse; then
+   BWRAP_VERSION=`$BWRAP --version | sed 's,.*\ \([0-9]*\.[0-9]*\.[0-9]*\)$,\1,'`
+   AX_COMPARE_VERSION([$SYSTEM_BWRAP_REQS],[gt],[$BWRAP_VERSION],
+                      [AC_MSG_ERROR([You need at least version $SYSTEM_BWRAP_REQS of bubblewrap to use the system installed version])])
+   AM_CONDITIONAL([WITH_SYSTEM_BWRAP], [true])
+else
+   AM_CONDITIONAL([WITH_SYSTEM_BWRAP], [false])
+fi
+
+AC_CHECK_FUNCS(fdwalk)
+LIBGLNX_CONFIGURE
+
+AC_CHECK_HEADER([sys/xattr.h], [], [AC_MSG_ERROR([You must have sys/xattr.h from glibc])])
+AC_CHECK_HEADER([sys/capability.h], have_caps=yes, [AC_MSG_ERROR([sys/capability.h header not found])])
+
+AC_SUBST([GLIB_MKENUMS], [`$PKG_CONFIG --variable glib_mkenums glib-2.0`])
+AC_SUBST([GLIB_COMPILE_RESOURCES], [`$PKG_CONFIG --variable glib_compile_resources gio-2.0`])
+AC_SUBST([GDBUS_CODEGEN], [`$PKG_CONFIG --variable gdbus_codegen gio-2.0`])
+
+POLKIT_GOBJECT_REQUIRED=0.98
+
+PKG_CHECK_MODULES(BASE, [glib-2.0 >= $GLIB_REQS gio-2.0 gio-unix-2.0 libarchive >= 2.8.0 libxml-2.0 >= 2.4 ])
+PKG_CHECK_MODULES(SOUP, [libsoup-2.4])
+
+save_LIBS=$LIBS
+LIBS=$BASE_LIBS
+AC_CHECK_FUNCS(archive_read_support_filter_all)
+LIBS=$save_LIBS
+
+LIBGPGME_DEPENDENCY="1.1.8"
+PKG_CHECK_MODULES(DEP_GPGME, gpgme-pthread >= $LIBGPGME_DEPENDENCY, have_gpgme=yes, [
+    m4_ifdef([AM_PATH_GPGME_PTHREAD], [
+       AM_PATH_GPGME_PTHREAD($LIBGPGME_DEPENDENCY, have_gpgme=yes, have_gpgme=no)
+    ],[ have_gpgme=no ])
+])
+AS_IF([ test x$have_gpgme = xno ], [
+   AC_MSG_ERROR([Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later])
+])
+
+AC_ARG_ENABLE([system-helper],
+              AC_HELP_STRING([--disable-system-helper],
+                             [Disable system helper]),
+              [],
+              [enable_system_helper=yes])
+if test "x$enable_system_helper" = "xyes"; then
+  PKG_CHECK_MODULES(POLKIT, \
+                   polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
+  AC_DEFINE([USE_SYSTEM_HELPER], [1], [Define if using system-helper])
+fi
+AM_CONDITIONAL(BUILD_SYSTEM_HELPER, test x$enable_system_helper = xyes)
+
+AC_ARG_ENABLE([xauth],
+              AC_HELP_STRING([--disable-xauth],
+                             [Disable Xauth use]),
+              [],
+              [enable_xauth=yes])
+if test "x$enable_xauth" = "xyes"; then
+   PKG_CHECK_MODULES(XAUTH, [xau])
+   AC_DEFINE([ENABLE_XAUTH], [1],
+      [Define if using xauth])
+fi
+
+AC_ARG_ENABLE([sandboxed-triggers],
+              AC_HELP_STRING([--disable-sandboxed-triggers],
+                             [Disable sandboxed triggers]),
+              [],
+              [enable_sandboxed_triggers=yes])
+if test "x$enable_sandboxed_triggers" = "xno"; then
+   AC_DEFINE([DISABLE_SANDBOXED_TRIGGERS], [1],
+      [Define if sandboxed triggers are disabled])
+fi
+
+PKG_CHECK_MODULES(OSTREE, [ostree-1 >= $OSTREE_REQS])
+
+PKG_CHECK_MODULES(FUSE, [fuse])
+
+PKG_CHECK_MODULES(JSON, [json-glib-1.0])
+
+PKG_CHECK_MODULES(APPSTREAM_GLIB, [appstream-glib >= 0.5.10])
+
+AC_ARG_ENABLE([seccomp],
+              AC_HELP_STRING([--disable-seccomp],
+                             [Disable seccomp]),
+              [],
+              [enable_seccomp=yes])
+
+if test "x$enable_seccomp" = "xyes"; then
+   PKG_CHECK_MODULES(LIBSECCOMP, [libseccomp])
+   AC_DEFINE([ENABLE_SECCOMP], [1],
+      [Define if using seccomp])
+fi
+
+AC_ARG_WITH(priv-mode,
+            AS_HELP_STRING([--with-priv-mode=setuid/none],
+                           [How to set privilege-raising during install (only needed if userns not working)]),
+            [],
+            [with_priv_mode="none"])
+
+AM_CONDITIONAL(PRIV_MODE_SETUID, test "x$with_priv_mode" = "xsetuid")
+
+AC_ARG_ENABLE(sudo,
+              AS_HELP_STRING([--enable-sudo],[Use sudo to set setuid flags on binaries during install (only needed if userns disabled)]),
+              [SUDO_BIN="sudo"], [SUDO_BIN=""])
+AC_SUBST([SUDO_BIN])
+
+# Do we enable building peer to peer support using libostree’s experimental (non-stable) API?
+# If so, OSTREE_ENABLE_EXPERIMENTAL_API needs to be #defined before ostree.h is
+# included.
+AC_ARG_ENABLE([p2p],
+  [AS_HELP_STRING([--enable-p2p],
+                  [Enable unstable peer to peer support [default=no]])],,
+  [enable_p2p=no])
+AS_IF([test x$enable_p2p = xyes],[
+  PKG_CHECK_MODULES(OSTREE, [ostree-1 >= $OSTREE_REQS])
+
+  ostree_features=$($PKG_CONFIG --variable=features ostree-1)
+  AS_CASE(["$ostree_features"],
+          [*experimental*],[have_ostree_experimental=yes])
+
+  AS_IF([test "x$have_ostree_experimental" != "xyes"],
+        [AC_MSG_ERROR([Experimental API not found in ostree-1, which is needed for --enable-p2p. OSTree must be compiled with --enable-experimental-api.])])
+
+  AC_DEFINE([OSTREE_ENABLE_EXPERIMENTAL_API],[1],[Define if libostree experimental API should be enabled])
+  AC_DEFINE([FLATPAK_ENABLE_P2P],[1],[Define if peer to peer support should be enabled])
+])
+AM_CONDITIONAL([ENABLE_P2P],[test x$enable_p2p = xyes])
+
+AC_ARG_WITH(system-install-dir,
+           [AS_HELP_STRING([--with-system-install-dir=DIR],
+                           [Location of system installation [LOCALSTATEDIR/lib/flatpak]])],
+           [],
+           [with_system_install_dir='$(localstatedir)/lib/flatpak'])
+SYSTEM_INSTALL_DIR=$with_system_install_dir
+AC_SUBST(SYSTEM_INSTALL_DIR)
+
+AC_ARG_ENABLE(documentation,
+              AC_HELP_STRING([--enable-documentation], [Build documentation]),,
+              enable_documentation=yes)
+if test x$enable_documentation = xyes; then
+   AC_PATH_PROG([XSLTPROC], [xsltproc])
+   if test x$XSLTPROC = x; then
+      AC_MSG_ERROR([xsltproc is required to build documentation])
+   fi
+
+  dnl check for DocBook DTD in the local catalog
+  JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
+     [DocBook XML DTD V4.1.2], [have_docbook_dtd=yes], [have_docbook_dtd=no])
+  if test "$have_docbook_dtd" != yes; then
+    AC_MSG_ERROR([DocBook DTD is required for --enable-documentation])
+  fi
+
+  dnl check for DocBook XSL stylesheets in the local catalog
+  JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
+     [DocBook XSL Stylesheets], [have_docbook_style=yes],[have_docbook_style=no])
+  if test "$have_docbook_style" != yes; then
+    AC_MSG_ERROR([DocBook XSL Stylesheets are required for --enable-documentation])
+  fi
+fi
+AM_CONDITIONAL(BUILD_DOCUMENTATION, test x$enable_documentation = xyes)
+
+GOBJECT_INTROSPECTION_CHECK([1.40.0])
+
+# gtkdocize greps for ^GTK_DOC_CHECK, so we need to put it on its own line
+m4_ifdef([GTK_DOC_CHECK], [
+GTK_DOC_CHECK([1.20], [--flavour no-tmpl])
+
+AC_ARG_ENABLE([gtk-doc-check],
+              [AS_HELP_STRING([--enable-gtk-doc-check],
+                              [Check completeness of documentation in 'make check'])],
+    [],
+    [enable_gtk_doc_check=no])
+],[
+enable_gtk_doc="disabled (no gtk-doc)"
+enable_gtk_doc_check="disabled (no gtk-doc)"
+AM_CONDITIONAL([ENABLE_GTK_DOC], [false])
+])
+AM_CONDITIONAL([ENABLE_GTK_DOC_CHECK], [test "x$enable_gtk_doc_check" = xyes])
+
+
+AC_ARG_ENABLE(docbook-docs,
+        [AS_HELP_STRING([--enable-docbook-docs],[build documentation (requires xmlto)])],
+        enable_docbook_docs=$enableval, enable_docbook_docs=auto)
+AC_PATH_PROG(XMLTO, xmlto, no)
+AC_MSG_CHECKING([whether to build DocBook documentation])
+if test x$XMLTO = xno ; then
+        have_docbook=no
+else
+        have_docbook=yes
+fi
+if test x$enable_docbook_docs = xauto ; then
+        if test x$have_docbook = xno ; then
+                enable_docbook_docs=no
+        else
+                enable_docbook_docs=yes
+        fi
+fi
+if test x$enable_docbook_docs = xyes; then
+        if test x$have_docbook = xno; then
+                AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
+        fi
+        AC_MSG_RESULT(yes)
+else
+        AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
+AC_ARG_VAR([XMLTO],[Define/override the 'xmlto' location.])
+AC_ARG_VAR([XMLTO_FLAGS],[Define/override 'xmlto' options, like '--skip-validation'.])
+
+
+##################################################
+# Visibility handling
+##################################################
+
+HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+  *)
+    dnl on other compilers, check if we can do -fvisibility=hidden
+    SAVED_CFLAGS="${CFLAGS}"
+    CFLAGS="-fvisibility=hidden"
+    AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+    AC_TRY_COMPILE([], [int main (void) { return 0; }],
+                   AC_MSG_RESULT(yes)
+                   enable_fvisibility_hidden=yes,
+                   AC_MSG_RESULT(no)
+                   enable_fvisibility_hidden=no)
+    CFLAGS="${SAVED_CFLAGS}"
+
+    AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
+      AC_DEFINE([FLATPAK_EXTERN], [__attribute__((visibility("default"))) extern],
+                [defines how to decorate public symbols while building])
+      HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+    ], [
+      AC_DEFINE([FLATPAK_EXTERN], [extern],
+                [defines how to decorate public symbols while building])
+    ])
+    ;;
+esac
+AC_SUBST(HIDDEN_VISIBILITY_CFLAGS)
+
+GLIB_TESTS
+
+FLATPAK_MAJOR_VERSION=flatpak_major_version
+FLATPAK_MINOR_VERSION=flatpak_minor_version
+FLATPAK_MICRO_VERSION=flatpak_micro_version
+FLATPAK_EXTRA_VERSION=flatpak_extra_version
+FLATPAK_INTERFACE_AGE=flatpak_interface_age
+FLATPAK_VERSION=flatpak_version
+AC_SUBST(FLATPAK_MAJOR_VERSION)
+AC_SUBST(FLATPAK_MINOR_VERSION)
+AC_SUBST(FLATPAK_MICRO_VERSION)
+AC_SUBST(FLATPAK_INTERFACE_AGE)
+AC_SUBST(FLATPAK_VERSION)
+AC_DEFINE_UNQUOTED([PACKAGE_MAJOR_VERSION], $FLATPAK_MAJOR_VERSION, [Major version])
+AC_DEFINE_UNQUOTED([PACKAGE_MINOR_VERSION], $FLATPAK_MINOR_VERSION, [Minor version])
+AC_DEFINE_UNQUOTED([PACKAGE_MICRO_VERSION], $FLATPAK_MICRO_VERSION, [Micro version])
+AC_DEFINE_UNQUOTED([PACKAGE_EXTRA_VERSION], $FLATPAK_EXTRA_VERSION, [Extra version])
+
+# libtool versioning
+#LT_RELEASE=$FLATPAK_MAJOR_VERSION.$FLATPAK_MINOR_VERSION
+#LT_CURRENT=`expr $FLATPAK_MICRO_VERSION - $FLATPAK_INTERFACE_AGE`
+#LT_REVISION=$FLATPAK_INTERFACE_AGE
+#LT_AGE=`expr $FLATPAK_BINARY_AGE - $FLATPAK_INTERFACE_AGE`
+#LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
+
+m4_define([lt_current], [m4_eval(10000 * flatpak_major_version +  100 * flatpak_minor_version + flatpak_micro_version - flatpak_interface_age)])
+m4_define([lt_revision], [flatpak_interface_age])
+m4_define([lt_age], [m4_eval(flatpak_binary_age - flatpak_interface_age)])
+LT_VERSION_INFO="lt_current:lt_revision:lt_age"
+LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
+AC_SUBST(LT_VERSION_INFO)
+AC_SUBST(LT_CURRENT_MINUS_AGE)
+
+AC_CONFIG_FILES([
+Makefile
+doc/Makefile
+doc/reference/Makefile
+flatpak.pc
+lib/flatpak-version-macros.h
+doc/reference/version.xml
+doc/flatpak-docs.xml
+po/Makefile.in
+])
+AC_OUTPUT
+
+if test x$BWRAP = xfalse ; then
+  build_bwrap="yes"
+else
+  build_bwrap="no"
+fi
+
+echo ""
+echo "          Flatpak $FLATPAK_VERSION"
+echo "          ============="
+echo ""
+echo "          Build system helper:    $enable_system_helper"
+echo "          Build bubblewrap:       $build_bwrap"
+echo "          Use sandboxed triggers: $enable_sandboxed_triggers"
+echo "          Use seccomp:            $enable_seccomp"
+echo "          Privileged group:       $PRIVILEGED_GROUP"
+echo "          Privilege mode:         $with_priv_mode"
+echo "          Peer to peer support:   $enable_p2p"
+echo ""
diff --git a/data/Makefile.am.inc b/data/Makefile.am.inc
new file mode 100644 (file)
index 0000000..71e514e
--- /dev/null
@@ -0,0 +1,13 @@
+introspectiondir = $(datadir)/dbus-1/interfaces
+introspection_DATA = \
+       data/org.freedesktop.impl.portal.PermissionStore.xml \
+       data/org.freedesktop.portal.Documents.xml \
+       data/org.freedesktop.Flatpak.xml \
+       $(NULL)
+
+EXTRA_DIST += \
+       data/org.freedesktop.portal.Documents.xml \
+       data/org.freedesktop.impl.portal.PermissionStore.xml \
+       data/org.freedesktop.systemd1.xml \
+       data/org.freedesktop.Flatpak.xml \
+       $(NULL)
diff --git a/data/org.freedesktop.Flatpak.xml b/data/org.freedesktop.Flatpak.xml
new file mode 100644 (file)
index 0000000..4fb439a
--- /dev/null
@@ -0,0 +1,133 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<!--
+ Copyright (C) 2015 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+-->
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+  <interface name='org.freedesktop.Flatpak.SessionHelper'>
+    <property name="version" type="u" access="read"/>
+
+    <method name="RequestMonitor">
+      <arg type='ay' name='path' direction='out'/>
+    </method>
+  </interface>
+
+  <interface name='org.freedesktop.Flatpak.Development'>
+    <property name="version" type="u" access="read"/>
+
+    <!-- This methods let you start processes, sandboxed or not on the
+         host, so its not generally safe to allow access to it to any
+         application. However, at times it is very useful to be able
+         to do this. For instance for developer tools this lets you
+         build flatpaks from inside a flatpak. -->
+    <method name="HostCommand">
+      <arg type='ay' name='cwd_path' direction='in'/>
+      <arg type='aay' name='argv' direction='in'/>
+      <arg type='a{uh}' name='fds' direction='in'/>
+      <arg type='a{ss}' name='envs' direction='in'/>
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='u' name='pid' direction='out'/>
+    </method>
+    <method name="HostCommandSignal">
+      <arg type='u' name='pid' direction='in'/>
+      <arg type='u' name='signal' direction='in'/>
+      <arg type='b' name='to_process_group' direction='in'/>
+    </method>
+    <signal name="HostCommandExited">
+      <arg type='u' name='pid' direction='out'/>
+      <arg type='u' name='exit_status' direction='out'/>
+    </signal>
+
+  </interface>
+
+  <interface name='org.freedesktop.Flatpak.SystemHelper'>
+    <property name="version" type="u" access="read"/>
+
+    <method name="Deploy">
+      <arg type='ay' name='repo_path' direction='in'/>
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='ref' direction='in'/>
+      <arg type='s' name='origin' direction='in'/>
+      <arg type='as' name='subpaths' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="DeployAppstream">
+      <arg type='ay' name='repo_path' direction='in'/>
+      <arg type='s' name='origin' direction='in'/>
+      <arg type='s' name='arch' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="Uninstall">
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='ref' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="InstallBundle">
+      <arg type='ay' name='bundle_path' direction='in'/>
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='remote' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+      <arg type='s' name='ref' direction='out'/>
+    </method>
+
+    <method name="ConfigureRemote">
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='remote' direction='in'/>
+      <arg type='s' name='config' direction='in'/>
+      <arg type='ay' name='gpg_key' direction='in'>
+        <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
+      </arg>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="Configure">
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='key' direction='in'/>
+      <arg type='s' name='value' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="UpdateRemote">
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='remote' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+      <arg type='ay' name='summary_path' direction='in'/>
+      <arg type='ay' name='summary_sig_path' direction='in'/>
+    </method>
+
+    <method name="RemoveLocalRef">
+      <arg type='s' name='remote' direction='in'/>
+      <arg type='s' name='ref' direction='in'/>
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+    <method name="PruneLocalRepo">
+      <arg type='s' name='installation' direction='in'/>
+    </method>
+
+  </interface>
+
+</node>
diff --git a/data/org.freedesktop.impl.portal.PermissionStore.xml b/data/org.freedesktop.impl.portal.PermissionStore.xml
new file mode 100644 (file)
index 0000000..0e59e38
--- /dev/null
@@ -0,0 +1,163 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<!--
+ Copyright (C) 2015 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+-->
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+  <!--
+      org.freedesktop.impl.portal.PermissionStore:
+      @short_description: Database to store permissions
+
+      The permission store can be used by portals to store permissions
+      that sandboxed applications have to various resources, such as
+      files outside the sandbox.
+
+      Since the resources managed by portals can be varied, the permission
+      store is fairly free-form: there can be multiple tables; resources are
+      identified by an ID, as are applications, and permissions are stored as
+      string arrays. None of these strings are interpreted by the permission
+      store in any way.
+
+      In addition, the permission store allows to associate extra data
+      (in the form of a GVariant) with each resource.
+  -->
+  <interface name='org.freedesktop.impl.portal.PermissionStore'>
+    <property name="version" type="u" access="read"/>
+
+    <!--
+        Lookup:
+        @table: the name of the table to use
+        @id: the resource ID to look up
+        @permissions: map from application ID to permissions
+        @data: data that is associated with the resource
+
+        Looks up the entry for a resource in one of the tables and returns
+        all associated application permissions and data.
+    -->
+    <method name="Lookup">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+      <arg name='permissions' type='a{sas}' direction='out'/>
+      <arg name='data' type='v' direction='out'/>
+    </method>
+
+    <!--
+        Set:
+        @table: the name of the table to use
+        @create: whether to create the table if it does not exist
+        @id: the resource ID to modify
+        @app_permissions: map from application ID to permissions
+        @data: data to associate with the resource
+
+        Writes the entry for a resource in the given table.
+    -->
+    <method name="Set">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='create' type='b' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+      <arg name='app_permissions' type='a{sas}' direction='in'/>
+      <arg name='data' type='v' direction='in'/>
+    </method>
+
+    <!--
+        Delete:
+        @table: the name of the table to use
+        @id: the resource ID to delete
+
+        Removes the entry for a resource in the given table.
+    -->
+    <method name="Delete">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+    </method>
+
+    <!--
+        SetValue:
+        @table: the name of the table to use
+        @create: whether to create the table if it does not exist
+        @id: the resource ID to modify
+        @data: data to associate with the resource
+
+        Sets just the data for a resource in the given table.
+    -->
+    <method name="SetValue">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='create' type='b' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+      <arg name='data' type='v' direction='in'/>
+    </method>
+
+    <!--
+        SetPermission:
+        @table: the name of the table to use
+        @create: whether to create the table if it does not exist
+        @id: the resource ID to modify
+        @app: the application ID to modify
+        @permissions: permissions to set
+
+        Sets the permissions for an application and a resource
+        in the given table.
+    -->
+    <method name="SetPermission">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='create' type='b' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+      <arg name='app' type='s' direction='in'/>
+      <arg name='permissions' type='as' direction='in'/>
+    </method>
+
+    <!--
+        List:
+        @table: the name of the table to use
+        @ids: IDs of all resources that are present in the table
+
+        Returns all the resources that are present in the table.
+    -->
+    <method name="List">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='ids' type='as' direction='out'/>
+    </method>
+
+    <!--
+        Changed:
+        @table: the name of the table
+        @ids: IDs of the changed resource
+        @deleted: whether the resource was deleted
+        @data: the data that is associated the resource
+        @permissions: the permissions that are associated with the resource
+
+        The Changed signal is emitted when the entry for a resource
+        is modified or deleted. If the entry was deleted, then @data
+        and @permissions contain the last values that were found in the
+        database. If the entry was modified, they contain the new values.
+    -->
+    <signal name="Changed">
+      <arg name='table' type='s' direction='out'/>
+      <arg name='id' type='s' direction='out'/>
+      <arg name='deleted' type='b' direction='out'/>
+      <arg name='data' type='v' direction='out'/>
+      <arg name='permissions' type='a{sas}' direction='out'/>
+    </signal>
+  </interface>
+
+</node>
diff --git a/data/org.freedesktop.portal.Documents.xml b/data/org.freedesktop.portal.Documents.xml
new file mode 100644 (file)
index 0000000..78a09d8
--- /dev/null
@@ -0,0 +1,231 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<!--
+ Copyright (C) 2015 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General
+ Public License along with this library; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+-->
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+  <!--
+      org.freedesktop.portal.Documents:
+      @short_description: Document portal
+
+      The document portal allows to make files from the outside world
+      available to sandboxed applications in a controlled way.
+
+      Exported files will be made accessible to the application via
+      a fuse filesystem that gets mounted at /run/user/$UID/doc/. The
+      filesystem gets mounted both outside and inside the sandbox, but
+      the view inside the sandbox is restricted to just those files
+      that the application is allowed to access.
+
+      Individual files will appear at /run/user/$UID/doc/$DOC_ID/filename,
+      where $DOC_ID is the ID of the file in the document store. It is
+      returned by the org.freedesktop.portal.Documents.Add() and
+      org.freedesktop.portal.Documents.AddNamed() calls.
+
+      The permissions that the application has for a document store entry
+      (see org.freedesktop.portal.Documents.GrantPermissions()) are reflected
+      in the POSIX mode bits in the fuse filesystem.
+  -->
+  <interface name='org.freedesktop.portal.Documents'>
+    <property name="version" type="u" access="read"/>
+
+    <!--
+        GetMountPoint:
+        @path: the path at which the fuse filesystem is mounted
+
+        Returns the path at which the document store fuse filesystem
+        is mounted. This will typically be /run/user/$UID/doc/.
+    -->
+    <method name="GetMountPoint">
+      <arg type='ay' name='path' direction='out'/>
+    </method>
+
+    <!--
+        Add:
+        @o_path_fd: open file descriptor for the file to add
+        @reuse_existing: whether to reuse an existing document store entry for the file
+        @persistent: whether to add the file only for this session or permanently
+        @doc_id: the ID of the file in the document store
+
+        Adds a file to the document store. The file is passed in the
+        form of an open file descriptor to prove that the caller has
+        access to the file.
+    -->
+    <method name="Add">
+      <arg type='h' name='o_path_fd' direction='in'/>
+      <arg type='b' name='reuse_existing' direction='in'/>
+      <arg type='b' name='persistent' direction='in'/>
+      <arg type='s' name='doc_id' direction='out'/>
+    </method>
+
+    <!--
+        AddNamed:
+        @o_path_parent_fd: open file descriptor for the parent directory
+        @filename: the basename for the file
+        @reuse_existing: whether to reuse an existing document store entry for the file
+        @persistent: whether to add the file only for this session or permanently
+        @doc_id: the ID of the file in the document store
+
+        Creates an entry in the document store for writing a new file.
+    -->
+    <method name="AddNamed">
+      <arg type='h' name='o_path_parent_fd' direction='in'/>
+      <arg type='ay' name='filename' direction='in'/>
+      <arg type='b' name='reuse_existing' direction='in'/>
+      <arg type='b' name='persistent' direction='in'/>
+      <arg type='s' name='doc_id' direction='out'/>
+    </method>
+
+    <!--
+        AddFull:
+        @o_path_fds: open file descriptors for the files to export
+        @flags: flags, 1 == reuse_existing, 2 == persistent, 3 == as-needed-by-app
+        @app_id: an application ID, or empty string
+        @permissions: the permissions to grant, possible values are 'read', 'write', 'grant-permissions' and 'delete'
+        @doc_ids: the IDs of the files in the document store
+        @extra_info: Extra info returned
+
+        Adds multiple files to the document store. The file is passed in the
+        form of an open file descriptor to prove that the caller has
+        access to the file.
+
+        If the as-needed-by-app flag is given, files will only be added to
+        the document store if the application does not already have access to them.
+        For files that are not added to the document store, the doc_ids array will
+        contain an empty string.
+
+        Additionally, if app_id is specified, it will be given the permissions
+        listed in GrantPermission.
+
+        The method also returns some extra info that can be used to avoid
+        multiple roundtrips. For now it only contains as "mountpoint", the
+        fuse mountpoint of the document portal.
+
+        This method was added in version 2 of the org.freedesktop.portal.Documents interface.
+    -->
+    <method name="AddFull">
+      <arg type='ah' name='o_path_fds' direction='in'/>
+      <arg type='u' name='flags' direction='in'/>
+      <arg type='s' name='app_id' direction='in'/>
+      <arg type='as' name='permissions' direction='in'/>
+      <arg type='as' name='doc_ids' direction='out'/>
+      <arg type='a{sv}' name='extra_out' direction='out'/>
+    </method>
+
+    <!--
+        GrantPermissions:
+        @doc_id: the ID of the file in the document store
+        @app_id: the ID of the application to which permissions are granted
+        @permissions: the permissions to grant, possible values are 'read', 'write', 'grant-permissions' and 'delete'
+
+        Grants access permissions for a file in the document store
+        to an application.
+
+        This call is available inside the sandbox if the application
+        has the 'grant-permissions' permission for the document.
+    -->
+    <method name="GrantPermissions">
+      <arg type='s' name='doc_id' direction='in'/>
+      <arg type='s' name='app_id' direction='in'/>
+      <arg type='as' name='permissions' direction='in'/>
+    </method>
+
+    <!--
+        RevokePermissions:
+        @doc_id: the ID of the file in the document store
+        @app_id: the ID of the application to which permissions are granted
+        @permissions: the permissions to grant, possible values are 'read', 'write', 'grant-permissions' and 'delete'
+
+        Revokes access permissions for a file in the document store
+        from an application.
+
+        This call is available inside the sandbox if the application
+        has the 'grant-permissions' permission for the document.
+    -->
+    <method name="RevokePermissions">
+      <arg type='s' name='doc_id' direction='in'/>
+      <arg type='s' name='app_id' direction='in'/>
+      <arg type='as' name='permissions' direction='in'/>
+    </method>
+
+    <!--
+        Delete:
+        @doc_id: the ID of the file in the document store
+
+        Removes an entry from the document store. The file itself is
+        not deleted.
+
+        This call is available inside the sandbox if the application
+        has the 'delete' permission for the document.
+    -->
+    <method name="Delete">
+      <arg type='s' name='doc_id' direction='in'/>
+    </method>
+
+    <!--
+        Lookup:
+        @filename: a path in the host filesystem
+        @doc_id: the ID of the file in the document store, or '' if the file is not in the document store
+
+        Looks up the document ID for a file.
+
+        This call is no not available inside the sandbox.
+    -->
+    <method name="Lookup">
+      <arg type='ay' name='filename' direction='in'/>
+      <arg type='s' name='doc_id' direction='out'/>
+    </method>
+
+    <!--
+        Info:
+        @doc_id: the ID of the file in the document store
+        @path: the path for the file in the host filesystem
+        @apps: a dictionary mapping application IDs to the permissions for that application
+
+        Gets the filesystem path and application permissions for a document store
+        entry.
+
+        This call is not available inside the sandbox.
+    -->
+    <method name="Info">
+      <arg type='s' name='doc_id' direction='in'/>
+      <arg type='ay' name='path' direction='out'/>
+      <arg type='a{sas}' name='apps' direction='out'/>
+    </method>
+
+    <!--
+        List:
+        @app_id: an application ID, or '' to list all documents
+        @docs: a dictonary mapping document IDs to their filesystem path
+
+        Lists documents in the document store for an application (or for
+        all applications).
+
+        This call is not available inside the sandbox.
+    -->
+    <method name="List">
+      <arg type='s' name='app_id' direction='in'/>
+      <arg type='a{say}' name='docs' direction='out'/>
+    </method>
+  </interface>
+</node>
diff --git a/data/org.freedesktop.systemd1.xml b/data/org.freedesktop.systemd1.xml
new file mode 100644 (file)
index 0000000..5bdbe77
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.systemd1.Manager">
+  <method name="StartTransientUnit">
+   <arg type="s" direction="in" name="name"/>
+   <arg type="s" direction="in" name="mode"/>
+   <arg type="a(sv)" direction="in" name="properties"/>
+   <arg type="a(sa(sv))" direction="in" name="aux"/>
+   <arg type="o" direction="out" name="job"/>
+  </method>
+  <signal name="JobRemoved">
+   <arg type="u" name="id"/>
+   <arg type="o" name="job"/>
+   <arg type="s" name="unit"/>
+   <arg type="s" name="result"/>
+  </signal>
+ </interface>
+</node>
diff --git a/dbus-proxy/Makefile.am.inc b/dbus-proxy/Makefile.am.inc
new file mode 100644 (file)
index 0000000..c25d7af
--- /dev/null
@@ -0,0 +1,12 @@
+libexec_PROGRAMS += \
+       flatpak-dbus-proxy \
+       $(NULL)
+
+flatpak_dbus_proxy_SOURCES = \
+       dbus-proxy/flatpak-proxy.c      \
+       dbus-proxy/flatpak-proxy.h      \
+       dbus-proxy/dbus-proxy.c         \
+       $(NULL)
+
+flatpak_dbus_proxy_LDADD = $(AM_LDADD) $(BASE_LIBS) libglnx.la
+flatpak_dbus_proxy_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) -I$(srcdir)/dbus-proxy
diff --git a/dbus-proxy/dbus-proxy.c b/dbus-proxy/dbus-proxy.c
new file mode 100644 (file)
index 0000000..4359314
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "libglnx/libglnx.h"
+
+#include "flatpak-proxy.h"
+
+static GList *proxies;
+static int sync_fd = -1;
+
+static int
+parse_generic_args (int n_args, const char *args[])
+{
+  if (g_str_has_prefix (args[0], "--fd="))
+    {
+      const char *fd_s = args[0] + strlen ("--fd=");
+      char *endptr;
+      int fd;
+
+      fd = strtol (fd_s, &endptr, 10);
+      if (fd < 0 || endptr == fd_s || *endptr != 0)
+        {
+          g_printerr ("Invalid fd %s\n", fd_s);
+          return -1;
+        }
+      sync_fd = fd;
+
+      return 1;
+    }
+  else
+    {
+      g_printerr ("Unknown argument %s\n", args[0]);
+      return -1;
+    }
+}
+
+static int
+start_proxy (int n_args, const char *args[])
+{
+  g_autoptr(FlatpakProxy) proxy = NULL;
+  g_autoptr(GError) error = NULL;
+  const char *bus_address, *socket_path;
+  int n;
+
+  n = 0;
+  if (n_args < n + 1 || args[n][0] == '-')
+    {
+      g_printerr ("No bus address given\n");
+      return -1;
+    }
+  bus_address = args[n++];
+
+  if (n_args < n + 1 || args[n][0] == '-')
+    {
+      g_printerr ("No socket path given\n");
+      return -1;
+    }
+  socket_path = args[n++];
+
+  proxy = flatpak_proxy_new (bus_address, socket_path);
+
+  while (n < n_args)
+    {
+      if (args[n][0] != '-')
+        break;
+
+      if (g_str_has_prefix (args[n], "--see=") ||
+          g_str_has_prefix (args[n], "--talk=") ||
+          g_str_has_prefix (args[n], "--filter=") ||
+          g_str_has_prefix (args[n], "--own="))
+        {
+          FlatpakPolicy policy = FLATPAK_POLICY_SEE;
+          g_autofree char *name = NULL;
+          gboolean wildcard = FALSE;
+
+          if (args[n][2] == 't')
+            policy = FLATPAK_POLICY_TALK;
+          else if (args[n][2] == 'f')
+            policy = FLATPAK_POLICY_FILTERED;
+          else if (args[n][2] == 'o')
+            policy = FLATPAK_POLICY_OWN;
+
+          name = g_strdup (strchr (args[n], '=') + 1);
+
+          if (policy == FLATPAK_POLICY_FILTERED)
+            {
+              char *rule = strchr (name, '=');
+              if (rule != NULL)
+                {
+                  *rule++ = 0;
+                  flatpak_proxy_add_filter (proxy, name, rule);
+                }
+            }
+          else
+            {
+              if (g_str_has_suffix (name, ".*"))
+                {
+                  name[strlen (name) - 2] = 0;
+                  wildcard = TRUE;
+                }
+            }
+
+          if (name[0] == ':' || !g_dbus_is_name (name))
+            {
+              g_printerr ("'%s' is not a valid dbus name\n", name);
+              return -1;
+            }
+
+          if (wildcard)
+            flatpak_proxy_add_wildcarded_policy (proxy, name, policy);
+          else
+            flatpak_proxy_add_policy (proxy, name, policy);
+        }
+      else if (g_str_equal (args[n], "--log"))
+        {
+          flatpak_proxy_set_log_messages (proxy, TRUE);
+        }
+      else if (g_str_equal (args[n], "--filter"))
+        {
+          flatpak_proxy_set_filter (proxy, TRUE);
+        }
+      else if (g_str_equal (args[n], "--sloppy-names"))
+        {
+          /* This means we're reporing the name changes for all unique names,
+             which is needed for the a11y bus */
+          flatpak_proxy_set_sloppy_names (proxy, TRUE);
+        }
+      else
+        {
+          int res = parse_generic_args (n_args - n, &args[n]);
+          if (res == -1)
+            return -1;
+
+          n += res - 1; /* res - 1, because we ++ below */
+        }
+
+      n++;
+    }
+
+  if (!flatpak_proxy_start (proxy, &error))
+    {
+      g_printerr ("Failed to start proxy for %s: %s\n", bus_address, error->message);
+      return -1;
+    }
+
+  proxies = g_list_prepend (proxies, g_object_ref (proxy));
+
+  return n;
+}
+
+static gboolean
+sync_closed_cb (GIOChannel  *source,
+                GIOCondition condition,
+                gpointer     data)
+{
+  GList *l;
+
+  for (l = proxies; l != NULL; l = l->next)
+    flatpak_proxy_stop (FLATPAK_PROXY (l->data));
+
+  exit (0);
+  return TRUE;
+}
+
+int
+main (int argc, const char *argv[])
+{
+  GMainLoop *service_loop;
+  int n_args, res;
+  const char **args;
+
+  n_args = argc - 1;
+  args = &argv[1];
+
+  while (n_args > 0)
+    {
+      if (args[0][0] == '-')
+        {
+          res = parse_generic_args (n_args, &args[0]);
+          if (res == -1)
+            return 1;
+        }
+      else
+        {
+          res = start_proxy (n_args, args);
+          if (res == -1)
+            return 1;
+        }
+
+      g_assert (res > 0);
+      n_args -= res;
+      args += res;
+    }
+
+  if (proxies == NULL)
+    {
+      g_printerr ("No proxies specified\n");
+      return 1;
+    }
+
+  if (sync_fd >= 0)
+    {
+      ssize_t written;
+      GIOChannel *sync_channel;
+      written = write (sync_fd, "x", 1);
+      if (written != 1)
+        g_warning ("Can't write to sync socket");
+
+      sync_channel = g_io_channel_unix_new (sync_fd);
+      g_io_add_watch (sync_channel, G_IO_ERR | G_IO_HUP,
+                      sync_closed_cb, NULL);
+    }
+
+  service_loop = g_main_loop_new (NULL, FALSE);
+  g_main_loop_run (service_loop);
+
+  g_main_loop_unref (service_loop);
+
+  return 0;
+}
diff --git a/dbus-proxy/flatpak-proxy.c b/dbus-proxy/flatpak-proxy.c
new file mode 100644 (file)
index 0000000..ee88405
--- /dev/null
@@ -0,0 +1,2617 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <unistd.h>
+#include <string.h>
+
+#include "flatpak-proxy.h"
+
+#include <gio/gunixsocketaddress.h>
+#include <gio/gunixconnection.h>
+#include <gio/gunixfdmessage.h>
+
+/**
+ * The proxy listens to a unix domain socket, and for each new
+ * connection it opens up a new connection to a specified dbus bus
+ * address (typically the session bus) and forwards data between the
+ * two. During the authentication phase all data is forwarded as
+ * received, and additionally for the first 1 byte zero we also send
+ * the proxy credentials to the bus.
+ *
+ * Once the connection is authenticated there are two modes, filtered
+ * and unfiltered. In the unfiltered mode we just send all messages on
+ * as we receive, but in the in the filtering mode we apply a policy,
+ * which is similar to the policy supported by kdbus.
+ *
+ * The policy for the filtering consists of a mapping from well-known
+ * names to a policy that is either SEE, TALK or OWN. The default
+ * initial policy is that the the user is only allowed to TALK to the
+ * bus itself (org.freedesktop.DBus, or no destination specified), and
+ * TALK to its own unique id. All other clients are invisible. The
+ * well-known names can be specified exactly, or as a simple one-level
+ * wildcard like "org.foo.*" which matches "org.foo.bar", but not
+ * "org.foobar" or "org.foo.bar.gazonk".
+ *
+ * Polices are specified for well-known names, but they also affect
+ * the owner of that name, so that the policy for a unique id is the
+ * superset of the polices for all the names it owns. Due to technical
+ * reasons the policy for a unique name is "sticky", in that we keep
+ * the highest policy granted by a once-owned name even when the client
+ * releases that name. This is impossible to avoid in a race-free way
+ * in a proxy. But this is rarely a problem in practice, as clients
+ * rarely release names and stay on the bus.
+ *
+ * Here is a description of the policy levels:
+ * (all policy levels also imply the ones before it)
+ *
+ * SEE:
+ *    The name/id is visible in the ListNames reply
+ *    The name/id is visible in the ListActivatableNames reply
+ *    You can call GetNameOwner on the name
+ *    You can call NameHasOwner on the name
+ *    You see NameOwnerChanged signals on the name
+ *    You see NameOwnerChanged signals on the id when the client disconnects
+ *    You can call the GetXXX methods on the name/id to get e.g. the peer pid
+ *    You get AccessDenied rather than NameHasNoOwner when sending messages to the name/id
+ *
+ * FILTERED:
+ *    You can send *some* method calls to the name (not id)
+ *
+ * TALK:
+ *    You can send any method calls and signals to the name/id
+ *    You will receive broadcast signals from the name/id (if you have a match rule for them)
+ *    You can call StartServiceByName on the name
+ *
+ * OWN:
+ *    You are allowed to call RequestName/ReleaseName/ListQueuedOwners on the name.
+ *
+ * The policy applies only to signals and method calls. All replies
+ * (errors or method returns) are allowed once for an outstanding
+ * method call, and never otherwise.
+ *
+ * Every peer on the bus is considered priviledged, and we thus trust
+ * it. So we rely on similar proxies to be running for all untrusted
+ * clients. Any such priviledged peer is allowed to send method call
+ * or unicast signal messages to the proxied client. Once another peer
+ * sends you a message the unique id of that peer is now made visible
+ * (policy SEE) to the proxied client, allowing the client to track
+ * caller lifetimes via NameOwnerChanged signals.
+ *
+ * Differences to kdbus custom endpoint policies:
+ *
+ *  * The proxy will return the credentials (like pid) of the proxy,
+ *    not the real client.
+ *
+ *  * Policy is not dropped when a peer releases a name.
+ *
+ *  * Peers that call you become visible (SEE) (and get signals for
+ *    NameOwnerChange disconnect) In kdbus currently custom endpoints
+ *    never get NameOwnerChange signals for unique ids, but this is
+ *    problematic as it disallows a services to track lifetimes of its
+ *    clients.
+ *
+ * Mode of operation
+ *
+ * Once authenticated we receive incoming messages one at a time,
+ * and then we demarshal the message headers to make routing decisions.
+ * This means we trust the bus to do message format validation, etc.
+ * (because we don't parse the body). Also we assume that the bus verifies
+ * reply_serials, i.e. that a reply can only be sent once and by the real
+ * recipient of an previously sent method call.
+ *
+ * We don't however trust the serials from the client. We verify that
+ * they are strictly increasing to make sure the code is not confused
+ * by serials being reused.
+ *
+ * In order to track the ownership of the allowed names we hijack the
+ * connection after the initial Hello message, sending AddMatch,
+ * ListNames and GetNameOwner messages to get a proper view of who
+ * owns the names atm. Then we listen to NameOwnerChanged events for
+ * further updates. This causes a slight offset between serials in the
+ * client and serials as seen by the bus.
+ *
+ * After that the filter is strictly passive, in that we never
+ * construct our own requests. For each message received from the
+ * client we look up the type and the destination policy and make a
+ * decision to either pass it on as is, rewrite it before passing on
+ * (for instance ListName replies), drop it completely, or return a
+ * made-up reply/error to the sender.
+ *
+ * When returning a made-up reply we replace the actual message with a
+ * Ping request to the bus with the same serial and replace the resulting
+ * reply with the made up reply (with the serial from the Ping reply).
+ * This means we keep the strict message ordering and serial numbers of
+ * the bus.
+ *
+ * Policy is applied to unique ids in the following cases:
+ *  * During startup we call AddWatch for signals on all policy names
+ *    and wildcards (using arg0namespace) so that we get NameOwnerChanged
+ *    events which we use to update the unique id policies.
+ *  * During startup we create synthetic GetNameOwner requests for all
+ *    normal policy names, and if there are wildcarded names we create a
+ *    synthetic ListNames request and use the results of that to do further
+ *    GetNameOwner for the existing names matching the wildcards. When we get
+ *    replies for the GetNameOwner requests the unique id policy is updated.
+ *  * When we get a method call from a unique id, it gets SEE
+ *  * When we get a reply to the initial Hello request we give
+ *    our own assigned unique id policy TALK.
+ *
+ * All messages sent to the bus itself are fully demarshalled
+ * and handled on a per-method basis:
+ *
+ * Hello, AddMatch, RemoveMatch, GetId: Always allowed
+ * ListNames, ListActivatableNames: Always allowed, but response filtered
+ * UpdateActivationEnvironment, BecomeMonitor: Always denied
+ * RequestName, ReleaseName, ListQueuedOwners: Only allowed if arg0 is a name with policy OWN
+ * NameHasOwner, GetNameOwner: Only pass on if arg0 is a name with policy SEE, otherwise return synthetic reply
+ * StartServiceByName: Only allowed if policy TALK on arg0
+ * GetConnectionUnixProcessID, GetConnectionCredentials,
+ *  GetAdtAuditSessionData, GetConnectionSELinuxSecurityContext,
+ *  GetConnectionUnixUser: Allowed if policy SEE on arg0
+ *
+ * For unknown methods, we return a synthetic error.
+ */
+
+typedef struct FlatpakProxyClient FlatpakProxyClient;
+
+/* We start looking ignoring the first cr-lf
+   since there is no previous line initially */
+#define AUTH_END_INIT_OFFSET 2
+#define AUTH_END_STRING "\r\nBEGIN\r\n"
+
+typedef enum {
+  EXPECTED_REPLY_NONE,
+  EXPECTED_REPLY_NORMAL,
+  EXPECTED_REPLY_HELLO,
+  EXPECTED_REPLY_FILTER,
+  EXPECTED_REPLY_FAKE_GET_NAME_OWNER,
+  EXPECTED_REPLY_FAKE_LIST_NAMES,
+  EXPECTED_REPLY_LIST_NAMES,
+  EXPECTED_REPLY_REWRITE,
+} ExpectedReplyType;
+
+typedef struct
+{
+  gsize    size;
+  gsize    pos;
+  int      refcount;
+  gboolean send_credentials;
+  GList   *control_messages;
+
+  guchar   data[16];
+  /* data continues here */
+} Buffer;
+
+typedef struct
+{
+  Buffer     *buffer;
+  gboolean    big_endian;
+  guchar      type;
+  guchar      flags;
+  guint32     length;
+  guint32     serial;
+  const char *path;
+  const char *interface;
+  const char *member;
+  const char *error_name;
+  const char *destination;
+  const char *sender;
+  const char *signature;
+  gboolean    has_reply_serial;
+  guint32     reply_serial;
+  guint32     unix_fds;
+} Header;
+
+typedef struct
+{
+  char *path;
+  char *interface;
+  char *member;
+} Filter;
+
+static void header_free (Header *header);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Header, header_free)
+
+typedef struct
+{
+  gboolean            got_first_byte; /* always true on bus side */
+  gboolean            closed; /* always true on bus side */
+
+  FlatpakProxyClient *client;
+  GSocketConnection  *connection;
+  GSource            *in_source;
+  GSource            *out_source;
+
+  GBytes             *extra_input_data;
+  Buffer             *current_read_buffer;
+  Buffer              header_buffer;
+
+  GList              *buffers; /* to be sent */
+  GList              *control_messages;
+
+  GHashTable         *expected_replies;
+} ProxySide;
+
+struct FlatpakProxyClient
+{
+  GObject       parent;
+
+  FlatpakProxy *proxy;
+
+  gboolean      authenticated;
+  int           auth_end_offset;
+
+  ProxySide     client_side;
+  ProxySide     bus_side;
+
+  /* Filtering data: */
+  guint32     serial_offset;
+  guint32     hello_serial;
+  guint32     last_serial;
+  GHashTable *rewrite_reply;
+  GHashTable *get_owner_reply;
+
+  GHashTable *unique_id_policy;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakProxyClientClass;
+
+struct FlatpakProxy
+{
+  GSocketService parent;
+
+  gboolean       log_messages;
+
+  GList         *clients;
+  char          *socket_path;
+  char          *dbus_address;
+
+  gboolean       filter;
+  gboolean       sloppy_names;
+
+  GHashTable    *wildcard_policy;
+  GHashTable    *policy;
+  GHashTable    *filters;
+};
+
+typedef struct
+{
+  GSocketServiceClass parent_class;
+} FlatpakProxyClass;
+
+
+enum {
+  PROP_0,
+
+  PROP_DBUS_ADDRESS,
+  PROP_SOCKET_PATH
+};
+
+#define FLATPAK_TYPE_PROXY flatpak_proxy_get_type ()
+#define FLATPAK_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY, FlatpakProxy))
+#define FLATPAK_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY))
+
+
+#define FLATPAK_TYPE_PROXY_CLIENT flatpak_proxy_client_get_type ()
+#define FLATPAK_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY_CLIENT, FlatpakProxyClient))
+#define FLATPAK_IS_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY_CLIENT))
+
+GType flatpak_proxy_client_get_type (void);
+
+G_DEFINE_TYPE (FlatpakProxy, flatpak_proxy, G_TYPE_SOCKET_SERVICE)
+G_DEFINE_TYPE (FlatpakProxyClient, flatpak_proxy_client, G_TYPE_OBJECT)
+
+static void start_reading (ProxySide *side);
+static void stop_reading (ProxySide *side);
+
+static void
+buffer_unref (Buffer *buffer)
+{
+  g_assert (buffer->refcount > 0);
+  buffer->refcount--;
+
+  if (buffer->refcount == 0)
+    {
+      g_list_free_full (buffer->control_messages, g_object_unref);
+      g_free (buffer);
+    }
+}
+
+static Buffer *
+buffer_ref (Buffer *buffer)
+{
+  g_assert (buffer->refcount > 0);
+  buffer->refcount++;
+  return buffer;
+}
+
+static void
+free_side (ProxySide *side)
+{
+  g_clear_object (&side->connection);
+  g_clear_pointer (&side->extra_input_data, g_bytes_unref);
+
+  g_list_free_full (side->buffers, (GDestroyNotify) buffer_unref);
+  g_list_free_full (side->control_messages, (GDestroyNotify) g_object_unref);
+
+  if (side->in_source)
+    g_source_destroy (side->in_source);
+  if (side->out_source)
+    g_source_destroy (side->out_source);
+
+  g_hash_table_destroy (side->expected_replies);
+}
+
+static void
+flatpak_proxy_client_finalize (GObject *object)
+{
+  FlatpakProxyClient *client = FLATPAK_PROXY_CLIENT (object);
+
+  client->proxy->clients = g_list_remove (client->proxy->clients, client);
+  g_clear_object (&client->proxy);
+
+  g_hash_table_destroy (client->rewrite_reply);
+  g_hash_table_destroy (client->get_owner_reply);
+  g_hash_table_destroy (client->unique_id_policy);
+
+  free_side (&client->client_side);
+  free_side (&client->bus_side);
+
+  G_OBJECT_CLASS (flatpak_proxy_client_parent_class)->finalize (object);
+}
+
+static void
+flatpak_proxy_client_class_init (FlatpakProxyClientClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = flatpak_proxy_client_finalize;
+}
+
+static void
+init_side (FlatpakProxyClient *client, ProxySide *side)
+{
+  side->got_first_byte = (side == &client->bus_side);
+  side->client = client;
+  side->header_buffer.size = 16;
+  side->header_buffer.pos = 0;
+  side->current_read_buffer = &side->header_buffer;
+  side->expected_replies = g_hash_table_new (g_direct_hash, g_direct_equal);
+}
+
+static void
+flatpak_proxy_client_init (FlatpakProxyClient *client)
+{
+  init_side (client, &client->client_side);
+  init_side (client, &client->bus_side);
+
+  client->auth_end_offset = AUTH_END_INIT_OFFSET;
+  client->rewrite_reply = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
+  client->get_owner_reply = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
+  client->unique_id_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+}
+
+static FlatpakProxyClient *
+flatpak_proxy_client_new (FlatpakProxy *proxy, GSocketConnection *connection)
+{
+  FlatpakProxyClient *client;
+
+  g_socket_set_blocking (g_socket_connection_get_socket (connection), FALSE);
+
+  client = g_object_new (FLATPAK_TYPE_PROXY_CLIENT, NULL);
+  client->proxy = g_object_ref (proxy);
+  client->client_side.connection = g_object_ref (connection);
+
+  proxy->clients = g_list_prepend (proxy->clients, client);
+
+  return client;
+}
+
+static FlatpakPolicy
+flatpak_proxy_get_wildcard_policy (FlatpakProxy *proxy,
+                                   const char   *_name)
+{
+  guint policy, wildcard_policy = 0;
+  char *dot;
+  g_autofree char *name = g_strdup (_name);
+
+  dot = name + strlen (name);
+  while (dot)
+    {
+      *dot = 0;
+      policy = GPOINTER_TO_INT (g_hash_table_lookup (proxy->wildcard_policy, name));
+      wildcard_policy = MAX (wildcard_policy, policy);
+      dot = strrchr (name, '.');
+    }
+
+  return wildcard_policy;
+}
+
+static FlatpakPolicy
+flatpak_proxy_get_policy (FlatpakProxy *proxy,
+                          const char   *name)
+{
+  guint policy, wildcard_policy;
+
+  policy = GPOINTER_TO_INT (g_hash_table_lookup (proxy->policy, name));
+
+  wildcard_policy = flatpak_proxy_get_wildcard_policy (proxy, name);
+
+  return MAX (policy, wildcard_policy);
+}
+
+void
+flatpak_proxy_set_filter (FlatpakProxy *proxy,
+                          gboolean      filter)
+{
+  proxy->filter = filter;
+}
+
+void
+flatpak_proxy_set_sloppy_names (FlatpakProxy *proxy,
+                                gboolean      sloppy_names)
+{
+  proxy->sloppy_names = sloppy_names;
+}
+
+void
+flatpak_proxy_set_log_messages (FlatpakProxy *proxy,
+                                gboolean      log)
+{
+  proxy->log_messages = log;
+}
+
+void
+flatpak_proxy_add_policy (FlatpakProxy *proxy,
+                          const char   *name,
+                          FlatpakPolicy policy)
+{
+  guint current_policy = GPOINTER_TO_INT (g_hash_table_lookup (proxy->policy, name));
+
+  current_policy = MAX (policy, current_policy);
+
+  g_hash_table_replace (proxy->policy, g_strdup (name), GINT_TO_POINTER (current_policy));
+}
+
+void
+flatpak_proxy_add_wildcarded_policy (FlatpakProxy *proxy,
+                                     const char   *name,
+                                     FlatpakPolicy policy)
+{
+  g_hash_table_replace (proxy->wildcard_policy, g_strdup (name), GINT_TO_POINTER (policy));
+}
+
+static void
+filter_free (Filter *filter)
+{
+  g_free (filter->path);
+  g_free (filter->interface);
+  g_free (filter->member);
+  g_free (filter);
+}
+
+static void
+filter_list_free (GList *filters)
+{
+  g_list_free_full (filters, (GDestroyNotify)filter_free);
+}
+
+/* rules are of the form [org.the.interface.[method|*]][@/obj/path] */
+static Filter *
+filter_new (const char *rule)
+{
+  Filter *filter = g_new0 (Filter, 1);
+  const char *obj_path_start = NULL;
+  const char *method_end = NULL;
+
+  obj_path_start = strchr (rule, '@');
+  if (obj_path_start && obj_path_start[1] != 0)
+    filter->path = g_strdup (obj_path_start + 1);
+
+  if (obj_path_start != NULL)
+    method_end = obj_path_start;
+  else
+    method_end = rule + strlen(rule);
+
+  if (rule[0] != '@')
+    {
+      filter->interface = g_strndup (rule, method_end - rule);
+      char *dot = strrchr (filter->interface, '.');
+      if (dot != NULL)
+        {
+          *dot = 0;
+          if (strcmp (dot+1, "*") != 0)
+            filter->member = g_strdup (dot + 1);
+         }
+    }
+
+  return filter;
+}
+
+
+void
+flatpak_proxy_add_filter (FlatpakProxy *proxy,
+                          const char   *name,
+                          const char   *rule)
+{
+  Filter *filter;
+  GList *filters, *new_filters;
+
+  filter = filter_new (rule);
+  if (g_hash_table_lookup_extended (proxy->filters,
+                                    name,
+                                    NULL, (void **)&filters))
+    {
+      new_filters = g_list_append (filters, filter);
+      g_assert (new_filters == filters);
+    }
+  else
+    {
+      filters = g_list_append (NULL, filter);
+      g_hash_table_insert (proxy->filters, g_strdup (name), filters);
+    }
+}
+
+static void
+flatpak_proxy_finalize (GObject *object)
+{
+  FlatpakProxy *proxy = FLATPAK_PROXY (object);
+
+  if (g_socket_service_is_active (G_SOCKET_SERVICE (proxy)))
+    unlink (proxy->socket_path);
+
+  g_assert (proxy->clients == NULL);
+
+  g_hash_table_destroy (proxy->policy);
+  g_hash_table_destroy (proxy->wildcard_policy);
+  g_hash_table_destroy (proxy->filters);
+
+  g_free (proxy->socket_path);
+  g_free (proxy->dbus_address);
+
+  G_OBJECT_CLASS (flatpak_proxy_parent_class)->finalize (object);
+}
+
+static void
+flatpak_proxy_set_property (GObject      *object,
+                            guint         prop_id,
+                            const GValue *value,
+                            GParamSpec   *pspec)
+{
+  FlatpakProxy *proxy = FLATPAK_PROXY (object);
+
+  switch (prop_id)
+    {
+    case PROP_DBUS_ADDRESS:
+      proxy->dbus_address = g_value_dup_string (value);
+      break;
+
+    case PROP_SOCKET_PATH:
+      proxy->socket_path = g_value_dup_string (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_proxy_get_property (GObject    *object,
+                            guint       prop_id,
+                            GValue     *value,
+                            GParamSpec *pspec)
+{
+  FlatpakProxy *proxy = FLATPAK_PROXY (object);
+
+  switch (prop_id)
+    {
+    case PROP_DBUS_ADDRESS:
+      g_value_set_string (value, proxy->dbus_address);
+      break;
+
+    case PROP_SOCKET_PATH:
+      g_value_set_string (value, proxy->socket_path);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static Buffer *
+buffer_new (gsize size, Buffer *old)
+{
+  Buffer *buffer = g_malloc0 (sizeof (Buffer) + size - 16);
+
+  buffer->control_messages = NULL;
+  buffer->size = size;
+  buffer->refcount = 1;
+
+  if (old)
+    {
+      buffer->pos = old->pos;
+      /* Takes ownership of any old control messages */
+      buffer->control_messages = old->control_messages;
+      old->control_messages = NULL;
+
+      g_assert (size >= old->size);
+      memcpy (buffer->data, old->data, old->size);
+    }
+
+  return buffer;
+}
+
+static ProxySide *
+get_other_side (ProxySide *side)
+{
+  FlatpakProxyClient *client = side->client;
+
+  if (side == &client->client_side)
+    return &client->bus_side;
+
+  return &client->client_side;
+}
+
+static void
+side_closed (ProxySide *side)
+{
+  GSocket *socket, *other_socket;
+  ProxySide *other_side = get_other_side (side);
+
+  if (side->closed)
+    return;
+
+  socket = g_socket_connection_get_socket (side->connection);
+  g_socket_close (socket, NULL);
+  side->closed = TRUE;
+
+  other_socket = g_socket_connection_get_socket (other_side->connection);
+  if (!other_side->closed && other_side->buffers == NULL)
+    {
+      g_socket_close (other_socket, NULL);
+      other_side->closed = TRUE;
+    }
+
+  if (other_side->closed)
+    {
+      g_object_unref (side->client);
+    }
+  else
+    {
+      GError *error = NULL;
+
+      if (!g_socket_shutdown (other_socket, TRUE, FALSE, &error))
+        {
+          g_warning ("Unable to shutdown read side: %s", error->message);
+          g_error_free (error);
+        }
+    }
+}
+
+static gboolean
+buffer_read (ProxySide *side,
+             Buffer    *buffer,
+             GSocket   *socket)
+{
+  gssize res;
+  GInputVector v;
+  GError *error = NULL;
+  GSocketControlMessage **messages;
+  int num_messages, i;
+
+  if (side->extra_input_data)
+    {
+      gsize extra_size;
+      const guchar *extra_bytes = g_bytes_get_data (side->extra_input_data, &extra_size);
+
+      res = MIN (extra_size, buffer->size - buffer->pos);
+      memcpy (&buffer->data[buffer->pos], extra_bytes, res);
+
+      if (res < extra_size)
+        {
+          side->extra_input_data =
+            g_bytes_new_with_free_func (extra_bytes + res,
+                                        extra_size - res,
+                                        (GDestroyNotify) g_bytes_unref,
+                                        side->extra_input_data);
+        }
+      else
+        {
+          g_clear_pointer (&side->extra_input_data, g_bytes_unref);
+        }
+    }
+  else
+    {
+      int flags = 0;
+      v.buffer = &buffer->data[buffer->pos];
+      v.size = buffer->size - buffer->pos;
+
+      res = g_socket_receive_message (socket, NULL, &v, 1,
+                                      &messages,
+                                      &num_messages,
+                                      &flags, NULL, &error);
+      if (res < 0 && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+        {
+          g_error_free (error);
+          return FALSE;
+        }
+
+      if (res <= 0)
+        {
+          if (res != 0)
+            {
+              g_debug ("Error reading from socket: %s", error->message);
+              g_error_free (error);
+            }
+
+          side_closed (side);
+          return FALSE;
+        }
+
+      for (i = 0; i < num_messages; i++)
+        buffer->control_messages = g_list_append (buffer->control_messages, messages[i]);
+
+      g_free (messages);
+    }
+
+  buffer->pos += res;
+  return TRUE;
+}
+
+static gboolean
+buffer_write (ProxySide *side,
+              Buffer    *buffer,
+              GSocket   *socket)
+{
+  gssize res;
+  GOutputVector v;
+  GError *error = NULL;
+  GSocketControlMessage **messages = NULL;
+  int i, n_messages;
+  GList *l;
+
+  if (buffer->send_credentials &&
+      G_IS_UNIX_CONNECTION (side->connection))
+    {
+      g_assert (buffer->size == 1);
+
+      if (!g_unix_connection_send_credentials (G_UNIX_CONNECTION (side->connection),
+                                               NULL,
+                                               &error))
+        {
+          if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+            {
+              g_error_free (error);
+              return FALSE;
+            }
+
+          g_warning ("Error writing credentials to socket: %s", error->message);
+          g_error_free (error);
+
+          side_closed (side);
+          return FALSE;
+        }
+
+      buffer->pos = 1;
+      return TRUE;
+    }
+
+  n_messages = g_list_length (buffer->control_messages);
+  messages = g_new (GSocketControlMessage *, n_messages);
+  for (l = buffer->control_messages, i = 0; l != NULL; l = l->next, i++)
+    messages[i] = l->data;
+
+  v.buffer = &buffer->data[buffer->pos];
+  v.size = buffer->size - buffer->pos;
+
+  res = g_socket_send_message (socket, NULL, &v, 1,
+                               messages, n_messages,
+                               G_SOCKET_MSG_NONE, NULL, &error);
+  g_free (messages);
+  if (res < 0 && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+    {
+      g_error_free (error);
+      return FALSE;
+    }
+
+  if (res <= 0)
+    {
+      if (res < 0)
+        {
+          g_warning ("Error writing credentials to socket: %s", error->message);
+          g_error_free (error);
+        }
+
+      side_closed (side);
+      return FALSE;
+    }
+
+  g_list_free_full (buffer->control_messages, g_object_unref);
+  buffer->control_messages = NULL;
+
+  buffer->pos += res;
+  return TRUE;
+}
+
+static gboolean
+side_out_cb (GSocket *socket, GIOCondition condition, gpointer user_data)
+{
+  ProxySide *side = user_data;
+  FlatpakProxyClient *client = side->client;
+  gboolean retval = G_SOURCE_CONTINUE;
+
+  g_object_ref (client);
+
+  while (side->buffers)
+    {
+      Buffer *buffer = side->buffers->data;
+
+      if (buffer_write (side, buffer, socket))
+        {
+          if (buffer->pos == buffer->size)
+            {
+              side->buffers = g_list_delete_link (side->buffers, side->buffers);
+              buffer_unref (buffer);
+            }
+        }
+      else
+        {
+          break;
+        }
+    }
+
+  if (side->buffers == NULL)
+    {
+      ProxySide *other_side = get_other_side (side);
+
+      side->out_source = NULL;
+      retval = G_SOURCE_REMOVE;
+
+      if (other_side->closed)
+        side_closed (side);
+    }
+
+  g_object_unref (client);
+
+  return retval;
+}
+
+static void
+queue_expected_reply (ProxySide *side, guint32 serial, ExpectedReplyType type)
+{
+  g_hash_table_replace (side->expected_replies,
+                        GUINT_TO_POINTER (serial),
+                        GUINT_TO_POINTER (type));
+}
+
+static ExpectedReplyType
+steal_expected_reply (ProxySide *side, guint32 serial)
+{
+  ExpectedReplyType type;
+
+  type = GPOINTER_TO_UINT (g_hash_table_lookup (side->expected_replies,
+                                                GUINT_TO_POINTER (serial)));
+  if (type)
+    g_hash_table_remove (side->expected_replies,
+                         GUINT_TO_POINTER (serial));
+  return type;
+}
+
+
+static void
+queue_outgoing_buffer (ProxySide *side, Buffer *buffer)
+{
+  if (side->out_source == NULL)
+    {
+      GSocket *socket;
+
+      socket = g_socket_connection_get_socket (side->connection);
+      side->out_source = g_socket_create_source (socket, G_IO_OUT, NULL);
+      g_source_set_callback (side->out_source, (GSourceFunc) side_out_cb, side, NULL);
+      g_source_attach (side->out_source, NULL);
+      g_source_unref (side->out_source);
+    }
+
+  buffer->pos = 0;
+  side->buffers = g_list_append (side->buffers, buffer);
+}
+
+static guint32
+read_uint32 (Header *header, guint8 *ptr)
+{
+  if (header->big_endian)
+    return GUINT32_FROM_BE (*(guint32 *) ptr);
+  else
+    return GUINT32_FROM_LE (*(guint32 *) ptr);
+}
+
+static void
+write_uint32 (Header *header, guint8 *ptr, guint32 val)
+{
+  if (header->big_endian)
+    *(guint32 *) ptr = GUINT32_TO_BE (val);
+  else
+    *(guint32 *) ptr = GUINT32_TO_LE (val);
+}
+
+static inline guint32
+align_by_8 (guint32 offset)
+{
+  return (offset + 8 - 1) & ~(8 - 1);
+}
+
+static inline guint32
+align_by_4 (guint32 offset)
+{
+  return (offset + 4 - 1) & ~(4 - 1);
+}
+
+static const char *
+get_signature (Buffer *buffer, guint32 *offset, guint32 end_offset)
+{
+  guint8 len;
+  char *str;
+
+  if (*offset >= end_offset)
+    return FALSE;
+
+  len = buffer->data[*offset];
+  (*offset)++;
+
+  if ((*offset) + len + 1 > end_offset)
+    return FALSE;
+
+  if (buffer->data[(*offset) + len] != 0)
+    return FALSE;
+
+  str = (char *) &buffer->data[(*offset)];
+  *offset += len + 1;
+
+  return str;
+}
+
+static const char *
+get_string (Buffer *buffer, Header *header, guint32 *offset, guint32 end_offset)
+{
+  guint8 len;
+  char *str;
+
+  *offset = align_by_4 (*offset);
+  if (*offset + 4  >= end_offset)
+    return FALSE;
+
+  len = read_uint32 (header, &buffer->data[*offset]);
+  *offset += 4;
+
+  if ((*offset) + len + 1 > end_offset)
+    return FALSE;
+
+  if (buffer->data[(*offset) + len] != 0)
+    return FALSE;
+
+  str = (char *) &buffer->data[(*offset)];
+  *offset += len + 1;
+
+  return str;
+}
+
+static void
+header_free (Header *header)
+{
+  if (header->buffer)
+    buffer_unref (header->buffer);
+  g_free (header);
+}
+
+static Header *
+parse_header (Buffer *buffer, guint32 serial_offset, guint32 reply_serial_offset, guint32 hello_serial)
+{
+  guint32 array_len, header_len;
+  guint32 offset, end_offset;
+  guint8 header_type;
+  guint32 reply_serial_pos = 0;
+  const char *signature;
+  g_autoptr(Header) header = g_new0 (Header, 1);
+
+  header->buffer = buffer_ref (buffer);
+
+  if (buffer->size < 16)
+    return NULL;
+
+  if (buffer->data[3] != 1) /* Protocol version */
+    return NULL;
+
+  if (buffer->data[0] == 'B')
+    header->big_endian = TRUE;
+  else if (buffer->data[0] == 'l')
+    header->big_endian = FALSE;
+  else
+    return NULL;
+
+  header->type = buffer->data[1];
+  header->flags = buffer->data[2];
+
+  header->length = read_uint32 (header, &buffer->data[4]);
+  header->serial = read_uint32 (header, &buffer->data[8]);
+
+  if (header->serial == 0)
+    return NULL;
+
+  array_len = read_uint32 (header, &buffer->data[12]);
+
+  header_len = align_by_8 (12 + 4 + array_len);
+  g_assert (buffer->size >= header_len); /* We should have verified this when reading in the message */
+  if (header_len > buffer->size)
+    return NULL;
+
+  offset = 12 + 4;
+  end_offset = offset + array_len;
+
+  while (offset < end_offset)
+    {
+      offset = align_by_8 (offset); /* Structs must be 8 byte aligned */
+      if (offset >= end_offset)
+        return NULL;
+
+      header_type = buffer->data[offset++];
+      if (offset >= end_offset)
+        return NULL;
+
+      signature = get_signature (buffer, &offset, end_offset);
+      if (signature == NULL)
+        return NULL;
+
+      switch (header_type)
+        {
+        case G_DBUS_MESSAGE_HEADER_FIELD_INVALID:
+          return NULL;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_PATH:
+          if (strcmp (signature, "o") != 0)
+            return NULL;
+          header->path = get_string (buffer, header, &offset, end_offset);
+          if (header->path == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE:
+          if (strcmp (signature, "s") != 0)
+            return NULL;
+          header->interface = get_string (buffer, header, &offset, end_offset);
+          if (header->interface == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_MEMBER:
+          if (strcmp (signature, "s") != 0)
+            return NULL;
+          header->member = get_string (buffer, header, &offset, end_offset);
+          if (header->member == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME:
+          if (strcmp (signature, "s") != 0)
+            return NULL;
+          header->error_name = get_string (buffer, header, &offset, end_offset);
+          if (header->error_name == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL:
+          if (offset + 4 > end_offset)
+            return NULL;
+
+          header->has_reply_serial = TRUE;
+          reply_serial_pos = offset;
+          header->reply_serial = read_uint32 (header, &buffer->data[offset]);
+          offset += 4;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION:
+          if (strcmp (signature, "s") != 0)
+            return NULL;
+          header->destination = get_string (buffer, header, &offset, end_offset);
+          if (header->destination == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_SENDER:
+          if (strcmp (signature, "s") != 0)
+            return NULL;
+          header->sender = get_string (buffer, header, &offset, end_offset);
+          if (header->sender == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE:
+          if (strcmp (signature, "g") != 0)
+            return NULL;
+          header->signature = get_signature (buffer, &offset, end_offset);
+          if (header->signature == NULL)
+            return NULL;
+          break;
+
+        case G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS:
+          if (offset + 4 > end_offset)
+            return NULL;
+
+          header->unix_fds = read_uint32 (header, &buffer->data[offset]);
+          offset += 4;
+          break;
+
+        default:
+          /* Unknown header field, for safety, fail parse */
+          return NULL;
+        }
+    }
+
+  switch (header->type)
+    {
+    case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+      if (header->path == NULL || header->member == NULL)
+        return NULL;
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
+      if (!header->has_reply_serial)
+        return NULL;
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_ERROR:
+      if (header->error_name  == NULL || !header->has_reply_serial)
+        return NULL;
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_SIGNAL:
+      if (header->path == NULL ||
+          header->interface == NULL ||
+          header->member == NULL)
+        return NULL;
+      if (strcmp (header->path, "/org/freedesktop/DBus/Local") == 0 ||
+          strcmp (header->interface, "org.freedesktop.DBus.Local") == 0)
+        return NULL;
+      break;
+
+    default:
+      /* Unknown message type, for safety, fail parse */
+      return NULL;
+    }
+
+  if (serial_offset > 0)
+    {
+      header->serial += serial_offset;
+      write_uint32 (header, &buffer->data[8], header->serial);
+    }
+
+  if (reply_serial_offset > 0 &&
+      header->has_reply_serial &&
+      header->reply_serial > hello_serial + reply_serial_offset)
+    write_uint32 (header, &buffer->data[reply_serial_pos], header->reply_serial - reply_serial_offset);
+
+  return g_steal_pointer (&header);
+}
+
+static void
+print_outgoing_header (Header *header)
+{
+  switch (header->type)
+    {
+    case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+      g_print ("C%d: -> %s call %s.%s at %s\n",
+               header->serial,
+               header->destination ? header->destination : "(no dest)",
+               header->interface ? header->interface : "",
+               header->member ? header->member : "",
+               header->path ? header->path : "");
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
+      g_print ("C%d: -> %s return from B%d\n",
+               header->serial,
+               header->destination ? header->destination : "(no dest)",
+               header->reply_serial);
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_ERROR:
+      g_print ("C%d: -> %s return error %s from B%d\n",
+               header->serial,
+               header->destination ? header->destination : "(no dest)",
+               header->error_name ? header->error_name : "(no error)",
+               header->reply_serial);
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_SIGNAL:
+      g_print ("C%d: -> %s signal %s.%s at %s\n",
+               header->serial,
+               header->destination ? header->destination : "all",
+               header->interface ? header->interface : "",
+               header->member ? header->member : "",
+               header->path ? header->path : "");
+      break;
+
+    default:
+      g_print ("unknown message type\n");
+    }
+}
+
+static void
+print_incoming_header (Header *header)
+{
+  switch (header->type)
+    {
+    case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+      g_print ("B%d: <- %s call %s.%s at %s\n",
+               header->serial,
+               header->sender ? header->sender : "(no sender)",
+               header->interface ? header->interface : "",
+               header->member ? header->member : "",
+               header->path ? header->path : "");
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
+      g_print ("B%d: <- %s return from C%d\n",
+               header->serial,
+               header->sender ? header->sender : "(no sender)",
+               header->reply_serial);
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_ERROR:
+      g_print ("B%d: <- %s return error %s from C%d\n",
+               header->serial,
+               header->sender ? header->sender : "(no sender)",
+               header->error_name ? header->error_name : "(no error)",
+               header->reply_serial);
+      break;
+
+    case G_DBUS_MESSAGE_TYPE_SIGNAL:
+      g_print ("B%d: <- %s signal %s.%s at %s\n",
+               header->serial,
+               header->sender ? header->sender : "(no sender)",
+               header->interface ? header->interface : "",
+               header->member ? header->member : "",
+               header->path ? header->path : "");
+      break;
+
+    default:
+      g_print ("unknown message type\n");
+    }
+}
+
+static FlatpakPolicy
+flatpak_proxy_client_get_policy (FlatpakProxyClient *client, const char *source)
+{
+  if (source == NULL)
+    return FLATPAK_POLICY_TALK; /* All clients can talk to the bus itself */
+
+  if (source[0] == ':')
+    return GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, source));
+
+  return flatpak_proxy_get_policy (client->proxy, source);
+}
+
+static void
+flatpak_proxy_client_update_unique_id_policy (FlatpakProxyClient *client,
+                                              const char         *unique_id,
+                                              FlatpakPolicy       policy)
+{
+  if (policy > FLATPAK_POLICY_NONE)
+    {
+      FlatpakPolicy old_policy;
+      old_policy = GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, unique_id));
+      if (policy > old_policy)
+        g_hash_table_replace (client->unique_id_policy, g_strdup (unique_id), GINT_TO_POINTER (policy));
+    }
+}
+
+static void
+flatpak_proxy_client_update_unique_id_policy_from_name (FlatpakProxyClient *client,
+                                                        const char         *unique_id,
+                                                        const char         *as_name)
+{
+  flatpak_proxy_client_update_unique_id_policy (client,
+                                                unique_id,
+                                                flatpak_proxy_get_policy (client->proxy, as_name));
+}
+
+
+static gboolean
+client_message_generates_reply (Header *header)
+{
+  switch (header->type)
+    {
+    case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+      return (header->flags & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED) == 0;
+
+    case G_DBUS_MESSAGE_TYPE_SIGNAL:
+    case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
+    case G_DBUS_MESSAGE_TYPE_ERROR:
+    default:
+      return FALSE;
+    }
+}
+
+static Buffer *
+message_to_buffer (GDBusMessage *message)
+{
+  Buffer *buffer;
+  guchar *blob;
+  gsize blob_size;
+
+  blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, NULL);
+  buffer = buffer_new (blob_size, NULL);
+  memcpy (buffer->data, blob, blob_size);
+  g_free (blob);
+
+  return buffer;
+}
+
+static GDBusMessage *
+get_error_for_header (FlatpakProxyClient *client, Header *header, const char *error)
+{
+  GDBusMessage *reply;
+
+  reply = g_dbus_message_new ();
+  g_dbus_message_set_message_type (reply, G_DBUS_MESSAGE_TYPE_ERROR);
+  g_dbus_message_set_flags (reply, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+  g_dbus_message_set_reply_serial (reply, header->serial - client->serial_offset);
+  g_dbus_message_set_error_name (reply, error);
+  g_dbus_message_set_body (reply, g_variant_new ("(s)", error));
+
+  return reply;
+}
+
+static GDBusMessage *
+get_bool_reply_for_header (FlatpakProxyClient *client, Header *header, gboolean val)
+{
+  GDBusMessage *reply;
+
+  reply = g_dbus_message_new ();
+  g_dbus_message_set_message_type (reply, G_DBUS_MESSAGE_TYPE_METHOD_RETURN);
+  g_dbus_message_set_flags (reply, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+  g_dbus_message_set_reply_serial (reply, header->serial - client->serial_offset);
+  g_dbus_message_set_body (reply, g_variant_new ("(b)", val));
+
+  return reply;
+}
+
+static Buffer *
+get_ping_buffer_for_header (Header *header)
+{
+  Buffer *buffer;
+  GDBusMessage *dummy;
+
+  dummy = g_dbus_message_new_method_call (NULL, "/", "org.freedesktop.DBus.Peer", "Ping");
+  g_dbus_message_set_serial (dummy, header->serial);
+  g_dbus_message_set_flags (dummy, header->flags);
+
+  buffer = message_to_buffer (dummy);
+
+  g_object_unref (dummy);
+
+  return buffer;
+}
+
+static Buffer *
+get_error_for_roundtrip (FlatpakProxyClient *client, Header *header, const char *error_name)
+{
+  Buffer *ping_buffer = get_ping_buffer_for_header (header);
+  GDBusMessage *reply;
+
+  reply = get_error_for_header (client, header, error_name);
+  g_hash_table_replace (client->rewrite_reply, GINT_TO_POINTER (header->serial), reply);
+  return ping_buffer;
+}
+
+static Buffer *
+get_bool_reply_for_roundtrip (FlatpakProxyClient *client, Header *header, gboolean val)
+{
+  Buffer *ping_buffer = get_ping_buffer_for_header (header);
+  GDBusMessage *reply;
+
+  reply = get_bool_reply_for_header (client, header, val);
+  g_hash_table_replace (client->rewrite_reply, GINT_TO_POINTER (header->serial), reply);
+
+  return ping_buffer;
+}
+
+typedef enum {
+  HANDLE_PASS,
+  HANDLE_DENY,
+  HANDLE_HIDE,
+  HANDLE_FILTER_NAME_LIST_REPLY,
+  HANDLE_FILTER_HAS_OWNER_REPLY,
+  HANDLE_FILTER_GET_OWNER_REPLY,
+  HANDLE_VALIDATE_OWN,
+  HANDLE_VALIDATE_SEE,
+  HANDLE_VALIDATE_TALK,
+  HANDLE_VALIDATE_MATCH,
+} BusHandler;
+
+static gboolean
+is_for_bus (Header *header)
+{
+  return g_strcmp0 (header->destination, "org.freedesktop.DBus") == 0;
+}
+
+static gboolean
+is_dbus_method_call (Header *header)
+{
+  return
+    is_for_bus (header) &&
+    header->type == G_DBUS_MESSAGE_TYPE_METHOD_CALL &&
+    g_strcmp0 (header->interface, "org.freedesktop.DBus") == 0;
+}
+
+static gboolean
+is_introspection_call (Header *header)
+{
+  return
+    header->type == G_DBUS_MESSAGE_TYPE_METHOD_CALL &&
+    g_strcmp0 (header->interface, "org.freedesktop.DBus.Introspectable") == 0;
+}
+
+static BusHandler
+get_dbus_method_handler (FlatpakProxyClient *client, Header *header)
+{
+  FlatpakPolicy policy;
+  const char *method;
+
+  if (header->has_reply_serial)
+    {
+      ExpectedReplyType expected_reply =
+        steal_expected_reply (&client->bus_side,
+                              header->reply_serial);
+      if (expected_reply == EXPECTED_REPLY_NONE)
+        return HANDLE_DENY;
+
+      return HANDLE_PASS;
+    }
+
+  policy = flatpak_proxy_client_get_policy (client, header->destination);
+  if (policy < FLATPAK_POLICY_SEE)
+    return HANDLE_HIDE;
+  if (policy < FLATPAK_POLICY_FILTERED)
+    return HANDLE_DENY;
+
+  if (policy == FLATPAK_POLICY_FILTERED)
+    {
+      GList *filters = NULL, *l;
+
+      if (header->destination)
+        filters = g_hash_table_lookup (client->proxy->filters, header->destination);
+      for (l = filters; l != NULL; l = l->next)
+        {
+          Filter *filter = l->data;
+
+          if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_CALL &&
+              (filter->path == NULL || g_strcmp0 (filter->path, header->path) == 0) &&
+              (filter->interface == NULL || g_strcmp0 (filter->interface, header->interface) == 0) &&
+              (filter->member == NULL || g_strcmp0 (filter->member, header->member) == 0))
+            return HANDLE_PASS;
+        }
+
+      return HANDLE_DENY;
+    }
+
+  if (!is_for_bus (header))
+    return HANDLE_PASS;
+
+  if (is_introspection_call (header))
+    {
+      return HANDLE_PASS;
+    }
+  else if (is_dbus_method_call (header))
+    {
+      method = header->member;
+      if (method == NULL)
+        return HANDLE_DENY;
+
+      if (strcmp (method, "AddMatch") == 0)
+        return HANDLE_VALIDATE_MATCH;
+
+      if (strcmp (method, "Hello") == 0 ||
+          strcmp (method, "RemoveMatch") == 0 ||
+          strcmp (method, "GetId") == 0)
+        return HANDLE_PASS;
+
+      if (strcmp (method, "UpdateActivationEnvironment") == 0 ||
+          strcmp (method, "BecomeMonitor") == 0)
+        return HANDLE_DENY;
+
+      if (strcmp (method, "RequestName") == 0 ||
+          strcmp (method, "ReleaseName") == 0 ||
+          strcmp (method, "ListQueuedOwners") == 0)
+        return HANDLE_VALIDATE_OWN;
+
+      if (strcmp (method, "NameHasOwner") == 0)
+        return HANDLE_FILTER_HAS_OWNER_REPLY;
+
+      if (strcmp (method, "GetNameOwner") == 0)
+        return HANDLE_FILTER_GET_OWNER_REPLY;
+
+      if (strcmp (method, "GetConnectionUnixProcessID") == 0 ||
+          strcmp (method, "GetConnectionCredentials") == 0 ||
+          strcmp (method, "GetAdtAuditSessionData") == 0 ||
+          strcmp (method, "GetConnectionSELinuxSecurityContext") == 0 ||
+          strcmp (method, "GetConnectionUnixUser") == 0)
+        return HANDLE_VALIDATE_SEE;
+
+      if (strcmp (method, "StartServiceByName") == 0)
+        return HANDLE_VALIDATE_TALK;
+
+      if (strcmp (method, "ListNames") == 0 ||
+          strcmp (method, "ListActivatableNames") == 0)
+        return HANDLE_FILTER_NAME_LIST_REPLY;
+
+      g_warning ("Unknown bus method %s", method);
+      return HANDLE_DENY;
+    }
+  else
+    {
+      return HANDLE_DENY;
+    }
+}
+
+static FlatpakPolicy
+policy_from_handler (BusHandler handler)
+{
+  switch (handler)
+    {
+    case HANDLE_VALIDATE_OWN:
+      return FLATPAK_POLICY_OWN;
+
+    case HANDLE_VALIDATE_TALK:
+      return FLATPAK_POLICY_TALK;
+
+    case HANDLE_VALIDATE_SEE:
+      return FLATPAK_POLICY_SEE;
+
+    default:
+      return FLATPAK_POLICY_NONE;
+    }
+}
+
+static char *
+get_arg0_string (Buffer *buffer)
+{
+  GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body;
+  g_autoptr(GVariant) arg0 = NULL;
+  char *name = NULL;
+
+  if (message != NULL &&
+      (body = g_dbus_message_get_body (message)) != NULL &&
+      (arg0 = g_variant_get_child_value (body, 0)) != NULL &&
+      g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING))
+    name = g_variant_dup_string (arg0, NULL);
+
+  g_object_unref (message);
+
+  return name;
+}
+
+static gboolean
+validate_arg0_match (FlatpakProxyClient *client, Buffer *buffer)
+{
+  GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body, *arg0;
+  const char *match;
+  gboolean res = TRUE;
+
+  if (message != NULL &&
+      (body = g_dbus_message_get_body (message)) != NULL &&
+      (arg0 = g_variant_get_child_value (body, 0)) != NULL &&
+      g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING))
+    {
+      match = g_variant_get_string (arg0, NULL);
+      if (strstr (match, "eavesdrop=") != NULL)
+        res = FALSE;
+    }
+
+  g_object_unref (message);
+  return res;
+}
+
+static gboolean
+validate_arg0_name (FlatpakProxyClient *client, Buffer *buffer, FlatpakPolicy required_policy, FlatpakPolicy *has_policy)
+{
+  GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body, *arg0;
+  const char *name;
+  FlatpakPolicy name_policy;
+  gboolean res = FALSE;
+
+  if (has_policy)
+    *has_policy = FLATPAK_POLICY_NONE;
+
+  if (message != NULL &&
+      (body = g_dbus_message_get_body (message)) != NULL &&
+      (arg0 = g_variant_get_child_value (body, 0)) != NULL &&
+      g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING))
+    {
+      name = g_variant_get_string (arg0, NULL);
+      name_policy = flatpak_proxy_client_get_policy (client, name);
+
+      if (has_policy)
+        *has_policy = name_policy;
+
+      if (name_policy >= required_policy)
+        res = TRUE;
+      else if (client->proxy->log_messages)
+        g_print ("Filtering message due to arg0 %s, policy: %d (required %d)\n", name, name_policy, required_policy);
+    }
+
+  g_object_unref (message);
+  return res;
+}
+
+static Buffer *
+filter_names_list (FlatpakProxyClient *client, Buffer *buffer)
+{
+  GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body, *arg0, *new_names;
+  const gchar **names;
+  int i;
+  GVariantBuilder builder;
+  Buffer *filtered;
+
+  if (message == NULL ||
+      (body = g_dbus_message_get_body (message)) == NULL ||
+      (arg0 = g_variant_get_child_value (body, 0)) == NULL ||
+      !g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING_ARRAY))
+    return NULL;
+
+  names = g_variant_get_strv (arg0, NULL);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+  for (i = 0; names[i] != NULL; i++)
+    {
+      if (flatpak_proxy_client_get_policy (client, names[i]) >= FLATPAK_POLICY_SEE)
+        g_variant_builder_add (&builder, "s", names[i]);
+    }
+  g_free (names);
+
+  new_names = g_variant_builder_end (&builder);
+  g_dbus_message_set_body (message,
+                           g_variant_new_tuple (&new_names, 1));
+
+  filtered = message_to_buffer (message);
+  g_object_unref (message);
+  return filtered;
+}
+
+static gboolean
+message_is_name_owner_changed (FlatpakProxyClient *client, Header *header)
+{
+  if (header->type == G_DBUS_MESSAGE_TYPE_SIGNAL &&
+      g_strcmp0 (header->sender, "org.freedesktop.DBus") == 0 &&
+      g_strcmp0 (header->interface, "org.freedesktop.DBus") == 0 &&
+      g_strcmp0 (header->member, "NameOwnerChanged") == 0)
+    return TRUE;
+  return FALSE;
+}
+
+static gboolean
+should_filter_name_owner_changed (FlatpakProxyClient *client, Buffer *buffer)
+{
+  GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body, *arg0, *arg1, *arg2;
+  const gchar *name, *old, *new;
+  gboolean filter = TRUE;
+
+  if (message == NULL ||
+      (body = g_dbus_message_get_body (message)) == NULL ||
+      (arg0 = g_variant_get_child_value (body, 0)) == NULL ||
+      !g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING) ||
+      (arg1 = g_variant_get_child_value (body, 1)) == NULL ||
+      !g_variant_is_of_type (arg1, G_VARIANT_TYPE_STRING) ||
+      (arg2 = g_variant_get_child_value (body, 2)) == NULL ||
+      !g_variant_is_of_type (arg2, G_VARIANT_TYPE_STRING))
+    return TRUE;
+
+  name = g_variant_get_string (arg0, NULL);
+  old = g_variant_get_string (arg1, NULL);
+  new = g_variant_get_string (arg2, NULL);
+
+  if (flatpak_proxy_client_get_policy (client, name) >= FLATPAK_POLICY_SEE ||
+      (client->proxy->sloppy_names && name[0] == ':'))
+    {
+      if (name[0] != ':')
+        {
+          if (old[0] != 0)
+            flatpak_proxy_client_update_unique_id_policy_from_name (client, old, name);
+
+          if (new[0] != 0)
+            flatpak_proxy_client_update_unique_id_policy_from_name (client, new, name);
+        }
+
+      filter = FALSE;
+    }
+
+  g_object_unref (message);
+
+  return filter;
+}
+
+static GList *
+side_get_n_unix_fds (ProxySide *side, int n_fds)
+{
+  GList *res = NULL;
+
+  while (side->control_messages != NULL)
+    {
+      GSocketControlMessage *control_message = side->control_messages->data;
+
+      if (G_IS_UNIX_FD_MESSAGE (control_message))
+        {
+          GUnixFDMessage *fd_message = G_UNIX_FD_MESSAGE (control_message);
+          GUnixFDList *fd_list = g_unix_fd_message_get_fd_list (fd_message);
+          int len = g_unix_fd_list_get_length (fd_list);
+
+          /* I believe that socket control messages are never merged, and
+             the sender side sends only one unix-fd-list per message, so
+             at this point there should always be one full fd list
+             per requested number of fds */
+          if (len != n_fds)
+            {
+              g_warning ("Not right nr of fds in socket message");
+              return NULL;
+            }
+
+          side->control_messages = g_list_delete_link (side->control_messages, side->control_messages);
+
+          return g_list_append (NULL, control_message);
+        }
+
+      g_object_unref (control_message);
+      side->control_messages = g_list_delete_link (side->control_messages, side->control_messages);
+    }
+
+  return res;
+}
+
+static gboolean
+update_socket_messages (ProxySide *side, Buffer *buffer, Header *header)
+{
+  /* We may accidentally combine multiple control messages into one
+     buffer when we receive (since we can do several recvs), so we
+     keep a list of all we get and then only re-attach the amount
+     specified in the header to the buffer. */
+
+  side->control_messages = g_list_concat (side->control_messages, buffer->control_messages);
+  buffer->control_messages = NULL;
+  if (header->unix_fds > 0)
+    {
+      buffer->control_messages = side_get_n_unix_fds (side, header->unix_fds);
+      if (buffer->control_messages == NULL)
+        {
+          g_warning ("Not enough fds for message");
+          side_closed (side);
+          buffer_unref (buffer);
+          return FALSE;
+        }
+    }
+  return TRUE;
+}
+
+static void
+queue_fake_message (FlatpakProxyClient *client, GDBusMessage *message, ExpectedReplyType reply_type)
+{
+  Buffer *buffer;
+
+  client->last_serial++;
+  client->serial_offset++;
+  g_dbus_message_set_serial (message, client->last_serial);
+  buffer = message_to_buffer (message);
+  g_object_unref (message);
+
+  queue_outgoing_buffer (&client->bus_side, buffer);
+  queue_expected_reply (&client->client_side, client->last_serial, reply_type);
+}
+
+/* After the first Hello message we need to synthesize a bunch of messages to synchronize the
+   ownership state for the names in the policy */
+static void
+queue_initial_name_ops (FlatpakProxyClient *client)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+  gboolean has_wildcards = FALSE;
+
+  g_hash_table_iter_init (&iter, client->proxy->policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *name = key;
+      GDBusMessage *message;
+      GVariant *match;
+
+      if (strcmp (name, "org.freedesktop.DBus") == 0)
+        continue;
+
+      /* AddMatch the name so we get told about ownership changes.
+         Do it before the GetNameOwner to avoid races */
+      message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "AddMatch");
+      match = g_variant_new_printf ("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='%s'", name);
+      g_dbus_message_set_body (message, g_variant_new_tuple (&match, 1));
+      queue_fake_message (client, message, EXPECTED_REPLY_FILTER);
+
+      if (client->proxy->log_messages)
+        g_print ("C%d: -> org.freedesktop.DBus fake AddMatch for %s\n", client->last_serial, name);
+
+      /* Get the current owner of the name (if any) so we can apply policy to it */
+      message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner");
+      g_dbus_message_set_body (message, g_variant_new ("(s)", name));
+      queue_fake_message (client, message, EXPECTED_REPLY_FAKE_GET_NAME_OWNER);
+      g_hash_table_replace (client->get_owner_reply, GINT_TO_POINTER (client->last_serial), g_strdup (name));
+
+      if (client->proxy->log_messages)
+        g_print ("C%d: -> org.freedesktop.DBus fake GetNameOwner for %s\n", client->last_serial, name);
+    }
+
+  /* Same for wildcard proxies. Only here we don't know the actual names to GetNameOwner for, so we have to
+     list all current names */
+  g_hash_table_iter_init (&iter, client->proxy->wildcard_policy);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *name = key;
+      GDBusMessage *message;
+      GVariant *match;
+
+      has_wildcards = TRUE;
+
+      /* AddMatch the name with arg0namespace so we get told about ownership changes to all subnames.
+         Do it before the GetNameOwner to avoid races */
+      message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "AddMatch");
+      match = g_variant_new_printf ("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0namespace='%s'", name);
+      g_dbus_message_set_body (message, g_variant_new_tuple (&match, 1));
+      queue_fake_message (client, message, EXPECTED_REPLY_FILTER);
+
+      if (client->proxy->log_messages)
+        g_print ("C%d: -> org.freedesktop.DBus fake AddMatch for %s.*\n", client->last_serial, name);
+    }
+
+  if (has_wildcards)
+    {
+      GDBusMessage *message;
+
+      /* AddMatch the name so we get told about ownership changes.
+         Do it before the GetNameOwner to avoid races */
+      message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "ListNames");
+      g_dbus_message_set_body (message, g_variant_new ("()"));
+      queue_fake_message (client, message, EXPECTED_REPLY_FAKE_LIST_NAMES);
+
+      if (client->proxy->log_messages)
+        g_print ("C%d: -> org.freedesktop.DBus fake ListNames\n", client->last_serial);
+
+      /* Stop reading from the client, to avoid incoming messages fighting with the ListNames roundtrip.
+         We will start it again once we have handled the ListNames reply */
+      stop_reading (&client->client_side);
+    }
+}
+
+static void
+queue_wildcard_initial_name_ops (FlatpakProxyClient *client, Header *header, Buffer *buffer)
+{
+  GDBusMessage *decoded_message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
+  GVariant *body, *arg0;
+
+  if (decoded_message != NULL &&
+      header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN &&
+      (body = g_dbus_message_get_body (decoded_message)) != NULL &&
+      (arg0 = g_variant_get_child_value (body, 0)) != NULL &&
+      g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING_ARRAY))
+    {
+      const gchar **names = g_variant_get_strv (arg0, NULL);
+      int i;
+
+      /* Loop over all current names and get the owner for all the ones that match our wildcard
+         policies so that we can update the unique id policies for those */
+      for (i = 0; names[i] != NULL; i++)
+        {
+          const char *name = names[i];
+
+          if (name[0] != ':' &&
+              flatpak_proxy_get_wildcard_policy (client->proxy, name) != FLATPAK_POLICY_NONE)
+            {
+              /* Get the current owner of the name (if any) so we can apply policy to it */
+              GDBusMessage *message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner");
+              g_dbus_message_set_body (message, g_variant_new ("(s)", name));
+              queue_fake_message (client, message, EXPECTED_REPLY_FAKE_GET_NAME_OWNER);
+              g_hash_table_replace (client->get_owner_reply, GINT_TO_POINTER (client->last_serial), g_strdup (name));
+
+              if (client->proxy->log_messages)
+                g_print ("C%d: -> org.freedesktop.DBus fake GetNameOwner for %s\n", client->last_serial, name);
+            }
+        }
+      g_free (names);
+    }
+
+  g_object_unref (decoded_message);
+}
+
+
+static void
+got_buffer_from_client (FlatpakProxyClient *client, ProxySide *side, Buffer *buffer)
+{
+  ExpectedReplyType expecting_reply = EXPECTED_REPLY_NONE;
+
+  if (client->authenticated && client->proxy->filter)
+    {
+      g_autoptr(Header) header = NULL;;
+      BusHandler handler;
+
+      /* Filter and rewrite outgoing messages as needed */
+
+      header = parse_header (buffer, client->serial_offset, 0, 0);
+      if (header == NULL)
+        {
+          g_warning ("Invalid message header format");
+          side_closed (side);
+          buffer_unref (buffer);
+          return;
+        }
+
+      if (!update_socket_messages (side, buffer, header))
+        return;
+
+      /* Make sure the client is not playing games with the serials, as that
+         could confuse us. */
+      if (header->serial <= client->last_serial)
+        {
+          g_warning ("Invalid client serial");
+          side_closed (side);
+          buffer_unref (buffer);
+          return;
+        }
+      client->last_serial = header->serial;
+
+      if (client->proxy->log_messages)
+        print_outgoing_header (header);
+
+      /* Keep track of the initial Hello request so that we can read
+         the reply which has our assigned unique id */
+      if (is_dbus_method_call (header) &&
+          g_strcmp0 (header->member, "Hello") == 0)
+        {
+          expecting_reply = EXPECTED_REPLY_HELLO;
+          client->hello_serial = header->serial;
+        }
+
+      handler = get_dbus_method_handler (client, header);
+
+      switch (handler)
+        {
+        case HANDLE_FILTER_HAS_OWNER_REPLY:
+        case HANDLE_FILTER_GET_OWNER_REPLY:
+          if (!validate_arg0_name (client, buffer, FLATPAK_POLICY_SEE, NULL))
+            {
+              g_clear_pointer (&buffer, buffer_unref);
+              if (handler == HANDLE_FILTER_GET_OWNER_REPLY)
+                buffer = get_error_for_roundtrip (client, header,
+                                                  "org.freedesktop.DBus.Error.NameHasNoOwner");
+              else
+                buffer = get_bool_reply_for_roundtrip (client, header, FALSE);
+
+              expecting_reply = EXPECTED_REPLY_REWRITE;
+              break;
+            }
+
+          goto handle_pass;
+
+        case HANDLE_VALIDATE_MATCH:
+          if (!validate_arg0_match (client, buffer))
+            {
+              if (client->proxy->log_messages)
+                g_print ("*DENIED* (ping)\n");
+              g_clear_pointer (&buffer, buffer_unref);
+              buffer = get_error_for_roundtrip (client, header,
+                                                "org.freedesktop.DBus.Error.AccessDenied");
+              expecting_reply = EXPECTED_REPLY_REWRITE;
+              break;
+            }
+
+          goto handle_pass;
+
+        case HANDLE_VALIDATE_OWN:
+        case HANDLE_VALIDATE_SEE:
+        case HANDLE_VALIDATE_TALK:
+          {
+            FlatpakPolicy name_policy;
+            if (validate_arg0_name (client, buffer, policy_from_handler (handler), &name_policy))
+              goto handle_pass;
+
+            if (name_policy < (int) FLATPAK_POLICY_SEE)
+              goto handle_hide;
+            else
+              goto handle_deny;
+          }
+
+        case HANDLE_FILTER_NAME_LIST_REPLY:
+          expecting_reply = EXPECTED_REPLY_LIST_NAMES;
+          goto handle_pass;
+
+        case HANDLE_PASS:
+handle_pass:
+          if (client_message_generates_reply (header))
+            {
+              if (expecting_reply == EXPECTED_REPLY_NONE)
+                expecting_reply = EXPECTED_REPLY_NORMAL;
+            }
+
+          break;
+
+        case HANDLE_HIDE:
+handle_hide:
+          g_clear_pointer (&buffer, buffer_unref);
+
+          if (client_message_generates_reply (header))
+            {
+              const char *error;
+
+              if (client->proxy->log_messages)
+                g_print ("*HIDDEN* (ping)\n");
+
+              if ((header->destination != NULL && header->destination[0] == ':') ||
+                  (header->flags & G_DBUS_MESSAGE_FLAGS_NO_AUTO_START) != 0)
+                error = "org.freedesktop.DBus.Error.NameHasNoOwner";
+              else
+                error = "org.freedesktop.DBus.Error.ServiceUnknown";
+
+              buffer = get_error_for_roundtrip (client, header, error);
+              expecting_reply = EXPECTED_REPLY_REWRITE;
+            }
+          else
+            {
+              if (client->proxy->log_messages)
+                g_print ("*HIDDEN*\n");
+            }
+          break;
+
+        default:
+        case HANDLE_DENY:
+handle_deny:
+          g_clear_pointer (&buffer, buffer_unref);
+
+          if (client_message_generates_reply (header))
+            {
+              if (client->proxy->log_messages)
+                g_print ("*DENIED* (ping)\n");
+
+              buffer = get_error_for_roundtrip (client, header,
+                                                "org.freedesktop.DBus.Error.AccessDenied");
+              expecting_reply = EXPECTED_REPLY_REWRITE;
+            }
+          else
+            {
+              if (client->proxy->log_messages)
+                g_print ("*DENIED*\n");
+            }
+          break;
+        }
+
+      if (buffer != NULL && expecting_reply != EXPECTED_REPLY_NONE)
+        queue_expected_reply (side, header->serial, expecting_reply);
+    }
+
+  if (buffer)
+    queue_outgoing_buffer (&client->bus_side, buffer);
+
+  if (buffer != NULL && expecting_reply == EXPECTED_REPLY_HELLO)
+    queue_initial_name_ops (client);
+}
+
+static void
+got_buffer_from_bus (FlatpakProxyClient *client, ProxySide *side, Buffer *buffer)
+{
+  if (client->authenticated && client->proxy->filter)
+    {
+      g_autoptr(Header) header = NULL;;
+      GDBusMessage *rewritten;
+      FlatpakPolicy policy;
+      ExpectedReplyType expected_reply;
+
+      /* Filter and rewrite incoming messages as needed */
+
+      header = parse_header (buffer, 0, client->serial_offset, client->hello_serial);
+      if (header == NULL)
+        {
+          g_warning ("Invalid message header format");
+          buffer_unref (buffer);
+          side_closed (side);
+          return;
+        }
+
+      if (!update_socket_messages (side, buffer, header))
+        return;
+
+      if (client->proxy->log_messages)
+        print_incoming_header (header);
+
+      if (header->has_reply_serial)
+        {
+          expected_reply = steal_expected_reply (get_other_side (side), header->reply_serial);
+
+          /* We only allow replies we expect */
+          if (expected_reply == EXPECTED_REPLY_NONE)
+            {
+              if (client->proxy->log_messages)
+                g_print ("*Unexpected reply*\n");
+              buffer_unref (buffer);
+              return;
+            }
+
+          switch (expected_reply)
+            {
+            case EXPECTED_REPLY_HELLO:
+              /* When we get the initial reply to Hello, allow all
+                 further communications to our own unique id. */
+              if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN)
+                {
+                  g_autofree char *my_id = get_arg0_string (buffer);
+                  flatpak_proxy_client_update_unique_id_policy (client, my_id, FLATPAK_POLICY_TALK);
+                  break;
+                }
+
+            case EXPECTED_REPLY_REWRITE:
+              /* Replace a roundtrip ping with the rewritten message */
+
+              rewritten = g_hash_table_lookup (client->rewrite_reply,
+                                               GINT_TO_POINTER (header->reply_serial));
+
+              if (client->proxy->log_messages)
+                g_print ("*REWRITTEN*\n");
+
+              g_dbus_message_set_serial (rewritten, header->serial);
+              g_clear_pointer (&buffer, buffer_unref);
+              buffer = message_to_buffer (rewritten);
+
+              g_hash_table_remove (client->rewrite_reply,
+                                   GINT_TO_POINTER (header->reply_serial));
+              break;
+
+            case EXPECTED_REPLY_FAKE_LIST_NAMES:
+              /* This is a reply from the bus to a fake ListNames
+                 request, request ownership of any name matching a
+                 wildcard policy */
+
+              queue_wildcard_initial_name_ops (client, header, buffer);
+
+              /* Don't forward fake replies to the app */
+              if (client->proxy->log_messages)
+                g_print ("*SKIPPED*\n");
+              g_clear_pointer (&buffer, buffer_unref);
+
+              /* Start reading the clients requests now that we are done with the names */
+              start_reading (&client->client_side);
+              break;
+
+            case EXPECTED_REPLY_FAKE_GET_NAME_OWNER:
+              /* This is a reply from the bus to a fake GetNameOwner
+                 request, update the policy for this unique name based on
+                 the policy */
+              {
+                char *requested_name = g_hash_table_lookup (client->get_owner_reply, GINT_TO_POINTER (header->reply_serial));
+
+                if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN)
+                  {
+                    g_autofree char *owner = get_arg0_string (buffer);
+                    flatpak_proxy_client_update_unique_id_policy_from_name (client, owner, requested_name);
+                  }
+
+                g_hash_table_remove (client->get_owner_reply, GINT_TO_POINTER (header->reply_serial));
+
+                /* Don't forward fake replies to the app */
+                if (client->proxy->log_messages)
+                  g_print ("*SKIPPED*\n");
+                g_clear_pointer (&buffer, buffer_unref);
+                break;
+              }
+
+            case EXPECTED_REPLY_FILTER:
+              if (client->proxy->log_messages)
+                g_print ("*SKIPPED*\n");
+              g_clear_pointer (&buffer, buffer_unref);
+              break;
+
+            case EXPECTED_REPLY_LIST_NAMES:
+              /* This is a reply from the bus to a ListNames request, filter
+                 it according to the policy */
+              if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN)
+                {
+                  Buffer *filtered_buffer;
+
+                  filtered_buffer = filter_names_list (client, buffer);
+                  g_clear_pointer (&buffer, buffer_unref);
+                  buffer = filtered_buffer;
+                }
+
+              break;
+
+            case EXPECTED_REPLY_NORMAL:
+              break;
+
+            default:
+              g_warning ("Unexpected expected reply type %d", expected_reply);
+            }
+        }
+      else /* Not reply */
+        {
+
+          /* Don't allow reply types with no reply_serial */
+          if (header->type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN ||
+              header->type == G_DBUS_MESSAGE_TYPE_ERROR)
+            {
+              if (client->proxy->log_messages)
+                g_print ("*Invalid reply*\n");
+              g_clear_pointer (&buffer, buffer_unref);
+            }
+
+          /* We filter all NameOwnerChanged signal according to the policy */
+          if (message_is_name_owner_changed (client, header))
+            {
+              if (should_filter_name_owner_changed (client, buffer))
+                g_clear_pointer (&buffer, buffer_unref);
+            }
+        }
+
+      /* All incoming broadcast signals are filtered according to policy */
+      if (header->type == G_DBUS_MESSAGE_TYPE_SIGNAL && header->destination == NULL)
+        {
+          policy = flatpak_proxy_client_get_policy (client, header->sender);
+          if (policy < FLATPAK_POLICY_TALK)
+            {
+              if (client->proxy->log_messages)
+                g_print ("*FILTERED IN*\n");
+              g_clear_pointer (&buffer, buffer_unref);
+            }
+        }
+
+      /* We received and forwarded a message from a trusted peer. Make the policy for
+         this unique id SEE so that the client can track its lifetime. */
+      if (buffer && header->sender && header->sender[0] == ':')
+        flatpak_proxy_client_update_unique_id_policy (client, header->sender, FLATPAK_POLICY_SEE);
+
+      if (buffer && client_message_generates_reply (header))
+        queue_expected_reply (side, header->serial, EXPECTED_REPLY_NORMAL);
+    }
+
+  if (buffer)
+    queue_outgoing_buffer (&client->client_side, buffer);
+}
+
+static void
+got_buffer_from_side (ProxySide *side, Buffer *buffer)
+{
+  FlatpakProxyClient *client = side->client;
+
+  if (side == &client->client_side)
+    got_buffer_from_client (client, side, buffer);
+  else
+    got_buffer_from_bus (client, side, buffer);
+}
+
+static gssize
+find_auth_end (FlatpakProxyClient *client, Buffer *buffer)
+{
+  guchar *match;
+  int i;
+
+  /* First try to match any leftover at the start */
+  if (client->auth_end_offset > 0)
+    {
+      gsize left = strlen (AUTH_END_STRING) - client->auth_end_offset;
+      gsize to_match = MIN (left, buffer->pos);
+      /* Matched at least up to to_match */
+      if (memcmp (buffer->data, &AUTH_END_STRING[client->auth_end_offset], to_match) == 0)
+        {
+          client->auth_end_offset += to_match;
+
+          /* Matched all */
+          if (client->auth_end_offset == strlen (AUTH_END_STRING))
+            return to_match;
+
+          /* Matched to end of buffer */
+          return -1;
+        }
+
+      /* Did not actually match at start */
+      client->auth_end_offset = -1;
+    }
+
+  /* Look for whole match inside buffer */
+  match = memmem (buffer, buffer->pos,
+                  AUTH_END_STRING, strlen (AUTH_END_STRING));
+  if (match != NULL)
+    return match - buffer->data + strlen (AUTH_END_STRING);
+
+  /* Record longest prefix match at the end */
+  for (i = MIN (strlen (AUTH_END_STRING) - 1, buffer->pos); i > 0; i--)
+    {
+      if (memcmp (buffer->data + buffer->pos - i, AUTH_END_STRING, i) == 0)
+        {
+          client->auth_end_offset = i;
+          break;
+        }
+    }
+
+  return -1;
+}
+
+static gboolean
+side_in_cb (GSocket *socket, GIOCondition condition, gpointer user_data)
+{
+  ProxySide *side = user_data;
+  FlatpakProxyClient *client = side->client;
+  GError *error = NULL;
+  Buffer *buffer;
+  gboolean retval = G_SOURCE_CONTINUE;
+
+  g_object_ref (client);
+
+  while (!side->closed)
+    {
+      if (!side->got_first_byte)
+        buffer = buffer_new (1, NULL);
+      else if (!client->authenticated)
+        buffer = buffer_new (64, NULL);
+      else
+        buffer = side->current_read_buffer;
+
+      if (!buffer_read (side, buffer, socket))
+        {
+          if (buffer != side->current_read_buffer)
+              buffer_unref (buffer);
+          break;
+        }
+
+      if (!client->authenticated)
+        {
+          if (buffer->pos > 0)
+            {
+              gboolean found_auth_end = FALSE;
+              gsize extra_data;
+
+              buffer->size = buffer->pos;
+              if (!side->got_first_byte)
+                {
+                  buffer->send_credentials = TRUE;
+                  side->got_first_byte = TRUE;
+                }
+              /* Look for end of authentication mechanism */
+              else if (side == &client->client_side)
+                {
+                  gssize auth_end = find_auth_end (client, buffer);
+
+                  if (auth_end >= 0)
+                    {
+                      found_auth_end = TRUE;
+                      buffer->size = auth_end;
+                      extra_data = buffer->pos - buffer->size;
+
+                      /* We may have gotten some extra data which is not part of
+                         the auth handshake, keep it for the next iteration. */
+                      if (extra_data > 0)
+                        side->extra_input_data = g_bytes_new (buffer->data + buffer->size, extra_data);
+                    }
+                }
+
+              got_buffer_from_side (side, buffer);
+
+              if (found_auth_end)
+                client->authenticated = TRUE;
+            }
+          else
+            {
+              buffer_unref (buffer);
+            }
+        }
+      else if (buffer->pos == buffer->size)
+        {
+          if (buffer == &side->header_buffer)
+            {
+              gssize required;
+              required = g_dbus_message_bytes_needed (buffer->data, buffer->size, &error);
+              if (required < 0)
+                {
+                  g_warning ("Invalid message header read");
+                  side_closed (side);
+                }
+              else
+                {
+                  side->current_read_buffer = buffer_new (required, buffer);
+                }
+            }
+          else
+            {
+              got_buffer_from_side (side, buffer);
+              side->header_buffer.pos = 0;
+              side->current_read_buffer = &side->header_buffer;
+            }
+        }
+    }
+
+  if (side->closed)
+    {
+      side->in_source = NULL;
+      retval = G_SOURCE_REMOVE;
+    }
+
+  g_object_unref (client);
+
+  return retval;
+}
+
+static void
+start_reading (ProxySide *side)
+{
+  GSocket *socket;
+
+  socket = g_socket_connection_get_socket (side->connection);
+  side->in_source = g_socket_create_source (socket, G_IO_IN, NULL);
+  g_source_set_callback (side->in_source, (GSourceFunc) side_in_cb, side, NULL);
+  g_source_attach (side->in_source, NULL);
+  g_source_unref (side->in_source);
+}
+
+static void
+stop_reading (ProxySide *side)
+{
+  if (side->in_source)
+    {
+      g_source_destroy (side->in_source);
+      side->in_source = NULL;
+    }
+}
+
+
+static void
+client_connected_to_dbus (GObject      *source_object,
+                          GAsyncResult *res,
+                          gpointer      user_data)
+{
+  FlatpakProxyClient *client = user_data;
+  GSocketConnection *connection;
+  GError *error = NULL;
+  GIOStream *stream;
+
+  stream = g_dbus_address_get_stream_finish (res, NULL, &error);
+  if (stream == NULL)
+    {
+      g_warning ("Failed to connect to bus: %s", error->message);
+      g_object_unref (client);
+      return;
+    }
+
+  connection = G_SOCKET_CONNECTION (stream);
+  g_socket_set_blocking (g_socket_connection_get_socket (connection), FALSE);
+  client->bus_side.connection = connection;
+
+  start_reading (&client->client_side);
+  start_reading (&client->bus_side);
+}
+
+static gboolean
+flatpak_proxy_incoming (GSocketService    *service,
+                        GSocketConnection *connection,
+                        GObject           *source_object)
+{
+  FlatpakProxy *proxy = FLATPAK_PROXY (service);
+  FlatpakProxyClient *client;
+
+  client = flatpak_proxy_client_new (proxy, connection);
+
+  g_dbus_address_get_stream (proxy->dbus_address,
+                             NULL,
+                             client_connected_to_dbus,
+                             client);
+  return TRUE;
+}
+
+static void
+flatpak_proxy_init (FlatpakProxy *proxy)
+{
+  proxy->policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  proxy->filters = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)filter_list_free);
+  proxy->wildcard_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  flatpak_proxy_add_policy (proxy, "org.freedesktop.DBus", FLATPAK_POLICY_TALK);
+}
+
+static void
+flatpak_proxy_class_init (FlatpakProxyClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GSocketServiceClass *socket_service_class = G_SOCKET_SERVICE_CLASS (klass);
+
+  object_class->get_property = flatpak_proxy_get_property;
+  object_class->set_property = flatpak_proxy_set_property;
+  object_class->finalize = flatpak_proxy_finalize;
+
+  socket_service_class->incoming = flatpak_proxy_incoming;
+
+  g_object_class_install_property (object_class,
+                                   PROP_DBUS_ADDRESS,
+                                   g_param_spec_string ("dbus-address",
+                                                        "",
+                                                        "",
+                                                        NULL,
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_SOCKET_PATH,
+                                   g_param_spec_string ("socket-path",
+                                                        "",
+                                                        "",
+                                                        NULL,
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+}
+
+FlatpakProxy *
+flatpak_proxy_new (const char *dbus_address,
+                   const char *socket_path)
+{
+  FlatpakProxy *proxy;
+
+  proxy = g_object_new (FLATPAK_TYPE_PROXY, "dbus-address", dbus_address, "socket-path", socket_path, NULL);
+  return proxy;
+}
+
+gboolean
+flatpak_proxy_start (FlatpakProxy *proxy, GError **error)
+{
+  GSocketAddress *address;
+  gboolean res;
+
+  unlink (proxy->socket_path);
+
+  address = g_unix_socket_address_new (proxy->socket_path);
+
+  error = NULL;
+  res = g_socket_listener_add_address (G_SOCKET_LISTENER (proxy),
+                                       address,
+                                       G_SOCKET_TYPE_STREAM,
+                                       G_SOCKET_PROTOCOL_DEFAULT,
+                                       NULL, /* source_object */
+                                       NULL, /* effective_address */
+                                       error);
+  g_object_unref (address);
+
+  if (!res)
+    return FALSE;
+
+
+  g_socket_service_start (G_SOCKET_SERVICE (proxy));
+  return TRUE;
+}
+
+void
+flatpak_proxy_stop (FlatpakProxy *proxy)
+{
+  unlink (proxy->socket_path);
+
+  g_socket_service_stop (G_SOCKET_SERVICE (proxy));
+}
diff --git a/dbus-proxy/flatpak-proxy.h b/dbus-proxy/flatpak-proxy.h
new file mode 100644 (file)
index 0000000..e97d749
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_PROXY_H__
+#define __FLATPAK_PROXY_H__
+
+#include <gio/gio.h>
+#include "libglnx/libglnx.h"
+
+typedef enum {
+  FLATPAK_POLICY_NONE,
+  FLATPAK_POLICY_SEE,
+  FLATPAK_POLICY_FILTERED,
+  FLATPAK_POLICY_TALK,
+  FLATPAK_POLICY_OWN
+} FlatpakPolicy;
+
+typedef struct FlatpakProxy FlatpakProxy;
+
+#define FLATPAK_TYPE_PROXY flatpak_proxy_get_type ()
+#define FLATPAK_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY, FlatpakProxy))
+#define FLATPAK_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakProxy, g_object_unref)
+
+GType flatpak_proxy_get_type (void);
+
+FlatpakProxy *flatpak_proxy_new (const char *dbus_address,
+                                 const char *socket_path);
+void         flatpak_proxy_set_log_messages (FlatpakProxy *proxy,
+                                             gboolean      log);
+void         flatpak_proxy_set_filter (FlatpakProxy *proxy,
+                                       gboolean      filter);
+void         flatpak_proxy_set_sloppy_names (FlatpakProxy *proxy,
+                                             gboolean      sloppy_names);
+void         flatpak_proxy_add_policy (FlatpakProxy *proxy,
+                                       const char   *name,
+                                       FlatpakPolicy policy);
+void         flatpak_proxy_add_wildcarded_policy (FlatpakProxy *proxy,
+                                                  const char   *name,
+                                                  FlatpakPolicy policy);
+void         flatpak_proxy_add_filter (FlatpakProxy *proxy,
+                                       const char   *name,
+                                       const char   *rule);
+gboolean     flatpak_proxy_start (FlatpakProxy *proxy,
+                                  GError      **error);
+void         flatpak_proxy_stop (FlatpakProxy *proxy);
+
+#endif /* __FLATPAK_PROXY_H__ */
diff --git a/dbus.service.d/flatpak.conf.in b/dbus.service.d/flatpak.conf.in
new file mode 100644 (file)
index 0000000..fdcacd6
--- /dev/null
@@ -0,0 +1,2 @@
+[Service]
+Environment=XDG_DATA_DIRS=%h/.local/share/flatpak/exports/share/:@localstatedir@/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..fc98710
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,791 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2013-05-30.07; # UTC
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputting dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
+# A tabulation character.
+tab='  '
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+## Some versions of gcc put a space before the ':'.  On the theory
+## that the space means something, we add a space to the output as
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like '#:fec' to the end of the
+    # dependency line.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
+    echo >> "$depfile"
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
+  else
+    make_dummy_depfile
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  set_dir_from "$object"
+  set_base_from "$object"
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using '\' :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
+
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  set_dir_from  "$object"
+  set_base_from "$object"
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -ne 0; then
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add 'dependent.h:' lines.
+    sed -ne '2,${
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
+  else
+    make_dummy_depfile
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove '-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for ':'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+  "$@" $dashmflag |
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no eat=no
+  for arg
+  do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove '-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+        set fnord "$@"
+        shift
+        shift
+        ;;
+    *)
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
+    esac
+  done
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..9e6d1f4
--- /dev/null
@@ -0,0 +1,98 @@
+NULL =
+
+SUBDIRS = reference
+
+XSLTPROC_FLAGS = \
+       --nonet                                         \
+       --stringparam man.output.quietly 1              \
+       --stringparam funcsynopsis.style ansi           \
+       --stringparam man.th.extra1.suppress 1          \
+       --stringparam man.authors.section.enabled 0     \
+       --stringparam man.copyright.section.enabled 0   \
+       $(NULL)
+
+.xml.1:
+       $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+.xml.5:
+       $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+man1 = \
+       flatpak.1                       \
+       flatpak-remotes.1               \
+       flatpak-remote-add.1            \
+       flatpak-remote-delete.1         \
+       flatpak-remote-modify.1         \
+       flatpak-remote-ls.1             \
+       flatpak-remote-info.1           \
+       flatpak-install.1               \
+       flatpak-config.1                \
+       flatpak-update.1                \
+       flatpak-uninstall.1             \
+       flatpak-list.1                  \
+       flatpak-info.1                  \
+       flatpak-make-current.1          \
+       flatpak-run.1                   \
+       flatpak-override.1              \
+       flatpak-enter.1                 \
+       flatpak-document-export.1       \
+       flatpak-document-unexport.1     \
+       flatpak-document-info.1         \
+       flatpak-document-list.1         \
+       flatpak-build-init.1            \
+       flatpak-build.1                 \
+       flatpak-build-bundle.1          \
+       flatpak-build-import-bundle.1   \
+       flatpak-build-finish.1          \
+       flatpak-build-export.1          \
+       flatpak-build-update-repo.1     \
+       flatpak-build-sign.1            \
+       flatpak-build-commit-from.1     \
+       flatpak-repo.1                  \
+       flatpak-search.1                \
+       $(NULL)
+
+man5 = \
+       flatpak-metadata.5              \
+       flatpak-flatpakrepo.5           \
+       flatpak-flatpakref.5            \
+       flatpak-remote.5                \
+       flatpak-installation.5          \
+       $(NULL)
+
+man_MANS = \
+       $(man1) \
+       $(man5) \
+       $(NULL)
+
+xml_files = \
+       $(man1:.1=.xml) \
+       $(man5:.5=.xml) \
+       $(NULL)
+
+EXTRA_DIST = \
+       $(xml_files)            \
+       docbook.css             \
+       flatpak-docs.xml.in     \
+       xmlto-config.xsl        \
+       $(NULL)
+
+CLEANFILES = $(NULL)
+DISTCLEANFILES = \
+       $(man_MANS)             \
+       flatpak-docs.xml        \
+       $(NULL)
+
+if DOCBOOK_DOCS_ENABLED
+
+doc_DATA =                      \
+        flatpak-docs.html      \
+        docbook.css             \
+        $(NULL)
+
+CLEANFILES += flatpak-docs.html
+
+flatpak-docs.html: flatpak-docs.xml $(xml_files) xmlto-config.xsl
+       $(AM_V_GEN) $(XMLTO) $(XMLTO_FLAGS) --skip-validation xhtml-nochunks -m $(srcdir)/xmlto-config.xsl $<
+
+endif # DOCBOOK_DOCS_ENABLED
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644 (file)
index 0000000..5c294d4
--- /dev/null
@@ -0,0 +1,959 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \  ]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@DOCBOOK_DOCS_ENABLED_TRUE@am__append_1 = flatpak-docs.html
+subdir = doc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libglnx/libglnx.m4 \
+       $(top_srcdir)/m4/attributes.m4 $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/glibtests.m4 $(top_srcdir)/m4/gtk-doc.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = flatpak-docs.xml
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+       ctags-recursive dvi-recursive html-recursive info-recursive \
+       install-data-recursive install-dvi-recursive \
+       install-exec-recursive install-html-recursive \
+       install-info-recursive install-pdf-recursive \
+       install-ps-recursive install-recursive installcheck-recursive \
+       installdirs-recursive pdf-recursive ps-recursive \
+       tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \
+       "$(DESTDIR)$(docdir)"
+man5dir = $(mandir)/man5
+NROFF = nroff
+MANS = $(man_MANS)
+DATA = $(doc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+       distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/flatpak-docs.xml.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_GLIB_CFLAGS = @APPSTREAM_GLIB_CFLAGS@
+APPSTREAM_GLIB_LIBS = @APPSTREAM_GLIB_LIBS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+BASE_LIBS = @BASE_LIBS@
+BWRAP = @BWRAP@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DBUS_CONFIG_DIR = @DBUS_CONFIG_DIR@
+DBUS_SERVICE_DIR = @DBUS_SERVICE_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEP_GPGME_CFLAGS = @DEP_GPGME_CFLAGS@
+DEP_GPGME_LIBS = @DEP_GPGME_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLATPAK_INTERFACE_AGE = @FLATPAK_INTERFACE_AGE@
+FLATPAK_MAJOR_VERSION = @FLATPAK_MAJOR_VERSION@
+FLATPAK_MICRO_VERSION = @FLATPAK_MICRO_VERSION@
+FLATPAK_MINOR_VERSION = @FLATPAK_MINOR_VERSION@
+FLATPAK_VERSION = @FLATPAK_VERSION@
+FUSE_CFLAGS = @FUSE_CFLAGS@
+FUSE_LIBS = @FUSE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GPGME_CONFIG = @GPGME_CONFIG@
+GPGME_PTHREAD_CFLAGS = @GPGME_PTHREAD_CFLAGS@
+GPGME_PTHREAD_LIBS = @GPGME_PTHREAD_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
+INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
+JSON_CFLAGS = @JSON_CFLAGS@
+JSON_LIBS = @JSON_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@
+LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OSTREE_CFLAGS = @OSTREE_CFLAGS@
+OSTREE_LIBS = @OSTREE_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PRIVILEGED_GROUP = @PRIVILEGED_GROUP@
+PROFILE_DIR = @PROFILE_DIR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+STRIP = @STRIP@
+SUDO_BIN = @SUDO_BIN@
+SYSTEM_FONTS_DIR = @SYSTEM_FONTS_DIR@
+SYSTEM_FONT_CACHE_DIRS = @SYSTEM_FONT_CACHE_DIRS@
+SYSTEM_INSTALL_DIR = @SYSTEM_INSTALL_DIR@
+USE_NLS = @USE_NLS@
+VALGRIND = @VALGRIND@
+VALGRIND_ENABLED = @VALGRIND_ENABLED@
+VALGRIND_HAVE_TOOL_memcheck = @VALGRIND_HAVE_TOOL_memcheck@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+XAUTH_CFLAGS = @XAUTH_CFLAGS@
+XAUTH_LIBS = @XAUTH_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMLCATALOG = @XMLCATALOG@
+XMLTO = @XMLTO@
+XMLTO_FLAGS = @XMLTO_FLAGS@
+XML_CATALOG_FILE = @XML_CATALOG_FILE@
+XSLTPROC = @XSLTPROC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+installed_test_metadir = @installed_test_metadir@
+installed_testdir = @installed_testdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
+systemduserunitdir = @systemduserunitdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+NULL = 
+SUBDIRS = reference
+XSLTPROC_FLAGS = \
+       --nonet                                         \
+       --stringparam man.output.quietly 1              \
+       --stringparam funcsynopsis.style ansi           \
+       --stringparam man.th.extra1.suppress 1          \
+       --stringparam man.authors.section.enabled 0     \
+       --stringparam man.copyright.section.enabled 0   \
+       $(NULL)
+
+man1 = \
+       flatpak.1                       \
+       flatpak-remotes.1               \
+       flatpak-remote-add.1            \
+       flatpak-remote-delete.1         \
+       flatpak-remote-modify.1         \
+       flatpak-remote-ls.1             \
+       flatpak-remote-info.1           \
+       flatpak-install.1               \
+       flatpak-config.1                \
+       flatpak-update.1                \
+       flatpak-uninstall.1             \
+       flatpak-list.1                  \
+       flatpak-info.1                  \
+       flatpak-make-current.1          \
+       flatpak-run.1                   \
+       flatpak-override.1              \
+       flatpak-enter.1                 \
+       flatpak-document-export.1       \
+       flatpak-document-unexport.1     \
+       flatpak-document-info.1         \
+       flatpak-document-list.1         \
+       flatpak-build-init.1            \
+       flatpak-build.1                 \
+       flatpak-build-bundle.1          \
+       flatpak-build-import-bundle.1   \
+       flatpak-build-finish.1          \
+       flatpak-build-export.1          \
+       flatpak-build-update-repo.1     \
+       flatpak-build-sign.1            \
+       flatpak-build-commit-from.1     \
+       flatpak-repo.1                  \
+       flatpak-search.1                \
+       $(NULL)
+
+man5 = \
+       flatpak-metadata.5              \
+       flatpak-flatpakrepo.5           \
+       flatpak-flatpakref.5            \
+       flatpak-remote.5                \
+       flatpak-installation.5          \
+       $(NULL)
+
+man_MANS = \
+       $(man1) \
+       $(man5) \
+       $(NULL)
+
+xml_files = \
+       $(man1:.1=.xml) \
+       $(man5:.5=.xml) \
+       $(NULL)
+
+EXTRA_DIST = \
+       $(xml_files)            \
+       docbook.css             \
+       flatpak-docs.xml.in     \
+       xmlto-config.xsl        \
+       $(NULL)
+
+CLEANFILES = $(NULL) $(am__append_1)
+DISTCLEANFILES = \
+       $(man_MANS)             \
+       flatpak-docs.xml        \
+       $(NULL)
+
+@DOCBOOK_DOCS_ENABLED_TRUE@doc_DATA = \
+@DOCBOOK_DOCS_ENABLED_TRUE@        flatpak-docs.html   \
+@DOCBOOK_DOCS_ENABLED_TRUE@        docbook.css             \
+@DOCBOOK_DOCS_ENABLED_TRUE@        $(NULL)
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .1 .5 .xml
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --foreign doc/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+flatpak-docs.xml: $(top_builddir)/config.status $(srcdir)/flatpak-docs.xml.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+install-man1: $(man_MANS)
+       @$(NORMAL_INSTALL)
+       @list1=''; \
+       list2='$(man_MANS)'; \
+       test -n "$(man1dir)" \
+         && test -n "`echo $$list1$$list2`" \
+         || exit 0; \
+       echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+       $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+       { for i in $$list1; do echo "$$i"; done;  \
+       if test -n "$$list2"; then \
+         for i in $$list2; do echo "$$i"; done \
+           | sed -n '/\.1[a-z]*$$/p'; \
+       fi; \
+       } | while read p; do \
+         if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; echo "$$p"; \
+       done | \
+       sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+       sed 'N;N;s,\n, ,g' | { \
+       list=; while read file base inst; do \
+         if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+           echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+           $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+         fi; \
+       done; \
+       for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+       while read files; do \
+         test -z "$$files" || { \
+           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+           $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+       done; }
+
+uninstall-man1:
+       @$(NORMAL_UNINSTALL)
+       @list=''; test -n "$(man1dir)" || exit 0; \
+       files=`{ for i in $$list; do echo "$$i"; done; \
+       l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+         sed -n '/\.1[a-z]*$$/p'; \
+       } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+       dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-man5: $(man_MANS)
+       @$(NORMAL_INSTALL)
+       @list1=''; \
+       list2='$(man_MANS)'; \
+       test -n "$(man5dir)" \
+         && test -n "`echo $$list1$$list2`" \
+         || exit 0; \
+       echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \
+       $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \
+       { for i in $$list1; do echo "$$i"; done;  \
+       if test -n "$$list2"; then \
+         for i in $$list2; do echo "$$i"; done \
+           | sed -n '/\.5[a-z]*$$/p'; \
+       fi; \
+       } | while read p; do \
+         if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; echo "$$p"; \
+       done | \
+       sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+       sed 'N;N;s,\n, ,g' | { \
+       list=; while read file base inst; do \
+         if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+           echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+           $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
+         fi; \
+       done; \
+       for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+       while read files; do \
+         test -z "$$files" || { \
+           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
+           $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
+       done; }
+
+uninstall-man5:
+       @$(NORMAL_UNINSTALL)
+       @list=''; test -n "$(man5dir)" || exit 0; \
+       files=`{ for i in $$list; do echo "$$i"; done; \
+       l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+         sed -n '/\.5[a-z]*$$/p'; \
+       } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+       dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
+install-docDATA: $(doc_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+       done
+
+uninstall-docDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+       @fail=; \
+       if $(am__make_keepgoing); then \
+         failcom='fail=yes'; \
+       else \
+         failcom='exit 1'; \
+       fi; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+       $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+       set x; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       $(am__define_uniq_tagged_files); \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+       $(am__define_uniq_tagged_files); \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+       list='$(am__tagged_files)'; \
+       case "$(srcdir)" in \
+         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+         *) sdir=$(subdir)/$(srcdir) ;; \
+       esac; \
+       for i in $$list; do \
+         if test -f "$$i"; then \
+           echo "$(subdir)/$$i"; \
+         else \
+           echo "$$sdir/$$i"; \
+         fi; \
+       done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           $(am__make_dryrun) \
+             || test -d "$(distdir)/$$subdir" \
+             || $(MKDIR_P) "$(distdir)/$$subdir" \
+             || exit 1; \
+           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+           $(am__relativize); \
+           new_distdir=$$reldir; \
+           dir1=$$subdir; dir2="$(top_distdir)"; \
+           $(am__relativize); \
+           new_top_distdir=$$reldir; \
+           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+           ($(am__cd) $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$new_top_distdir" \
+               distdir="$$new_distdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               am__skip_mode_fix=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(MANS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(docdir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-docDATA install-man
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1 install-man5
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-docDATA uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man5
+
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+       check-am clean clean-generic clean-libtool cscopelist-am ctags \
+       ctags-am distclean distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-docDATA install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-man install-man1 install-man5 \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+       ps ps-am tags tags-am uninstall uninstall-am uninstall-docDATA \
+       uninstall-man uninstall-man1 uninstall-man5
+
+.PRECIOUS: Makefile
+
+
+.xml.1:
+       $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+.xml.5:
+       $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+@DOCBOOK_DOCS_ENABLED_TRUE@flatpak-docs.html: flatpak-docs.xml $(xml_files) xmlto-config.xsl
+@DOCBOOK_DOCS_ENABLED_TRUE@    $(AM_V_GEN) $(XMLTO) $(XMLTO_FLAGS) --skip-validation xhtml-nochunks -m $(srcdir)/xmlto-config.xsl $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/docbook.css b/doc/docbook.css
new file mode 100644 (file)
index 0000000..6a7373e
--- /dev/null
@@ -0,0 +1,78 @@
+body
+{
+  font-family: sans-serif;
+}
+h1.title
+{
+}
+.permission
+{
+  color: #ee0000;
+  text-decoration: underline;
+}
+.synopsis, .classsynopsis
+{
+  background: #eeeeee;
+  border: solid 1px #aaaaaa;
+  padding: 0.5em;
+}
+.programlisting
+{
+  background: #eeeeff;
+  border: solid 1px #aaaaff;
+  padding: 0.5em;
+}
+.variablelist
+{
+  padding: 4px;
+  margin-left: 3em;
+}
+.variablelist td:first-child
+{
+  vertical-align: top;
+}
+td.shortcuts
+{
+  color: #770000;
+  font-size: 80%;
+}
+div.refnamediv
+{
+  margin-top: 2em;
+}
+div.toc
+{
+  border: 2em;
+}
+a
+{
+  text-decoration: none;
+}
+a:hover
+{
+  text-decoration: underline;
+  color: #FF0000;
+}
+
+div.table table
+{
+  border-collapse: collapse;
+  border-spacing: 0px;
+  border-style: solid;
+  border-color: #777777;
+  border-width: 1px;
+}
+
+div.table table td, div.table table th
+{
+  border-style: solid;
+  border-color: #777777;
+  border-width: 1px;
+  padding: 3px;
+  vertical-align: top;
+}
+
+div.table table th
+{
+  background-color: #eeeeee;
+}
diff --git a/doc/flatpak-build-bundle.xml b/doc/flatpak-build-bundle.xml
new file mode 100644 (file)
index 0000000..adc568c
--- /dev/null
@@ -0,0 +1,174 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-bundle">
+
+    <refentryinfo>
+        <title>flatpak build-bundle</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-bundle</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-bundle</refname>
+        <refpurpose>Create a single-file bundle from a local repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-bundle</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+                <arg choice="plain">FILENAME</arg>
+                <arg choice="plain">NAME</arg>
+                <arg choice="opt">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Creates a single-file named <arg choice="plain">FILENAME</arg>
+            for the application (or runtime) named <arg choice="plain">NAME</arg>
+            in the repository at <arg choice="plain">LOCATION</arg>. If
+            a <arg choice="plain">BRANCH</arg> is specified, this branch of
+            the application is used.
+            <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+            The collection ID set on the repository at
+            <arg choice="plain">LOCATION</arg> (if set) will be used for the
+            bundle.
+            -->
+        </para>
+        <para>
+            The format of the bundle file is that of an ostree static delta
+            (against an empty base) with some flatpak specific metadata for
+            the application icons and appdata.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Export a runtime instead of an application.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The arch to create a bundle for.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--repo-url=URL</option></term>
+
+                <listitem><para>
+                    The URL for the repository from which the
+                    application can be updated. Installing the
+                    bundle will automatically configure a remote
+                    for this URL.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime-repo=URL</option></term>
+
+                <listitem><para>
+                  The URL for a .flatpakrepo file that contains
+                  the information about the repository that supplies
+                  the runtimes required by the app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-keys=FILE</option></term>
+
+                <listitem><para>
+                    Add the GPG key from FILE (use - for stdin).
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--oci</option></term>
+
+                <listitem><para>
+                    Export to an OCI image instead of a Flatpak bundle.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-import-bundle</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-repo-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-commit-from.xml b/doc/flatpak-build-commit-from.xml
new file mode 100644 (file)
index 0000000..52f39b0
--- /dev/null
@@ -0,0 +1,231 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-commit-from">
+
+    <refentryinfo>
+        <title>flatpak build-commit-from</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-commit-from</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-commit-from</refname>
+        <refpurpose>Create new commits based on existing one (possibly from another repository)</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-commit-from</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">DST-REPO</arg>
+                <arg choice="plain" rep="repeat">DST-REF</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Creates new commits on the <arg choice="plain">DST-REF</arg>
+            branch in the <arg choice="plain">DST-REPO</arg>, with the
+            contents (and most of the metadata) taken from another
+            branch, either from another repo, or from another branch in
+            the same repository.
+            <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+            The collection ID set on
+            <arg choice="plain">DST-REPO</arg> (if set) will be used for the
+            newly created commits.
+            -->
+        </para>
+        <para>
+            This command is very useful when you want to maintain a branch
+            with a clean history that has no unsigned or broken commits.
+            For instance, you can import the head from a different repository
+            from an automatic builder when you've verified that it worked.
+            The new commit will have no parents or signatures from the
+            autobuilder, and can be properly signed with the official
+            key.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--src-repo=SRC-REPO</option></term>
+
+                <listitem><para>
+                    The (local) repository to pull the source branch from. Defaults to the
+                    destination repository.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--src-ref=SRC-REF</option></term>
+
+                <listitem><para>
+                    The branch to use as the source for the new commit. Defaults to the same
+                    as the destination ref, which is useful only if a different source repo
+                    has been specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--untrusted</option></term>
+
+                <listitem><para>
+                    The source repostory is not trusted, all objects are copied (not hardlinked) and
+                    all checksums are verified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-s</option></term>
+                <term><option>--subject=SUBJECT</option></term>
+
+                <listitem><para>
+                    One line subject for the commit message. If not specified, will be taken from the source commit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-b</option></term>
+                <term><option>--body=BODY</option></term>
+
+                <listitem><para>
+                    Full description for the commit message. If not specified, will be taken from the source commit.
+                </para></listitem>
+            </varlistentry>
+
+
+            <varlistentry>
+                <term><option>--update-appstream</option></term>
+
+                <listitem><para>
+                    Run appstream-builder and to update the appstream branch after build.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-update-summary</option></term>
+
+                <listitem><para>
+                    Don't update the summary file after the new commit is added. This means
+                    the repository will not be useful for serving over http until build-repo-update
+                    has been run. This is useful is you want to do multiple repo operations before
+                    finally updating the summary.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--force</option></term>
+
+                <listitem><para>
+                    Create new commit even if the content didn't change from the existing branch head.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-sign=KEYID</option></term>
+
+                <listitem><para>
+                    Sign the commit with this GPG key.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build-export ~/repos/gnome-calculator/ ~/build/gnome-calculator/ org.gnome.Calculator</command>
+        </para>
+<programlisting>
+Commit: 9d0044ea480297114d03aec85c3d7ae3779438f9d2cb69d717fb54237acacb8c
+Metadata Total: 605
+Metadata Written: 5
+Content Total: 1174
+Content Written: 1
+Content Bytes Written: 305
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-sign</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-repo-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-export.xml b/doc/flatpak-build-export.xml
new file mode 100644 (file)
index 0000000..ec3d077
--- /dev/null
@@ -0,0 +1,280 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-export">
+
+    <refentryinfo>
+        <title>flatpak build-export</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-export</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-export</refname>
+        <refpurpose>Create a repository from a build directory</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-export</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+                <arg choice="plain">DIRECTORY</arg>
+                <arg choice="opt">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Creates or updates a repository with an application build.
+            <arg choice="plain">LOCATION</arg> is the location of the
+            repository. <arg choice="plain">DIRECTORY</arg> must be a
+            finalized build directory. If <arg choice="plain">BRANCH</arg>
+            is not specified, it is assumed to be "master".
+        </para>
+        <para>
+            If <arg choice="plain">LOCATION</arg> exists, it is assumed to
+            be an OSTree repository, otherwise a new OSTree repository is
+            created at this location. The repository can be inspected with
+            the <command>ostree</command> tool.
+        </para>
+        <para>
+            The contents of <arg choice="plain">DIRECTORY</arg> are committed
+            on the branch with name <literal>app/APPNAME/ARCH/BRANCH</literal>,
+            where ARCH is the architecture of the runtime that the application
+            is using. A commit filter is used to enforce that only the contents
+            of the <filename>files/</filename> and <filename>export/</filename>
+            subdirectories and the <filename>metadata</filename> file are included
+            in the commit, anything else is ignored.
+        </para>
+        <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+        <para>
+            When exporting a flatpak to be published to the internet,
+            <option>-FIXME-collection-id=COLLECTION-ID</option> should be specified
+            as a globally unique reverse DNS value to identify the collection of
+            flatpaks this will be added to. Setting a globally unique collection
+            ID allows the apps in the repository to be shared over peer to peer
+            systems without needing further configuration.
+        </para>
+        -->
+        <para>
+            The build-update-repo command should be used to update repository
+            metadata whenever application builds are added to a repository.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-s</option></term>
+                <term><option>--subject=SUBJECT</option></term>
+
+                <listitem><para>
+                    One line subject for the commit message.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-b</option></term>
+                <term><option>--body=BODY</option></term>
+
+                <listitem><para>
+                    Full description for the commit message.
+                </para></listitem>
+            </varlistentry>
+
+            <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+            <varlistentry>
+                <term><option>-FIXME-collection-id=COLLECTION-ID</option></term>
+
+                <listitem><para>
+                    Set as the collection ID of the repository. Setting a globally
+                    unique collection ID allows the apps in the repository to be shared over
+                    peer to peer systems without needing further configuration.
+                    If exporting to an existing repository, the collection ID
+                    must match the existing configured collection ID for that
+                    repository.
+                </para></listitem>
+            </varlistentry>
+            -->
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    Specify the architecture component of the branch to export. Only host compatible architectures can be specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--exclude=PATTERN</option></term>
+
+                <listitem><para>
+                    Exclude files matching PATTERN from the commit.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--include=PATTERN</option></term>
+
+                <listitem><para>
+                    Don't exclude files matching PATTERN from the commit, even if they match the --export patterns.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--metadata=FILENAME</option></term>
+
+                <listitem><para>
+                  Use the specified filename as metadata in the exported app instead of
+                  the default file (called <filename>metadata</filename>). This is useful
+                  if you want to commit multiple things from a single build tree, typically
+                  used in combination with --files and --exclude.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--files=SUBDIR</option></term>
+
+                <listitem><para>
+                  Use the files in the specified subdirectory as the file contents, rather
+                  than the regular <filename>files</filename> directory.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--update-appstream</option></term>
+
+                <listitem><para>
+                    Run appstream-builder and to update the appstream branch after build.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-update-summary</option></term>
+
+                <listitem><para>
+                    Don't update the summary file after the new commit is added. This means
+                    the repository will not be useful for serving over http until build-repo-update
+                    has been run. This is useful is you want to do multiple repo operations before
+                    finally updating the summary.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-sign=KEYID</option></term>
+
+                <listitem><para>
+                    Sign the commit with this GPG key.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-r</option></term>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Export a runtime instead for an app (this uses the usr subdir as files).
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build-export ~/repos/gnome-calculator/ ~/build/gnome-calculator/ org.gnome.Calculator</command>
+        </para>
+<programlisting>
+Commit: 9d0044ea480297114d03aec85c3d7ae3779438f9d2cb69d717fb54237acacb8c
+Metadata Total: 605
+Metadata Written: 5
+Content Total: 1174
+Content Written: 1
+Content Bytes Written: 305
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-sign</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-repo-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-finish.xml b/doc/flatpak-build-finish.xml
new file mode 100644 (file)
index 0000000..8a08e81
--- /dev/null
@@ -0,0 +1,427 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-finish">
+
+    <refentryinfo>
+        <title>flatpak build-finish</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-finish</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-finish</refname>
+        <refpurpose>Finalize a build directory</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-finish</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">DIRECTORY</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Finalizes a build directory, to prepare it for exporting.
+            <arg choice="plain">DIRECTORY</arg> is the name of the directory.
+        </para>
+        <para>
+            The result of this command is that desktop files, icons and
+            D-Bus service files from the <filename>files</filename> subdirectory
+            are copied to a new <filename>export</filename> subdirectory. In the
+            <filename>metadata</filename> file, the command key is set in the
+            [Application] group, and the supported keys in the [Environment]
+            group are set according to the options.
+        </para>
+        <para>
+            You should review the exported files and the application metadata
+            before creating and distributing an application bundle.
+        </para>
+        <para>
+            It is an error to run build-finish on a directory that has not
+            been initialized as a build directory, or has already been finalized.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--command=COMMAND</option></term>
+
+                <listitem><para>
+                    The command to use. If this option is not specified,
+                    the first executable found in <filename>files/bin</filename>
+                    is used.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--require-version=MAJOR.MINOR.MICRO</option></term>
+
+                <listitem><para>
+                    Require this version of later of flatpak to install/update to this build.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--share=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Share a subsystem with the host session. This updates
+                    the [Context] group in the metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--unshare=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Don't share a subsystem with the host session. This updates
+                    the [Context] group in the metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--socket=SOCKET</option></term>
+
+                <listitem><para>
+                    Expose a well known socket to the application. This updates
+                    the [Context] group in the metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nosocket=SOCKET</option></term>
+
+                <listitem><para>
+                    Don't expose a well known socket to the application. This updates
+                    the [Context] group in the metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--device=DEVICE</option></term>
+
+                <listitem><para>
+                    Expose a device to the application. This updates
+                    the [Context] group in the metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nodevice=DEVICE</option></term>
+
+                <listitem><para>
+                    Don't expose a device to the application. This updates
+                    the [Context] group in the metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--allow=FEATURE</option></term>
+
+                <listitem><para>
+                    Allow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                 </para><para>
+                    The <code>devel</code> feature allows the application to
+                    access certain syscalls such as <code>ptrace()</code>, and
+                <code>perf_event_open()</code>.
+                </para><para>
+                    The <code>multiarch</code> feature allows the application to
+                    execute programs compiled for an ABI other than the one supported
+                    natively by the system. For example, for the <code>x86_64</code>
+                    architecture, 32-bit <code>x86</code> binaries will be allowed as
+                    well.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disallow=FEATURE</option></term>
+
+                <listitem><para>
+                    Disallow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--filesystem=FS</option></term>
+
+                <listitem><para>
+                    Allow the application access to a subset of the filesystem.
+                    This updates the [Context] group in the metadata.
+                    FS can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos, xdg-run,
+                    xdg-config, xdg-cache, xdg-data, an absolute path, or a homedir-relative
+                    path like ~/dir or paths relative to the xdg dirs, like xdg-download/subdir.
+                    The optional :ro suffix indicates that the location will be read-only.
+                    The optional :create suffix indicates that the location will be read-write and created if it doesn't exist.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nofilesystem=FILESYSTEM</option></term>
+
+                <listitem><para>
+                    Remove access to the specified subset of the filesystem from
+                    the application. This overrides to the Context section from the
+                    application metadata.
+                    FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos,
+                    an absolute path, or a homedir-relative path like ~/dir.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--add-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Add generic policy option. For example, "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would map to this metadata:
+<programlisting>
+[Policy subsystem]
+key=v1;v2;
+</programlisting>
+                </para></listitem>
+                <listitem><para>
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--remove-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Remove generic policy option. This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--env=VAR=VALUE</option></term>
+
+                <listitem><para>
+                    Set an environment variable in the application.
+                    This updates the [Environment] group in the metadata.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well known name NAME on the session bus.
+                    If NAME ends with .*, it allows the application to own all matching names.
+
+                    This updates the [Session Bus Policy] group in the metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well known name NAME on the session bus.
+                    If NAME ends with .*, it allows the application to talk to all matching names.
+                    This updates the [Session Bus Policy] group in the metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to own all matching names.
+                    This updates the [System Bus Policy] group in the metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to talk to all matching names.
+                    This updates the [System Bus Policy] group in the metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--persist=FILENAME</option></term>
+
+                <listitem><para>
+                    If the application doesn't have access to the real homedir, make the (homedir-relative) path
+                    FILENAME a bind mount to the corresponding path in the per-application directory,
+                    allowing that location to be used for persistent data.
+                    This updates the [Context] group in the metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime=RUNTIME</option></term>
+                <term><option>--sdk=SDK</option></term>
+
+                <listitem><para>
+                  Change the runtime or sdk used by the app to the specified partial ref. Unspecified parts
+                  of the ref are taken from the old values or defaults.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--metadata=GROUP=KEY[=VALUE]</option></term>
+
+                <listitem><para>
+                  Set a generic key in the metadata file. If value is left out it will
+                  be set to "true".
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--extension=NAME=VARIABLE[=VALUE]</option></term>
+
+                <listitem><para>
+                  Add extension point info.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--extension-priority=VALUE</option></term>
+
+                <listitem><para>
+                  Set the priority (library override order) of the extension point.
+                  Only useful for extensions. 0 is the default, and higher value means higher
+                  priority.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--extra-data=NAME:SHA256:DOWNLOAD-SIZE:INSTALL-SIZE:URL</option></term>
+
+                <listitem><para>
+                    Adds information about extra data uris to the app. These will be downloaded
+                    and verified by the client when the app is installed and placed in the
+                    /app/extra directory. You can also supply an /app/bin/apply_extra script
+                    that will be run after the files are downloaded.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-exports</option></term>
+
+                <listitem><para>
+                    Don't look for exports in the build.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build-finish /build/my-app --socket=x11 --share=ipc</command>
+        </para>
+<programlisting>
+Exporting share/applications/gnome-calculator.desktop
+Exporting share/dbus-1/services/org.gnome.Calculator.SearchProvider.service
+More than one executable
+Using gcalccmd as command
+Please review the exported files and the metadata
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-import-bundle.xml b/doc/flatpak-build-import-bundle.xml
new file mode 100644 (file)
index 0000000..12a13f2
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-import-bundle">
+
+    <refentryinfo>
+        <title>flatpak build-import-bundle</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-import-bundle</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-import-bundle</refname>
+        <refpurpose>Import a file bundle into a local repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-import-bundle</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+                <arg choice="plain">FILENAME</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Imports a bundle from a file named <arg choice="plain">FILENAME</arg>
+            into the repository at <arg choice="plain">LOCATION</arg>.
+        </para>
+        <para>
+            The format of the bundle file is that generated by build-bundle.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ref=REF</option></term>
+
+                <listitem><para>
+                    Override the ref specified in the bundle.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--oci</option></term>
+
+                <listitem><para>
+                    Import an OCI image instead of a Flatpak bundle.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--update-appstream</option></term>
+
+                <listitem><para>
+                    Run appstream-builder and to update the appstream branch after build.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-update-summary</option></term>
+
+                <listitem><para>
+                    Don't update the summary file after the new commit is added. This means
+                    the repository will not be useful for serving over http until build-repo-update
+                    has been run. This is useful is you want to do multiple repo operations before
+                    finally updating the summary.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-sign=KEYID</option></term>
+
+                <listitem><para>
+                    Sign the commit with this GPG key.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-bundle</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-repo-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-init.xml b/doc/flatpak-build-init.xml
new file mode 100644 (file)
index 0000000..dc294c2
--- /dev/null
@@ -0,0 +1,220 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-init">
+
+    <refentryinfo>
+        <title>flatpak build-init</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-init</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-init</refname>
+        <refpurpose>Initialize a build directory</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-init</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">DIRECTORY</arg>
+                <arg choice="plain">APPNAME</arg>
+                <arg choice="plain">SDK</arg>
+                <arg choice="plain">RUNTIME</arg>
+                <arg choice="opt">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Initializes a directory for building an application.
+            <arg choice="plain">DIRECTORY</arg> is the name of the directory.
+            <arg choice="plain">APPNAME</arg> is the application id of the app
+            that will be built.
+            <arg choice="plain">SDK</arg> and <arg choice="plain">RUNTIME</arg>
+            specify the sdk and runtime that the application should be built
+            against and run in.
+        </para>
+        <para>
+            The result of this command is that a <filename>metadata</filename>
+            file is created inside the given directory. Additionally, empty
+            <filename>files</filename> and <filename>var</filename> subdirectories
+            are created.
+        </para>
+        <para>
+            It is an error to run build-init on a directory that has already
+            been initialized as a build directory.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to use.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--var=RUNTIME</option></term>
+
+                <listitem><para>
+                    Initialize var from the named runtime.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-w</option></term>
+                <term><option>--writable-sdk</option></term>
+
+                <listitem><para>
+                    Initialize /usr with a copy of the sdk, which is writable during flatpak build. This can be used
+                    if you need to install build tools in /usr during the build. This is stored in the
+                    <filename>usr</filename> subdirectory of the app dir, but will not be part of the final
+                    app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--tag=TAG</option></term>
+
+                <listitem><para>
+                    Add a tag to the metadata file.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--sdk-extension=EXTENSION</option></term>
+
+                <listitem><para>
+                    When using --writable-sdk, in addition to the sdk, also install the specified extension.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--sdk-dir</option></term>
+
+                <listitem><para>
+                    Specify a custom subdirectory to use instead of <filename>usr</filename> for --writable-sdk.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--update</option></term>
+
+                <listitem><para>
+                    Re-initialize the sdk and var, don't fail if already initialized.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--base=APP</option></term>
+
+                <listitem><para>
+                    Initialize the application with files from another specified application.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--base-version=VERSION</option></term>
+
+                <listitem><para>
+                    Specify the version to use for --base. If not specified, will default to
+                    "master".
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><option>--base-extension=EXTENSION</option></term>
+
+                <listitem><para>
+                    When using --base, also install the specified extension from the app.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--type=TYPE</option></term>
+
+                <listitem><para>
+                    This can be used to build different types of things. The default
+                    is "app" which is a regular app, but "runtime" creates a runtime
+                    based on an existing runtime, and "extension" creates an extension
+                    for an app or runtime.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build-init /build/my-app org.gnome.Sdk org.gnome.Platform 3.16</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-sign.xml b/doc/flatpak-build-sign.xml
new file mode 100644 (file)
index 0000000..04b4a51
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-export">
+
+    <refentryinfo>
+        <title>flatpak build-sign</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-sign</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-sign</refname>
+        <refpurpose>Sign an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-sign</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+                <arg choice="plain">ID</arg>
+                <arg choice="opt">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Signs the commit for a specified application or runtime in
+            a local repository.  <arg choice="plain">LOCATION</arg> is
+            the location of the repository. <arg
+            choice="plain">ID</arg> is the name of the application, or
+            runtime if --runtime is specified. If <arg
+            choice="plain">BRANCH</arg> is not specified, it is
+            assumed to be "master".
+        </para>
+        <para>
+            Applications can also be signed during build-export, but
+            it is sometimes useful to add additional signatures later.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-sign=KEYID</option></term>
+
+                <listitem><para>
+                    Sign the commit with this GPG key.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Sign a runtime instead of an app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to use.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build-sign --gpg-sign=D8BA6573DDD2418027736F1BC33B315E53C1E9D6 /some/repo org.my.App</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build-update-repo.xml b/doc/flatpak-build-update-repo.xml
new file mode 100644 (file)
index 0000000..c2eb1a4
--- /dev/null
@@ -0,0 +1,214 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build-update-repo">
+
+    <refentryinfo>
+        <title>flatpak build-update-repo</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build-update-repo</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build-update-repo</refname>
+        <refpurpose>Create a repository from a build directory</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build-update-repo</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Updates repository metadata for the repository at
+            <arg choice="plain">LOCATION</arg>. This command generates
+            an OSTree summary file that lists the contents of the repository.
+            The summary is used by flatpak repo-contents and other commands
+            to display the contents of remote repositories.
+        </para>
+        <para>
+            After this command, <arg choice="plain">LOCATION</arg> can be
+            used as the repository location for flatpak add-repo, either by
+            exporting it over http, or directly with a file: url.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--redirect-url=URL</option></term>
+
+                <listitem><para>
+                    Redirect this repo to a new URL.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--title=TITLE</option></term>
+
+                <listitem><para>
+                    A title for the repository, e.g. for display in a UI.
+                    The title is stored in the repository summary.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--default-branch=BRANCH</option></term>
+
+                <listitem><para>
+                    A default branch for the repository, mainly for use in a UI.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-import=FILE</option></term>
+
+                <listitem><para>
+                    Import a new default GPG public key from the
+                    given file.
+                </para></listitem>
+            </varlistentry>
+
+            <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+            <varlistentry>
+                <term><option>-FIXME-collection-id=COLLECTION-ID</option></term>
+
+                <listitem><para>
+                    The globally unique identifier of the remote repository, to
+                    allow mirrors to be grouped. This must be set to a globally
+                    unique reverse DNS string if the repository is to be made
+                    publicly available. If a collection ID is already set on an
+                    existing repository, this will update it. If not specified,
+                    the existing collection ID will be left unchanged.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-FIXME-deploy-collection-id</option></term>
+
+                <listitem><para>
+                    Deploy the collection ID (set using <option>-FIXME-collection-id</option>
+                    in the static remote configuration for all clients. This is
+                    irrevocable once published in a repository. Use it to decide
+                    when to roll out a collection ID to users of an existing repository.
+                    If constructing a new repository which has a collection ID,
+                    you should typically always pass this option.
+                </para></listitem>
+            </varlistentry>
+            -->
+
+            <varlistentry>
+                <term><option>--gpg-sign=KEYID</option></term>
+
+                <listitem><para>
+                    Sign the commit with this GPG key.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-homedir=PATH</option></term>
+
+                <listitem><para>
+                    GPG Homedir to use when looking for keyrings
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--generate-static-deltas</option></term>
+
+                <listitem><para>
+                  Generate static deltas for all references. This generates from-empty and
+                  delta static files that allow for faster download.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--prune</option></term>
+
+                <listitem><para>
+                    Remove unreferenced objects in repo.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--prune-depth</option></term>
+
+                <listitem><para>
+                    Only keep at most this number of old versions for any particular ref. Default is -1 which means infinite.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-repo-contents</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-build.xml b/doc/flatpak-build.xml
new file mode 100644 (file)
index 0000000..a5fae02
--- /dev/null
@@ -0,0 +1,411 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-build">
+
+    <refentryinfo>
+        <title>flatpak build</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak build</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-build</refname>
+        <refpurpose>Build in a directory</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak build</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">DIRECTORY</arg>
+                <arg choice="opt">COMMAND <arg choice="opt" rep="repeat">ARG</arg></arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Runs a build command in a directory. <arg choice="plain">DIRECTORY</arg>
+            must have been initialized with <command>flatpak build-init</command>.
+        </para>
+        <para>
+            The sdk that is specified in the <filename>metadata</filename> file
+            in the directory is mounted at <filename>/usr</filename> and the
+            <filename>files</filename> and <filename>var</filename> subdirectories
+            are mounted at <filename>/app</filename> and <filename>/var</filename>,
+            respectively. They are writable, and their contents are preserved between
+            build commands, to allow accumulating build artifacts there.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-r</option></term>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Use the non-devel runtime that is specified in the application metadata instead of the devel runtime.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-p</option></term>
+                <term><option>--die-with-parent</option></term>
+
+                <listitem><para>
+                    Kill the build process and all children when the launching process dies.
+                </para></listitem>
+            </varlistentry>
+
+           <varlistentry>
+                <term><option>--bind-mount=DEST=SOURCE</option></term>
+
+                <listitem><para>
+                    Add a custom bind mount in the build namespace. Can be specified multiple times.
+                </para></listitem>
+            </varlistentry>
+
+           <varlistentry>
+                <term><option>--build-dir=PATH</option></term>
+
+                <listitem><para>
+                    Start the build in this directory (default is in the current directory).
+                </para></listitem>
+            </varlistentry>
+
+           <varlistentry>
+                <term><option>--share=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--unshare=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Don't share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--socket=SOCKET</option></term>
+
+                <listitem><para>
+                    Expose a well-known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nosocket=SOCKET</option></term>
+
+                <listitem><para>
+                    Don't expose a well-known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--device=DEVICE</option></term>
+
+                <listitem><para>
+                    Expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nodevice=DEVICE</option></term>
+
+                <listitem><para>
+                    Don't expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--allow=FEATURE</option></term>
+
+                <listitem><para>
+                    Allow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                 </para><para>
+                    The <code>devel</code> feature allows the application to
+                    access certain syscalls such as <code>ptrace()</code>, and
+                <code>perf_event_open()</code>.
+                </para><para>
+                    The <code>multiarch</code> feature allows the application to
+                    execute programs compiled for an ABI other than the one supported
+                    natively by the system. For example, for the <code>x86_64</code>
+                    architecture, 32-bit <code>x86</code> binaries will be allowed as
+                    well.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disallow=FEATURE</option></term>
+
+                <listitem><para>
+                    Disallow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--filesystem=FILESYSTEM[:ro|:create]</option></term>
+
+                <listitem><para>
+                    Allow the application access to a subset of the filesystem.
+                    This overrides to the Context section from the application metadata.
+                    FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos, xdg-run,
+                    xdg-config, xdg-cache, xdg-data, an absolute path, or a homedir-relative
+                    path like ~/dir or paths relative to the xdg dirs, like xdg-download/subdir.
+                    The optional :ro suffix indicates that the location will be read-only.
+                    The optional :create suffix indicates that the location will be read-write and created if it doesn't exist.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nofilesystem=FILESYSTEM</option></term>
+
+                <listitem><para>
+                    Remove access to the specified subset of the filesystem from
+                    the application. This overrides to the Context section from the
+                    application metadata.
+                    FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos,
+                    an absolute path, or a homedir-relative path like ~/dir.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--with-appdir</option></term>
+
+                <listitem><para>
+                  Expose and configure access to the per-app storage directory in $HOME/.var/app. This is
+                  not normally useful when building, but helps when testing built apps.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--add-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Add generic policy option. For example, "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would map to this metadata:
+<programlisting>
+[Policy subsystem]
+key=v1;v2;
+</programlisting>
+                </para></listitem>
+                <listitem><para>
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--remove-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Remove generic policy option. This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--env=VAR=VALUE</option></term>
+
+                <listitem><para>
+                    Set an environment variable in the application.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well-known name NAME on the session bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well-known name NAME on the session bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well-known name NAME on the system bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well-known name NAME on the system bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--persist=FILENAME</option></term>
+
+                <listitem><para>
+                    If the application doesn't have access to the real homedir, make the (homedir-relative) path
+                    FILENAME a bind mount to the corresponding path in the per-application directory,
+                    allowing that location to be used for persistent data.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--sdk-dir=DIR</option></term>
+
+                <listitem><para>
+                  Normally if there is a <filename>usr</filename> directory in the build dir, this is used
+                  for the runtime files (this can be created by --writable-sdk or --type=runtime arguments
+                  to build-init). If you specify --sdk-dir this directoryname will be used instead.
+                  Use this if you passed --sdk-dir to build-init.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--readonly</option></term>
+
+                <listitem><para>
+                  Mount the normally writable destination directories read-only. This can
+                  be useful if you want to run something in the sandbox but guarantee that
+                  it doesn't affect the build results. For example tests.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--metadata=FILE</option></term>
+
+                <listitem><para>
+                  Use the specified filename as metadata in the exported app instead of
+                  the default file (called <filename>metadata</filename>). This is useful
+                  if you build multiple things from a single build tree (such as both a
+                  platform and a sdk).
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--log-session-bus</option></term>
+
+                <listitem><para>
+                    Log session bus traffic. This can be useful to see what access you need to allow in
+                    your D-Bus policy.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--log-system-bus</option></term>
+
+                <listitem><para>
+                    Log system bus traffic. This can be useful to see what access you need to allow in
+                    your D-Bus policy.
+                </para></listitem>
+            </varlistentry>
+
+          </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak build /build/my-app rpmbuild my-app.src.rpm</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-config.xml b/doc/flatpak-config.xml
new file mode 100644 (file)
index 0000000..725de54
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-config">
+
+    <refentryinfo>
+        <title>flatpak config</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak config</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-config</refname>
+        <refpurpose>Manage configuration</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak config</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">KEY</arg>
+                <arg choice="plain">VALUE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Show and modify current configuration
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--list</option></term>
+
+                <listitem><para>
+                    Print all keys and their values
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--set</option></term>
+
+                <listitem><para>
+                    Set key KEY to VALUE
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--unset</option></term>
+
+                <listitem><para>
+                    Unset key KEY
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--get</option></term>
+
+                <listitem><para>
+                  Print value of KEY.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Configure per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Configure system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Configure the system-wide installation
+                    specified by <arg choice="plain">NAME</arg> among those defined in
+                    <filename>/etc/flatpak/installations.d/</filename>. Using
+                    <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak config --set language sv;en;fi</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-docs.xml.in b/doc/flatpak-docs.xml.in
new file mode 100644 (file)
index 0000000..d3a20c2
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
+]>
+<reference xmlns:xi="http://www.w3.org/2003/XInclude">
+    <referenceinfo>
+      <releaseinfo>Version @VERSION@</releaseinfo>
+    </referenceinfo>
+    <title>Flatpak Command Reference</title>
+    <partintro>
+      <para>
+        Flatpak comes with a rich commandline interface.
+      </para>
+    </partintro>
+    <chapter>
+      <title>Executables</title>
+      <xi:include href="@srcdir@/flatpak.xml"/>
+    </chapter>
+    <chapter>
+      <title>Commands</title>
+      <xi:include href="@srcdir@/flatpak-build-bundle.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-commit-from.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-export.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-finish.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-import-bundle.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-init.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-sign.xml"/>
+      <xi:include href="@srcdir@/flatpak-build-update-repo.xml"/>
+      <xi:include href="@srcdir@/flatpak-build.xml"/>
+      <xi:include href="@srcdir@/flatpak-config.xml"/>
+      <xi:include href="@srcdir@/flatpak-document-export.xml"/>
+      <xi:include href="@srcdir@/flatpak-document-info.xml"/>
+      <xi:include href="@srcdir@/flatpak-document-list.xml"/>
+      <xi:include href="@srcdir@/flatpak-document-unexport.xml"/>
+      <xi:include href="@srcdir@/flatpak-enter.xml"/>
+      <xi:include href="@srcdir@/flatpak-info.xml"/>
+      <xi:include href="@srcdir@/flatpak-install.xml"/>
+      <xi:include href="@srcdir@/flatpak-list.xml"/>
+      <xi:include href="@srcdir@/flatpak-make-current.xml"/>
+      <xi:include href="@srcdir@/flatpak-override.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote-add.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote-delete.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote-info.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote-ls.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote-modify.xml"/>
+      <xi:include href="@srcdir@/flatpak-remotes.xml"/>
+      <xi:include href="@srcdir@/flatpak-repo.xml"/>
+      <xi:include href="@srcdir@/flatpak-run.xml"/>
+      <xi:include href="@srcdir@/flatpak-search.xml"/>
+      <xi:include href="@srcdir@/flatpak-uninstall.xml"/>
+      <xi:include href="@srcdir@/flatpak-update.xml"/>
+    </chapter>
+    <chapter>
+      <title>File Formats</title>
+      <xi:include href="@srcdir@/flatpak-flatpakrepo.xml"/>
+      <xi:include href="@srcdir@/flatpak-flatpakref.xml"/>
+      <xi:include href="@srcdir@/flatpak-installation.xml"/>
+      <xi:include href="@srcdir@/flatpak-metadata.xml"/>
+      <xi:include href="@srcdir@/flatpak-remote.xml"/>
+    </chapter>
+</reference>
diff --git a/doc/flatpak-document-export.xml b/doc/flatpak-document-export.xml
new file mode 100644 (file)
index 0000000..286ccf8
--- /dev/null
@@ -0,0 +1,226 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-document-export">
+
+    <refentryinfo>
+        <title>flatpak document-export</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak document-export</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-document-export</refname>
+        <refpurpose>Export a file to a sandboxed application</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak document-export</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">FILE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Creates a document id for a local file that can be exposed to
+            sandboxed applications, allowing them access to files that they
+            would not otherwise see. The exported files are exposed in a
+            fuse filesystem at /run/user/$UID/doc/.
+        </para>
+
+        <para>
+            This command also lets you modify the per-application
+            permissions of the documents, granting or revoking access
+            to the file on a per-application basis.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-u</option></term>
+                <term><option>--unique</option></term>
+
+                <listitem><para> Don't reuse an existing document id
+                for the file.  This makes it safe to later remove the
+                document when you're finished with it.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-t</option></term>
+                <term><option>--transient</option></term>
+
+                <listitem><para>
+                  The document will only exist for the length of
+                  the session. This is useful for temporary grants.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-n</option></term>
+                <term><option>--noexist</option></term>
+
+                <listitem><para>
+                  Don't require the file to exist already.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-a</option></term>
+                <term><option>--app=APPID</option></term>
+
+                <listitem><para>
+                  Grant read access to the specified application. The
+                  --allow and --forbid options can be used to grant
+                  or remove additional privileges.
+                  This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-r</option></term>
+                <term><option>--allow-read</option></term>
+
+                <listitem><para>
+                  Grant read access to the applications specified with --app.
+                  This defaults to TRUE.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--forbid-read</option></term>
+
+                <listitem><para>
+                  Revoke read access for the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-w</option></term>
+                <term><option>--allow-write</option></term>
+
+                <listitem><para>
+                  Grant write access to the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--forbid-write</option></term>
+
+                <listitem><para>
+                  Revoke write access for the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-d</option></term>
+                <term><option>--allow-delete</option></term>
+
+                <listitem><para>
+                  Grant the ability to remove the document from the document portal to the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--forbid-delete</option></term>
+
+                <listitem><para>
+                  Revoke the ability to remove the document from the document portal from the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-g</option></term>
+                <term><option>--allow-grant-permission</option></term>
+
+                <listitem><para>
+                  Grant the ability to grant further permissions to the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--forbid-grant-permission</option></term>
+
+                <listitem><para>
+                  Revoke the ability to grant further permissions for the applications specified with --app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak document-export --app=org.gnome.GEdit ~/test.txt</command>
+        </para>
+<programlisting>
+/run/user/1000/doc/e52f9c6a/test.txt
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-unexport</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-info</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
+
diff --git a/doc/flatpak-document-info.xml b/doc/flatpak-document-info.xml
new file mode 100644 (file)
index 0000000..14f0042
--- /dev/null
@@ -0,0 +1,116 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-document-info">
+
+    <refentryinfo>
+        <title>flatpak document-info</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak document-info</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-document-info</refname>
+        <refpurpose>Show information about exported files</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak document-info</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">FILE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Shows information about an exported file, such as the
+            document id, the fuse path, the original location in the
+            filesystem, and the per-application permissions.
+        </para>
+        <para>
+            FILE can either be a file in the fuse filesystem at /run/user/$UID/doc/,
+            or a file anywhere else.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak document-info ~/Sources/gtk/gail-3.0.pc</command>
+        </para>
+<programlisting>
+id: dd32c34a
+path: /run/user/1000/doc/dd32c34a/gail-3.0.pc
+origin: /home/mclasen/Sources/gtk/gail-3.0.pc
+permissions:
+        org.gnome.gedit read, write
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-unexport</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-document-list.xml b/doc/flatpak-document-list.xml
new file mode 100644 (file)
index 0000000..e4b191d
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-document-list">
+
+    <refentryinfo>
+        <title>flatpak document-list</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak document-list</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-document-list</refname>
+        <refpurpose>List exported files</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak document-list</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">APPID</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Lists exported files, with their document id and the
+            full path to their origin. If an APPID is specified,
+            only the files exported to this app are listed.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-unexport</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-info</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-document-unexport.xml b/doc/flatpak-document-unexport.xml
new file mode 100644 (file)
index 0000000..4b36aca
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-document-unexport">
+
+    <refentryinfo>
+        <title>flatpak document-unexport</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak document-unexport</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-document-unexport</refname>
+        <refpurpose>Stop exporting a file</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak document-export</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">FILE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Removes the document id for the file from the
+            document portal. This will make the document unavailable
+            to all sandboxed applications.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-export</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-info</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-document-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-enter.xml b/doc/flatpak-enter.xml
new file mode 100644 (file)
index 0000000..6613a34
--- /dev/null
@@ -0,0 +1,113 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-enter">
+
+    <refentryinfo>
+        <title>flatpak enter</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak enter</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-enter</refname>
+        <refpurpose>Enter an application</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak enter</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">MONITORPID</arg>
+                <arg choice="plain">COMMAND</arg>
+                <arg choice="opt" rep="repeat">ARG</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Enter a running sandbox.
+            <arg choice="plain">SANDBOXEDPID</arg> must be the pid of a process running in a flatpak sandbox.
+            <arg choice="plain">COMMAND</arg> is the command to run in the sandbox.
+            Extra arguments are passed on to the command.
+        </para>
+        <para>
+            This creates a new process within the running sandbox, with the same environment. This is useful
+            when you want to debug a problem with a running application.
+        </para>
+        <para>
+            This command requires extra privileges, so must be run as root or via e.g. sudo.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak enter 15345 sh</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-flatpakref.xml b/doc/flatpak-flatpakref.xml
new file mode 100644 (file)
index 0000000..a8d2854
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-flatpakref">
+
+    <refentryinfo>
+        <title>flatpakref</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpakref</refentrytitle>
+        <manvolnum>5</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-flatpakref</refname>
+        <refpurpose>Reference to a remote for an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Flatpak uses flatpakref files to share information about a remote for
+            a single application. The <filename>flatpakref</filename> file contains
+            enough information to add the remote and install the application.
+            Use the <command>flatpak install --from</command> command to do so.
+        </para>
+
+        <para>
+            flatpakref files may also contain additional information that is useful
+            when displaying the application to the user, e.g. in an app store.
+        </para>
+
+        <para>
+           The filename extension commonly used for flatpakref files is <filename>.flatpakref</filename>.
+        </para>
+
+        <para>
+           A flatpakref file can also refer to a remote for a runtime.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>File format</title>
+
+        <para>
+            The flatpakref file is using the same .ini file format that is used for
+            systemd unit files or application .desktop files.
+        </para>
+
+        <refsect2>
+            <title>[Flatpak Ref]</title>
+
+            <para>
+                All the information is contained in the [Flatpak Ref] group.
+            </para>
+            <para>
+                The following keys can be present in this group:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>Version</option> (uint64)</term>
+                    <listitem><para>The version of the file format, must be 1 if present.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Name</option> (string)</term>
+                    <listitem><para>The fully qualified name of the runtime that is used by the application. This key is mandatory.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Url</option> (string)</term>
+                    <listitem><para>The url for the remote. This key is mandatory.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Branch</option> (string)</term>
+                    <listitem><para>The name of the branch from which to install the application or runtime. If this key is not specified, the "master" branch is used.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Title</option> (string)</term>
+                    <listitem><para>The title of the application or runtime. This should be a user-friendly name that can be displayed e.g. in an app store.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Comment</option> (string)</term>
+                    <listitem><para>A short summary of the application or runtime, for display e.g. in an app store.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Description</option> (string)</term>
+                    <listitem><para>A longer description of the application or runtime, for display e.g. in an app store..</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Icon</option> (string)</term>
+                    <listitem><para>The url for an icon that can be used to represent the application or runtime.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Homepage</option> (string)</term>
+                    <listitem><para>The url of a webpage describing the application or runtime.</para></listitem>
+                </varlistentry>
+                <!--
+                FIXME: Uncomment this when P2P support is made unconditional on enable-p2p.
+                <varlistentry>
+                    <term><option>CollectionID</option> (string)</term>
+                    <listitem><para>The collection ID of the remote, if it has one. This uniquely identifies the collection of apps in the remote, to allow peer to peer redistribution.</para></listitem>
+                </varlistentry>
+                -->
+
+                <varlistentry>
+                    <term><option>IsRuntime</option> (boolean)</term>
+                    <listitem><para>Whether this file refers to a runtime. If this key is not specified, the file is assumed to refer to an application.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>GPGKey</option> (string)</term>
+                    <listitem><para>The base64-encoded gpg key for the remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>RuntimeRepo</option> (string)</term>
+                    <listitem><para>The url for a .flatpakref file for the runtime.</para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+    </refsect1>
+
+    <refsect1>
+        <title>Example</title>
+<programlisting>
+[Flatpak Ref]
+Title=GEdit
+Name=org.gnome.gedit
+Branch=stable
+Url=http://sdk.gnome.org/repo-apps/
+IsRuntime=False
+GPGKey=mQENBFUUCGcBCAC/K9WeV4xCaKr3NKRqPXeY5mpaXAJyasLqCtrDx92WUgbu0voWrhohNAKpqizod2dvzc/XTxm3rHyIxmNfdhz1gaGhynU75Qw4aJVcly2eghTIl++gfDtOvrOZo/VuAq30f32dMIgHQdRwEpgCwz7WyjpqZYltPAEcCNL4MTChAfiHJeeiQ5ibystNBW8W6Ymf7sO4m4g5+/aOxI54oCOzD9TwBAe+yXcJJWtc2rAhMCjtyPJzxd0ZVXqIzCe1xRvJ6Rq7YCiMbiM2DQFWXKnmYQbj4TGNMnwNdAajCdrcBWEMSbzq7EzuThIJRd8Ky4BkEe1St6tuqwFaMZz+F9eXABEBAAG0KEdub21lIFNESyAzLjE2IDxnbm9tZS1vcy1saXN0QGdub21lLm9yZz6JATgEEwECACIFAlUUCGcCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEArkz6VV0VKBa5cH/0vXa31YgEjNk78gGFXqnQxdD1WYA87OYxDi189l4lA802EFTF4wCBuZyDOqdd5BhS3Ab0cR778DmZXRUP2gwe+1zTJypU2JMnDpkwJ4NK1VP6/tE4SAPrznBtmb76BKaWBqUfZ9Wq1zg3ugvqkZB/Exq+usypIOwQVp1KL58TrjBRda0HvRctzkNhr0qYAtkfLFe0GvksBp4vBm8uGwAx7fw/HbhIjQ9pekTwvB+5GwDPO/tSip/1bQfCS+XJB8Ffa04HYPLGedalnWBrwhYY+G/kn5Zh9L/AC8xeLwTJTHM212rBjPa9CWs9C6a57MSaeGIEHLC1hEyiJJ15w8jmY=
+</programlisting>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            <citerefentry><refentrytitle>flatpak-flatpakrepo</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-flatpakrepo.xml b/doc/flatpak-flatpakrepo.xml
new file mode 100644 (file)
index 0000000..675c0b5
--- /dev/null
@@ -0,0 +1,142 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-flatpakrepo">
+
+    <refentryinfo>
+        <title>flatpakrepo</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpakrepo</refentrytitle>
+        <manvolnum>5</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-flatpakrepo</refname>
+        <refpurpose>Reference to a remote</refpurpose>
+    </refnamediv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Flatpak uses flatpakrepo files to share information about remotes.
+            The <filename>flatpakrepo</filename> file contains enough information
+            to add the remote. Use the <command>flatpak remote-add --from</command>
+            command to do so.
+        </para>
+
+        <para>
+            flatpakrepo files may also contain additional information that is useful
+            when displaying a remote to the user, e.g. in an app store.
+        </para>
+
+        <para>
+           The filename extension commonly used for flatpakrepo files is <filename>.flatpakrepo</filename>.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>File format</title>
+
+        <para>
+            The flatpakrepo file is using the same .ini file format that is used for
+            systemd unit files or application .desktop files.
+        </para>
+
+        <refsect2>
+            <title>[Flatpak Repo]</title>
+
+            <para>
+                All the information is contained in the [Flatpak Repo] group.
+            </para>
+            <para>
+                The following keys can be present in this group:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>Version</option> (uint64)</term>
+                    <listitem><para>The version of the file format, must be 1 if present.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Url</option> (string)</term>
+                    <listitem><para>The url for the remote. This key is mandatory.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>GPGKey</option> (string)</term>
+                    <listitem><para>The base64-encoded gpg key for the remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>DefaultBranch</option> (string)</term>
+                    <listitem><para>The default branch to use for this remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Title</option> (string)</term>
+                    <listitem><para>The title of the remote. This should be a user-friendly name that can be displayed e.g. in an app store.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Comment</option> (string)</term>
+                    <listitem><para>A short summary of the remote, for display e.g. in an app store.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Description</option> (string)</term>
+                    <listitem><para>A longer description of the remote, for display e.g. in an app store..</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Icon</option> (string)</term>
+                    <listitem><para>The url for an icon that can be used to represent the remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Homepage</option> (string)</term>
+                    <listitem><para>The url of a webpage describing the remote.</para></listitem>
+                </varlistentry>
+                <!--
+                FIXME: Uncomment this when P2P support is made unconditional on enable-p2p.
+                <varlistentry>
+                    <term><option>CollectionID</option> (string)</term>
+                    <listitem><para>The collection ID of the remote, if it has one. This uniquely identifies the collection of apps in the remote, to allow peer to peer redistribution.</para></listitem>
+                </varlistentry>
+                -->
+            </variablelist>
+        </refsect2>
+    </refsect1>
+
+    <refsect1>
+        <title>Example</title>
+<programlisting>
+[Flatpak Repo]
+Title=GEdit
+Url=http://sdk.gnome.org/repo-apps/
+GPGKey=mQENBFUUCGcBCAC/K9WeV4xCaKr3NKRqPXeY5mpaXAJyasLqCtrDx92WUgbu0voWrhohNAKpqizod2dvzc/XTxm3rHyIxmNfdhz1gaGhynU75Qw4aJVcly2eghTIl++gfDtOvrOZo/VuAq30f32dMIgHQdRwEpgCwz7WyjpqZYltPAEcCNL4MTChAfiHJeeiQ5ibystNBW8W6Ymf7sO4m4g5+/aOxI54oCOzD9TwBAe+yXcJJWtc2rAhMCjtyPJzxd0ZVXqIzCe1xRvJ6Rq7YCiMbiM2DQFWXKnmYQbj4TGNMnwNdAajCdrcBWEMSbzq7EzuThIJRd8Ky4BkEe1St6tuqwFaMZz+F9eXABEBAAG0KEdub21lIFNESyAzLjE2IDxnbm9tZS1vcy1saXN0QGdub21lLm9yZz6JATgEEwECACIFAlUUCGcCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEArkz6VV0VKBa5cH/0vXa31YgEjNk78gGFXqnQxdD1WYA87OYxDi189l4lA802EFTF4wCBuZyDOqdd5BhS3Ab0cR778DmZXRUP2gwe+1zTJypU2JMnDpkwJ4NK1VP6/tE4SAPrznBtmb76BKaWBqUfZ9Wq1zg3ugvqkZB/Exq+usypIOwQVp1KL58TrjBRda0HvRctzkNhr0qYAtkfLFe0GvksBp4vBm8uGwAx7fw/HbhIjQ9pekTwvB+5GwDPO/tSip/1bQfCS+XJB8Ffa04HYPLGedalnWBrwhYY+G/kn5Zh9L/AC8xeLwTJTHM212rBjPa9CWs9C6a57MSaeGIEHLC1hEyiJJ15w8jmY=
+<!--
+FIXME: Uncomment this when P2P support is made unconditional on enable-p2p.
+CollectionID=org.gnome.Apps
+-->
+</programlisting>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-remote-add</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-flatpakref</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-info.xml b/doc/flatpak-info.xml
new file mode 100644 (file)
index 0000000..e35e1e3
--- /dev/null
@@ -0,0 +1,203 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-info">
+
+    <refentryinfo>
+        <title>flatpak info</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak info</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-info</refname>
+        <refpurpose>Show information about installed application and/or runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak info</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">NAME</arg>
+                <arg choice="opt">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Show info about and installed application and/or runtime.
+        </para>
+        <para>
+            By default, the output is formatted in a friendly format.
+            If you specify one of the options --show-ref, --show-commit,
+            --show-origin, --show-metadata or --show-size, the output is instead formatted
+            in a machine-readable format.
+        </para>
+        <para>
+            By default, both per-user and system-wide installations
+            are queried. Use the --user, --system or --installation
+            options to change this.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Query per-user installations.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Query the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Query a system-wide installation by <arg choice="plain">NAME</arg> among
+                    those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    Query for this architecture.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-r</option></term>
+                <term><option>--show-ref</option></term>
+
+                <listitem><para>
+                    Show the installed ref.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-o</option></term>
+                <term><option>--show-origin</option></term>
+
+                <listitem><para>
+                    Show the remote the ref is installed from.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-c</option></term>
+                <term><option>--show-commit</option></term>
+
+                <listitem><para>
+                    Show the installed commit id.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-s</option></term>
+                <term><option>--show-size</option></term>
+
+                <listitem><para>
+                    Show the installed size.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-m</option></term>
+                <term><option>--show-metadata</option></term>
+
+                <listitem><para>
+                    Show the metadata.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-e</option></term>
+                <term><option>--show-extensions</option></term>
+
+                <listitem><para>
+                    Show the matching extensions.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak info org.gnome.Builder//master</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-install.xml b/doc/flatpak-install.xml
new file mode 100644 (file)
index 0000000..1dc5180
--- /dev/null
@@ -0,0 +1,302 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-install">
+
+    <refentryinfo>
+        <title>flatpak install</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak install</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-install</refname>
+        <refpurpose>Install an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <para>Install from a configured remote:</para>
+            <cmdsynopsis>
+                <command>flatpak install</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">REMOTE-NAME</arg>
+                <arg choice="plain" rep="repeat">REF</arg>
+            </cmdsynopsis>
+            <para>Install from a .flatpakref file:</para>
+            <cmdsynopsis>
+                <command>flatpak install</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">--from</arg>
+                <arg choice="plain">LOCATION</arg>
+            </cmdsynopsis>
+            <para>Install from a .flatpak bundle:</para>
+            <cmdsynopsis>
+                <command>flatpak install</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">--bundle</arg>
+                <arg choice="plain">FILENAME</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+          Installs an application or runtime. The primary way to
+          install is to specify a <arg>REMOTE</arg>
+          name as the source and one ore more <arg>REF</arg>s to specify the
+          application or runtime to install.
+        </para>
+        <para>
+            Each <arg choice="plain">REF</arg> argument is a full or partial indentifier in the
+            flatpak ref format, which looks like "(app|runtime)/ID/ARCH/BRANCH". All elements
+            except ID are optional and can be left out, including the slashes,
+            so most of the time you need only specify ID. Any part left out will be matched
+            against what is in the remote, and if there are multiple matches an error message
+            will list the alternatives.
+        </para>
+        <para>
+            By default this looks for both apps and runtimes with the given <arg choice="plain">REF</arg> in
+            the specified <arg choice="plain">REMOTE</arg>, but you can limit this by using the --app or
+            --runtime option, or by supplying the initial element in the REF.
+        </para>
+        <para>
+            If <arg choice="plain">REMOTE</arg> is a uri or a path (absolute or relative starting with ./)
+            to a local repository, then that repository will be used as the source, and a temporary remote
+            will be created for the lifetime of the <arg choice="plain">REF</arg>.
+        </para>
+        <para>
+            The alternative form of the command (<arg>--from</arg> or
+            <arg>--bundle</arg> allows you to
+            install directly from a source such as a .flatpak
+            single-file bundle, a .flatpakref app description. The options are optional if the first
+            argument have the right extension.
+        </para>
+        <para>
+            Note that flatpak allows one to have multiple branches of an application and runtimes
+            installed and used at the same time. However, only version of an application one can be current,
+            meaning its exported files (for instance desktop files and icons) are
+            visible to the host. The last installed version is made current by
+            default, but you can manually change with make-current.
+        </para>
+        <para>
+            Unless overridden with the --user or the --installation option, this command installs
+            the application or runtime in the default system-wide installation.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--bundle</option></term>
+
+                <listitem><para>
+                  Assume LOCATION is a .flatpak single-bundle file.
+                  This is optional if the arguments ends with .flatpak.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--from</option></term>
+
+                <listitem><para>
+                  Assume LOCATION is a .flatpakref file containing the details of the app to be installed.
+                  This is optional if the arguments ends with .flatpakref.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Install the application or runtime in a per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Install the application or runtime in the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Install the application or runtime in a system-wide installation
+                    specified by <arg choice="plain">NAME</arg> among those defined in
+                    <filename>/etc/flatpak/installations.d/</filename>. Using
+                    <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The default architecture to install for, if not given explicitly in the <arg choice="plain">REF</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--subpath=PATH</option></term>
+
+                <listitem><para>
+                  Install only a subpath of the ref. This is mainly used to install a subset of locales.
+                  This can be added multiple times to install multiple subpaths.,
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-file=FILE</option></term>
+
+                <listitem><para>
+                  Check bundle signatures with GPG key from FILE (- for stdin).
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-deploy</option></term>
+
+                <listitem><para>
+                    Download the latest version, but don't deploy it.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-pull</option></term>
+
+                <listitem><para>
+                    Don't download the latest version, deploy whatever is locally available.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-related</option></term>
+
+                <listitem><para>
+                    Don't download related extensions, such as the locale data.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-deps</option></term>
+
+                <listitem><para>
+                    Don't verify runtime dependencies when installing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    Assume that all <arg choice="plain">REF</arg>s are apps if not explicitly specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+                <listitem><para>
+                    Assume that all <arg choice="plain">REF</arg>s are runtimes if not explicitly specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-y</option></term>
+                <term><option>--assumeyes</option></term>
+                <listitem><para>
+                    Automatically answer yes to all questions (or pick the most prioritized answer). This is useful for automation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak install gnome org.gnome.gedit2</command>
+        </para>
+        <para>
+            <command>$ flatpak --installation=default install gnome org.gnome.gedit2</command>
+        </para>
+        <para>
+            <command>$ flatpak --user install gnome org.gnome.gedit//3.22</command>
+        </para>
+        <para>
+            <command>$ flatpak --user install https://sdk.gnome.org/gedit.flatpakref</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-build-bundle</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-flatpakref</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-installation.xml b/doc/flatpak-installation.xml
new file mode 100644 (file)
index 0000000..b7b348d
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-installation">
+
+    <refentryinfo>
+        <title>flatpak installation</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak installation</refentrytitle>
+        <manvolnum>5</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-installation</refname>
+        <refpurpose>Configuration for an installation location</refpurpose>
+    </refnamediv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            flatpak can operate in system-wide or per-user mode. The system-wide data
+            is located in <filename>$prefix/var/lib/flatpak/</filename>, and the per-user data is in
+            <filename>$HOME/.local/share/flatpak/</filename>.
+        </para>
+
+        <para>
+            In addition to the default installation locations, more system-wide installations
+            can be defined via configuration files <filename>/etc/flatpak/installations.d/</filename>,
+            which must have the .conf extension and follow the format described below.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>File format</title>
+
+        <para>
+            The installation config file format is using the same .ini file format that is used
+            for systemd unit files or application .desktop files.
+        </para>
+
+        <refsect2>
+            <title>[Installation …]</title>
+            <para>
+                All the configuration for the the installation location with name NAME is contained
+                in the [Installation "NAME"] group.
+            </para>
+            <para>
+                The following keys are recognized:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>Path</option> (string)</term>
+                    <listitem><para>The path for this installation. This key is mandatory.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>DisplayName</option> (string)</term>
+                    <listitem><para>The name to use when showing this installation in the UI.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>Priority</option> (integer)</term>
+                    <listitem><para>A priority for this installation.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>StorageType</option> (string)</term>
+                    <listitem><para>The type of storage used for this installation. Possible values include: mmc, sdcard, harddisk.</para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+<programlisting>
+[Installation "extra"]
+Path=/location/of/sdcard
+DisplayName=Extra Installation
+StorageType=sdcard
+</programlisting>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-list.xml b/doc/flatpak-list.xml
new file mode 100644 (file)
index 0000000..053cc74
--- /dev/null
@@ -0,0 +1,193 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-list">
+
+    <refentryinfo>
+        <title>flatpak list</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak list</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-list</refname>
+        <refpurpose>List installed applications and/or runtimes</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak list</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Lists the names of the installed applications and/or runtime.
+        </para>
+        <para>
+            By default, both per-user and system-wide installations
+            are shown. Use the --user, --installation or --system
+            options to change this.
+        </para>
+        <para>
+            By default this lists both installed apps and runtime, but you can
+            change this by using the --app or --runtime option.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    List per-user installations.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    List the default system-wide installations.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    List a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    List installations for this architecture.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-d</option></term>
+                <term><option>--show-details</option></term>
+
+                <listitem><para>
+                    Show origin, sizes and other extra information.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    List applications.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    List runtimes.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--all</option></term>
+                <term><option>-a</option></term>
+
+                <listitem><para>
+                    List all installed runtimes, including locale and debug extensions. These are hidden by default.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user list</command>
+        </para>
+<programlisting>
+org.gnome.Builder
+org.freedesktop.glxgears
+org.gnome.MyApp
+org.gnome.GEdit
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-make-current.xml b/doc/flatpak-make-current.xml
new file mode 100644 (file)
index 0000000..cf66ed0
--- /dev/null
@@ -0,0 +1,148 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-make-current">
+
+    <refentryinfo>
+        <title>flatpak make-current</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak make-current</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-make-current</refname>
+        <refpurpose>Make a specific version of an app current</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak make-current</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">APP</arg>
+                <arg choice="plain">BRANCH</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Makes a particular branch of an application current. Only the current branch
+            of an app has its exported files (such as desktop files and icons) made visible
+            to the host.
+        </para>
+        <para>
+            When a new branch is installed it will automatically be made current, so this
+            command is often not needed.
+        </para>
+        <para>
+            Unless overridden with the --user or --installation options, this command
+            changes the default system-wide installation.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Update a per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Update the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Updates a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to install for.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user make-current org.gnome.GEdit 3.14</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-metadata.xml b/doc/flatpak-metadata.xml
new file mode 100644 (file)
index 0000000..122aec2
--- /dev/null
@@ -0,0 +1,795 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-metadata">
+
+    <refentryinfo>
+        <title>flatpak metadata</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak metadata</refentrytitle>
+        <manvolnum>5</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-metadata</refname>
+        <refpurpose>Information about an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Flatpak uses metadata files to describe applications and runtimes.
+            The <filename>metadata</filename> file for a deployed application or
+            runtime is placed in the toplevel deploy directory. For example, the
+            metadata for the locally installed application org.gnome.Calculator
+            is in
+            <filename>~/.local/share/flatpak/app/org.gnome.Calculator/current/active/metadata</filename>.
+        </para>
+
+        <para>
+            Most aspects of the metadata configuration can be overridden when
+            launching applications, either temporarily via options of the flatpak
+            run command, or permanently with the flatpak override command.
+        </para>
+
+        <para>
+            A metadata file describing the effective configuration is available
+            inside the running sandbox at <filename>/.flatpak-info</filename>.
+            For compatibility with older Flatpak versions,
+            <filename>/run/user/$UID/flatpak-info</filename> is a symbolic
+            link to the same file.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>File format</title>
+
+        <para>
+            The metadata file is using the same .ini file format that is used for
+            systemd unit files or application .desktop files.
+        </para>
+
+        <refsect2>
+            <title>[Application] or [Runtime]</title>
+
+            <para>
+                Metadata for applications starts with an [Application] group,
+                metadata for runtimes with a [Runtime] group.
+            </para>
+            <para>
+                The following keys can be present in these groups:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>name</option> (string)</term>
+                    <listitem><para>The name of the application or runtime. This key is mandatory.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>runtime</option> (string)</term>
+                    <listitem><para>The fully qualified name of the runtime that is used by the application. This key is mandatory for applications.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>sdk</option> (string)</term>
+                    <listitem>
+                      <para>
+                        The fully qualified name of the sdk that matches the
+                        runtime. Available since 0.1.</para>
+                    </listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>command</option> (string)</term>
+                    <listitem>
+                      <para>
+                        The command to run. Only relevant for applications.
+                        Available since 0.1.
+                      </para>
+                    </listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>required-flatpak</option> (string)</term>
+                    <listitem><para>
+                        The required version of Flatpak to run this application
+                        or runtime. For applications, this was available since
+                        0.8.0. For runtimes, this was available since 0.9.1,
+                        and backported to 0.8.3 for the 0.8.x branch.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>tags</option> (string list)</term>
+                    <listitem><para>
+                        Tags to include in AppStream XML.
+                        Available since 0.4.12.
+                        <!-- TODO: what are these tags for? What should they
+                        be? -->
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[Context]</title>
+            <para>
+                This group determines various system resources that may be shared
+                with the application when it is run in a flatpak sandbox.
+            </para>
+            <para>
+                All keys in this group (and the group itself) are optional.
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>shared</option> (list)</term>
+                    <listitem><para>
+                        List of subsystems to share with the host system.
+                        Possible subsystems: network, ipc.
+                        Available since 0.3.
+                    </para></listitem>
+                </varlistentry>
+
+                <varlistentry>
+                    <term><option>sockets</option> (list)</term>
+                    <listitem><para>
+                        List of well-known sockets to make available in the sandbox.
+                        Possible sockets: x11, wayland, pulseaudio, session-bus, system-bus.
+                        When making a socket available, flatpak also sets
+                        well-known environment variables like DISPLAY or
+                        DBUS_SYSTEM_BUS_ADDRESS to let the application
+                        find sockets that are not in a fixed location.
+                        Available since 0.3.
+                    </para></listitem>
+                </varlistentry>
+
+                <varlistentry>
+                    <term><option>devices</option> (list)</term>
+                    <listitem><para>
+                        List of devices to make available in the sandbox.
+                        Possible values:
+                        <variablelist>
+
+                            <varlistentry><term><option>dri</option></term>
+                            <listitem><para>
+                                Graphics direct rendering
+                                (<filename>/dev/dri</filename>).
+                                Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>kvm</option></term>
+                            <listitem><para>
+                                Virtualization
+                                (<filename>/dev/kvm</filename>).
+                                Available since 0.6.12.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>all</option></term>
+                            <listitem><para>
+                                All device nodes in <filename>/dev</filename>.
+                                Available since 0.6.6.
+                            </para></listitem></varlistentry>
+
+                        </variablelist>
+                    </para></listitem>
+                </varlistentry>
+
+                <varlistentry>
+                    <term><option>filesystems</option> (list)</term>
+                    <listitem><para>
+                        List of filesystem subsets to make available to the
+                        application. Possible values:
+                        <variablelist>
+
+                            <varlistentry><term><option>home</option></term>
+                            <listitem><para>
+                                The entire home directory.
+                                Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>host</option></term>
+                            <listitem><para>
+                                The entire host file system, except for
+                                directories that are handled specially by
+                                Flatpak.
+                                In particular, this shares
+                                <filename>/home</filename>,
+                                <filename>/media</filename>,
+                                <filename>/opt</filename>,
+                                <filename>/run/media</filename> and
+                                <filename>/srv</filename> if they exist.
+                            </para>
+                            <para>
+                                <filename>/dev</filename> is not shared:
+                                use <option>devices=all;</option> instead.
+                            </para>
+                            <para>
+                                Parts of <filename>/sys</filename> are always
+                                shared. This option does not make additional
+                                files in /sys available.
+                            </para>
+                            <para>
+                                These other reserved directories are
+                                currently excluded:
+                                <filename>/app</filename>,
+                                <filename>/bin</filename>,
+                                <filename>/boot</filename>,
+                                <filename>/etc</filename>,
+                                <filename>/lib</filename>,
+                                <filename>/lib32</filename>,
+                                <filename>/lib64</filename>,
+                                <filename>/proc</filename>,
+                                <filename>/root</filename>,
+                                <filename>/run</filename>,
+                                <filename>/sbin</filename>,
+                                <filename>/tmp</filename>,
+                                <filename>/usr</filename>,
+                                <filename>/var</filename>.
+                            </para>
+                            <para>
+                                Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>xdg-desktop</option>,
+                                <option>xdg-documents</option>,
+                                <option>xdg-download</option>,
+                                <option>xdg-music</option>,
+                                <option>xdg-pictures</option>,
+                                <option>xdg-public-share</option>,
+                                <option>xdg-videos</option>,
+                                <option>xdg-templates</option>
+                            </term><listitem><para>
+                                <ulink url="https://www.freedesktop.org/wiki/Software/xdg-user-dirs/"
+                                  >freedesktop.org special directories</ulink>.
+                                Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>xdg-desktop/<replaceable>path</replaceable></option>,
+                                <option>xdg-documents/<replaceable>path</replaceable></option>,
+                                etc.
+                            </term><listitem><para>
+                                Subdirectories of freedesktop.org special
+                                directories. Available since 0.4.13.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                <option>xdg-cache</option>,
+                                <option>xdg-config</option>,
+                                <option>xdg-data</option>
+                            </term><listitem><para>
+                                Directories defined by the
+                                <ulink url="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html"
+                                  >freedesktop.org Base Directory
+                                  Specification</ulink>.
+                                Available since 0.6.14.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                <option>xdg-cache/<replaceable>path</replaceable></option>,
+                                <option>xdg-config/<replaceable>path</replaceable></option>,
+                                <option>xdg-data/<replaceable>path</replaceable></option>
+                            </term><listitem><para>
+                                Subdirectories of directories defined by the
+                                freedesktop.org Base Directory Specification.
+                                Available since 0.6.14.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                <option>xdg-run/<replaceable>path</replaceable></option>
+                            </term><listitem><para>
+                                Subdirectories of the
+                                <envar>XDG_RUNTIME_DIR</envar> defined by
+                                the
+                                <ulink url="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html"
+                                  >freedesktop.org Base Directory
+                                  Specification</ulink>. Note that
+                                <option>xdg-run</option> on its own is not
+                                supported. Available since 0.4.13.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                <option>/<replaceable>path</replaceable></option>
+                            </term><listitem><para>
+                                An arbitrary absolute path. Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                <option>~/<replaceable>path</replaceable></option>
+                            </term><listitem><para>
+                                An arbitrary path relative to the home
+                                directory. Available since 0.3.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                One of the above followed by
+                                <option>:ro</option>
+                            </term><listitem><para>
+                                Make the given directory available read-only.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                One of the above followed by
+                                <option>:rw</option>
+                            </term><listitem><para>
+                                Make the given directory available read/write.
+                                This is the default.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term>
+                                One of the above followed by
+                                <option>:create</option>
+                            </term><listitem><para>
+                                Make the given directory available read/write,
+                                and create it if it does not already exist.
+                            </para></listitem></varlistentry>
+
+                        </variablelist>
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>persistent</option> (list)</term>
+                    <listitem><para>
+                      List of homedir-relative paths to make available at
+                      the corresponding path in the per-application home directory,
+                      allowing the locations to be used for persistent data when
+                      the application does not have access to the real homedir.
+                      For instance making ".myapp" persistent would make "~/.myapp"
+                      in the sandbox a bind mount to "~/.var/app/org.my.App/.myapp",
+                      thus allowing an unmodified application to save data in
+                      the per-application location. Available since 0.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>features</option> (list)</term>
+                    <listitem><para>
+                        List of features available or unavailable to the
+                        application, currently from the following list:
+                        <variablelist>
+
+                            <varlistentry><term><option>devel</option></term>
+                            <listitem><para>
+                                Allow system calls used by development-oriented
+                                tools such as <command>perf</command>,
+                                <command>strace</command> and
+                                <command>gdb</command>.
+                                Available since 0.6.10.
+                            </para></listitem></varlistentry>
+
+                            <varlistentry><term><option>multiarch</option></term>
+                            <listitem><para>
+                                Allow running multilib/multiarch binaries, for
+                                example <literal>i386</literal> binaries in an
+                                <literal>x86_64</literal> environment.
+                                Available since 0.6.12.
+                            </para></listitem></varlistentry>
+
+                        </variablelist>
+                        A feature can be prefixed with <option>!</option> to
+                        indicate the absence of that feature, for example
+                        <option>!devel</option> if development and debugging
+                        are not allowed.
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[Instance]</title>
+            <para>
+                This group only appears in <filename>/.flatpak-info</filename>
+                for a running app, and not in the metadata files written by
+                application authors. It is filled in by Flatpak itself.
+            </para>
+            <!-- In versions prior to 0.6.10 some of this information was
+            in [Application], but for simplicity that isn't documented
+            here. -->
+            <variablelist>
+                <varlistentry>
+                    <term><option>app-path</option> (string)</term>
+                    <listitem><para>
+                        The absolute path on the host system of the app's
+                        app files, as mounted at <filename>/app</filename>
+                        inside the container. Available since 0.6.10.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>branch</option> (string)</term>
+                    <listitem><para>
+                        The branch of the app, for example
+                        <literal>stable</literal>. Available since
+                        0.6.10.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>flatpak-version</option> (string)</term>
+                    <listitem><para>
+                        The version number of the Flatpak version that ran
+                        this app. Available since 0.6.11.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>runtime-path</option> (string)</term>
+                    <listitem><para>
+                        The absolute path on the host system of the app's
+                        runtime files, as mounted at <filename>/usr</filename>
+                        inside the container. Available since 0.6.10.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>session-bus-proxy</option> (boolean)</term>
+                    <listitem><para>
+                        True if this app cannot access the D-Bus session bus
+                        directly (either it goes via a proxy, or it cannot
+                        access the session bus at all). Available since 0.8.0.
+                        <!-- TODO: Those semantics are weird, are they
+                        intended? -->
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>system-bus-proxy</option> (boolean)</term>
+                    <listitem><para>
+                        True if this app cannot access the D-Bus system bus
+                        directly (either it goes via a proxy, or it cannot
+                        access the system bus at all). Available since 0.8.0.
+                        <!-- TODO: Those semantics are weird, are they
+                        intended? -->
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[Session Bus Policy]</title>
+            <para>
+                If the <option>sockets</option> key is not allowing full access
+                to the D-Bus session bus, then flatpak provides filtered access.
+            </para>
+            <para>
+                The default policy for the session bus only allows the
+                application to own its own application ID and
+                subnames. For instance if the app is called
+                "org.my.App", it can only own "org.my.App" and
+                "org.my.App.*". Its also only allowed to talk to the
+                bus itself (org.freedesktop.DBus) and the portal APIs
+                APIs (bus names of the form org.freedesktop.portal.*).
+            </para>
+            <para>
+                Additionally the app is always allowed to reply to
+                messages sent to it, and emit broadcast signals (but
+                these will not reach other sandboxed apps unless they
+                are allowed to talk to your app.
+            </para>
+            <para>
+                If the [Session Bus Policy] group is present, it provides
+                policy for session bus access.
+            </para>
+            <para>
+                Each key in this group has the form of a D-Bus bus name or
+                prefix thereof, for example <option>org.gnome.SessionManager</option>
+                or <option>org.freedesktop.portal.*</option>
+            </para>
+            <para>
+                The possible values for entry are, in increasing order or
+                access:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>none</option></term>
+                    <listitem><para>
+                        The bus name or names in question is invisible to the application.
+                        Available since 0.2.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>see</option></term>
+                    <listitem><para>
+                        The bus name or names can be enumerated by the application.
+                        Available since 0.2.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>talk</option></term>
+                    <listitem><para>
+                        The application can send messages/ and receive replies and signals from the bus name or names.
+                        Available since 0.2.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>own</option></term>
+                    <listitem><para>
+                        The application can own the bus name or names (as well as all the above).
+                        Available since 0.2.
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[System Bus Policy]</title>
+            <para>
+                If the <option>sockets</option> key is not allowing full access
+                to the D-Bus system bus, then flatpak does not make the system
+                bus available unless the [System Bus Policy] group is present
+                and provides a policy for filtered access. Available since 0.2.
+            </para>
+            <para>
+                Entries in this group have the same form as for the [Session Bus Policy] group.
+                However, the app has no permissions by default.
+            </para>
+        </refsect2>
+        <refsect2>
+            <title>[Environment]</title>
+            <para>
+                The [Environment] group specifies environment variables to set
+                when running the application. Available since 0.3.
+            </para>
+            <para>
+                Entries in this group have the form <option>VAR=VALUE</option>
+                where <option>VAR</option> is the name of an environment variable
+                to set.
+            </para>
+        </refsect2>
+        <refsect2>
+            <title>[Extension NAME]</title>
+            <para>
+                Runtimes and applications can define extension points, which allow
+                optional, additional runtimes to be mounted at a specified location
+                inside the sandbox when they are present on the system. Typical uses
+                for extension points include translations for applications, or debuginfo
+                for sdks. The name of the extension point is specified as part of the
+                group heading.
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>directory</option> (string)</term>
+                    <listitem><para>
+                        The relative path at which the extension will be mounted in
+                        the sandbox. If the extension point is for an application, the
+                        path is relative to <filename>/app</filename>, otherwise
+                        it is relative to <filename>/usr</filename>. This key
+                        is mandatory. Available since 0.1.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>version</option> (string)</term>
+                    <listitem><para>
+                        The branch to use when looking for the extension. If this is
+                        not specified, it defaults to the branch of the application or
+                        runtime that the extension point is for.
+                        Available since 0.4.1.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>versions</option> (string)</term>
+                    <listitem><para>
+                        The branches to use when looking for the extension. If this is
+                        not specified, it defaults to the branch of the application or
+                        runtime that the extension point is for. Available since
+                        0.9.1, and backported to the 0.8.x branch in 0.8.4.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>add-ld-path</option> (string)</term>
+                    <listitem><para>
+                        A path relative to the extension point directory that will be appended
+                        to LD_LIBRARY_PATH. Available since 0.9.1, and
+                        backported to the 0.8.x branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>merge-dirs</option> (string)</term>
+                    <listitem><para>
+                        A list of relative paths of directories below the extension point directory
+                        that will be merged. Available since 0.9.1, and
+                        backported to the 0.8.x branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>download-if</option> (string)</term>
+                    <listitem><para>
+                        A condition that must be true for the extension to be auto-downloaded.
+                        The only currently recognized value is active-gl-driver, which is true
+                        if the name of the active GL driver matches the extension point basename.
+                        Available since 0.9.1, and backported to the 0.8.x
+                        branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>enable-if</option> (string)</term>
+                    <listitem><para>
+                        A condition that must be true for the extension to be enabled.
+                        The only currently recognized value is active-gl-driver, which is true
+                        if the name of the active GL driver matches the extension point basename.
+                        Available since 0.9.1, and backported to the 0.8.x
+                        branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>subdirectory-suffix</option> (string)</term>
+                    <listitem><para>
+                        A suffix that gets appended to the directory name. This is very
+                        useful when the extension point naming scheme is "reversed". For example,
+                        an extension point for GTK+ themes would be /usr/share/themes/$NAME/gtk-3.0,
+                        which could be achieved using subdirectory-suffix=gtk-3.0.
+                        Available since 0.9.1, and backported to the 0.8.x
+                        branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>subdirectories</option> (boolean)</term>
+                    <listitem><para>
+                        If this key is set to true, then flatpak will look for
+                        extensions whose name is a prefix of the extension point name, and
+                        mount them at the corresponding name below the subdirectory.
+                        Available since 0.1.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>no-autodownload</option> (boolean)</term>
+                    <listitem><para>
+                        Whether to automatically download extensions matching this extension
+                        point when updating or installing a 'related' application or runtime.
+                        Available since 0.6.7.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>locale-subset</option> (boolean)</term>
+                    <listitem><para>
+                        If set, then the extensions are partially downloaded by default,
+                        based on the currently configured locales. This means that the extension
+                        contents should be a set of directories with the language code as name.
+                        Available since 0.9.13 (and 0.6.6 for any extensions called *.Locale)
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>autodelete</option> (boolean)</term>
+                    <listitem><para>
+                        Whether to automatically delete extensions matching this extension
+                        point when deleting a 'related' application or runtime.
+                        Available since 0.6.7.
+                    </para></listitem>
+                </varlistentry>
+                <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+                <varlistentry>
+                    <term><option>collection-id</option> (string)</term>
+                    <listitem><para>
+                        The ID of the collection that this extension point belongs to. If this
+                        is unspecified, it defaults to the collection ID of the application
+                        or runtime that the extension point is for.
+                        Currently, extension points must be in the same collection as the
+                        application or runtime that they are for.
+                        Available since FIXME.
+                    </para></listitem>
+                </varlistentry>
+                -->
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[ExtensionOf]</title>
+            <para>
+                This optional group may be present if the runtime is an extension.
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>ref</option> (string)</term>
+                    <listitem><para>
+                        The ref of the runtime or application that this extension
+                        belongs to. Available since 0.9.1.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>priority</option> (integer)</term>
+                    <listitem><para>
+                        The priority to give this extension when looking for the
+                        best match. Default is 0. Available since 0.9.1, and
+                        backported to the 0.8.x branch in 0.8.3.
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+            <title>[Extra Data]</title>
+            <para>
+                This optional group may be present if the runtime or application uses
+                extra data that gets downloaded separately. The data in this group
+                gets merged into the repository summary, with the xa.extra-data-sources
+                key.
+            </para>
+            <para>
+                If multiple extra data sources are present, their uri, size and checksum
+                keys are grouped together by using the same suffix. If only one extra
+                data source is present, the suffix can be omitted.
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>NoRuntime</option> (boolean)</term>
+                    <listitem><para>
+                        Whether to mount the runtime while running the /app/bin/apply_extra
+                        script. Defaults to true, i.e. not mounting the runtime.
+                        Available since 0.9.1, and backported to the 0.8.x
+                        branch in 0.8.4.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>uri<replaceable>X</replaceable></option> (string)</term>
+                    <listitem><para>
+                        The uri for extra data source
+                        <replaceable>X</replaceable>. The only supported uri
+                        schemes are http and https. Available since 0.6.13.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>size<replaceable>X</replaceable></option> (integer)</term>
+                    <listitem><para>
+                        The size for extra data source
+                        <replaceable>X</replaceable>. Available since 0.6.13.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>checksum<replaceable>X</replaceable></option> (string)</term>
+                    <listitem><para>
+                        The sha256 sum for extra data source
+                        <replaceable>X</replaceable>. Available since 0.6.13.
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+        <refsect2>
+          <title>[Policy SUBSYSTEM]</title>
+          <para>
+            Subsystems can define their own policies to be placed in a group
+            whose name has this form. Their values are treated as lists,
+            in which items can have their meaning negated by prepending !
+            to the value. They are not otherwise parsed by Flatpak.
+            Available since 0.6.13.
+            <!-- TODO: More information would be nice -->
+          </para>
+        </refsect2>
+    </refsect1>
+
+    <refsect1>
+        <title>Example</title>
+<programlisting>
+[Application]
+name=org.gnome.Calculator
+runtime=org.gnome.Platform/x86_64/3.20
+sdk=org.gnome.Sdk/x86_64/3.20
+command=gnome-calculator
+
+[Context]
+shared=network;ipc;
+sockets=x11;wayland;
+filesystems=xdg-run/dconf;~/.config/dconf:ro;
+
+[Session Bus Policy]
+ca.desrt.dconf=talk
+
+[Environment]
+DCONF_USER_CONFIG_DIR=.config/dconf
+
+[Extension org.gnome.Calculator.Locale]
+directory=share/runtime/locale
+subdirectories=true
+
+[Extension org.gnome.Calculator.Debug]
+directory=lib/debug
+</programlisting>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-override</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-override.xml b/doc/flatpak-override.xml
new file mode 100644 (file)
index 0000000..b5ce378
--- /dev/null
@@ -0,0 +1,362 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-override">
+
+    <refentryinfo>
+        <title>flatpak override</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak override</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-override</refname>
+        <refpurpose>Override application requirements</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak override</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">APP</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Overrides the application specified runtime requirements. This can be used
+            to grant a sandboxed application more or less resources than it requested.
+        </para>
+        <para>
+            By default the application gets access to the resources it
+            requested when it is started. But the user can override it
+            on a particular instance by specifying extra arguments to
+            flatpak run, or every time by using flatpak override.
+        </para>
+        <para>
+            If the application id is not specified then the overrides affect all applications,
+            but the per-application overrides can override the global overrides.
+        </para>
+        <para>
+            Unless overridden with the --user or --installation options, this command
+            changes the default system-wide installation.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Update a per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Update the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Updates a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--share=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--unshare=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Don't share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--socket=SOCKET</option></term>
+
+                <listitem><para>
+                    Expose a well-known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nosocket=SOCKET</option></term>
+
+                <listitem><para>
+                    Don't expose a well-known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--device=DEVICE</option></term>
+
+                <listitem><para>
+                    Expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nodevice=DEVICE</option></term>
+
+                <listitem><para>
+                    Don't expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--allow=FEATURE</option></term>
+
+                <listitem><para>
+                    Allow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                 </para><para>
+                    The <code>devel</code> feature allows the application to
+                    access certain syscalls such as <code>ptrace()</code>, and
+                <code>perf_event_open()</code>.
+                </para><para>
+                    The <code>multiarch</code> feature allows the application to
+                    execute programs compiled for an ABI other than the one supported
+                    natively by the system. For example, for the <code>x86_64</code>
+                    architecture, 32-bit <code>x86</code> binaries will be allowed as
+                    well.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disallow=FEATURE</option></term>
+
+                <listitem><para>
+                    Disallow access to a specific feature. This updates
+                    the [Context] group in the metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--filesystem=FS</option></term>
+
+                <listitem><para>
+                    Allow the application access to a subset of the filesystem.
+                    This overrides to the Context section from the application metadata.
+                    FS can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos, xdg-run,
+                    xdg-config, xdg-cache, xdg-data,
+                    an absolute path, or a homedir-relative path like ~/dir or paths
+                    relative to the xdg dirs, like xdg-download/subdir.
+                    The optional :ro suffix indicates that the location will be read-only.
+                    The optional :create suffix indicates that the location will be read-write and created if it doesn't exist.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nofilesystem=FILESYSTEM</option></term>
+
+                <listitem><para>
+                    Remove access to the specified subset of the filesystem from
+                    the application. This overrides to the Context section from the
+                    application metadata.
+                    FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos,
+                    an absolute path, or a homedir-relative path like ~/dir.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--add-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Add generic policy option. For example, "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would map to this metadata:
+<programlisting>
+[Policy subsystem]
+key=v1;v2;
+</programlisting>
+                </para></listitem>
+                <listitem><para>
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--remove-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Remove generic policy option. This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--env=VAR=VALUE</option></term>
+
+                <listitem><para>
+                    Set an environment variable in the application.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well-known name NAME on the session bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well-known name NAME on the session bus.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to own all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to talk to all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--persist=FILENAME</option></term>
+
+                <listitem><para>
+                    If the application doesn't have access to the real homedir, make the (homedir-relative) path
+                    FILENAME a bind mount to the corresponding path in the per-application directory,
+                    allowing that location to be used for persistent data.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak override --nosocket=wayland org.gnome.GEdit</command>
+        </para>
+        <para>
+            <command>$ flatpak override --filesystem=home org.mozilla.Firefox</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote-add.xml b/doc/flatpak-remote-add.xml
new file mode 100644 (file)
index 0000000..45fb3dc
--- /dev/null
@@ -0,0 +1,256 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote-add">
+
+    <refentryinfo>
+        <title>flatpak remote-add</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote-add</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote-add</refname>
+        <refpurpose>Add a remote repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <para>Add from a .flatpakrepo file:</para>
+            <cmdsynopsis>
+                <command>flatpak remote-add</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">--from</arg>
+                <arg choice="plain">NAME</arg>
+                <arg choice="plain">LOCATION</arg>
+            </cmdsynopsis>
+            <para>Manually specify repo uri and options:</para>
+            <cmdsynopsis>
+                <command>flatpak remote-add</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">NAME</arg>
+                <arg choice="plain">LOCATION</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Adds a remote repository to the flatpak repository
+            configuration.  <arg>NAME</arg> is the name for the new
+            remote, and <arg>LOCATION</arg> is a url or pathname.  The
+            <arg>LOCATION</arg> is either a flatpak repository, or a
+            .flatpakrepo file which describes a repository. In the
+            former case you may also have to specify extra options,
+            such as the gpg key for the repo.
+        </para>
+        <para>
+            Unless overridden with the --user or --installation options, this command
+            changes the default system-wide installation.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--from</option></term>
+
+                <listitem><para>
+                  Assume the URI is a .flatpakrepo file rather than the repository itself. This is enabled
+                  by default if the extension is .flatpakrepo, so generally you don't need this option.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Modify the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Modify the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Modify a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-gpg-verify</option></term>
+
+                <listitem><para>
+                    Disable GPG verification for the added remote.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--prio=PRIO</option></term>
+
+                <listitem><para>
+                    Set the priority for the remote. Default is 1, higher is more prioritized. This is
+                    mainly used for graphical installation tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-enumerate</option></term>
+
+                <listitem><para>
+                    Mark the remote as not enumerated. This means the remote will
+                    not be used to list applications, for instance in graphical
+                    installation tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-use-for-deps</option></term>
+
+                <listitem><para>
+                    Mark the remote as not to be used for automatic runtime
+                    dependency resolution.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--if-not-exists</option></term>
+
+                <listitem><para>
+                    Do nothing if the provided remote already exists.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disable</option></term>
+
+                <listitem><para>
+                    Disable the added remote.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--title=TITLE</option></term>
+
+                <listitem><para>
+                    A title for the remote, e.g. for display in a UI.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--default-branch=BRANCH</option></term>
+
+                <listitem><para>
+                    A default branch for the remote, mainly for use in a UI.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-import=FILE</option></term>
+
+                <listitem><para>
+                     Import gpg keys from the specified keyring file as
+                     trusted for the new remote. If the file is - the
+                     keyring is read from standard input.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--oci</option></term>
+
+                <listitem><para>
+                    This is a OCI format registry rather than a regular
+                    flatpak repository.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak remote-add gnome https://sdk.gnome.org/gnome.flatpakrepo</command>
+        </para>
+        <para>
+            <command>$ flatpak --user remote-add --no-gpg-verify test-repo https://people.gnome.org/~alexl/gnome-sdk/repo/</command>
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-modify</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-delete</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-flatpakrepo</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote-delete.xml b/doc/flatpak-remote-delete.xml
new file mode 100644 (file)
index 0000000..5c2d254
--- /dev/null
@@ -0,0 +1,151 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote-delete">
+
+    <refentryinfo>
+        <title>flatpak remote-delete</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote-delete</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote-delete</refname>
+        <refpurpose>Delete a remote repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak remote-delete</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">NAME</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Removes a remote repository from the flatpak repository configuration.
+            <arg choice="plain">NAME</arg> is the name of an existing remote.
+        </para>
+        <para>
+            Unless overridden with the --system, --user, or --installation options,
+            this command uses either the default system-wide installation or the
+            per-user one, depending on which has the specified
+            <arg choice="plain">REMOTE</arg>.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Modify the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Modify the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Modify a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--force</option></term>
+
+                <listitem><para>
+                    Remove remote even if its in use by installed apps or runtimes.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user remote-delete dried-raisins</command>
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-add</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-modify</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote-info.xml b/doc/flatpak-remote-info.xml
new file mode 100644 (file)
index 0000000..ffd9bb5
--- /dev/null
@@ -0,0 +1,233 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote-info">
+
+    <refentryinfo>
+        <title>flatpak remote-info</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote-info</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote-info</refname>
+        <refpurpose>Show information about an application or runtime in a remote</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak remote-info</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">REMOTE</arg>
+                <arg choice="plain">REF</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Shows information about the runtime or application <arg choice="plain">REF</arg> from the
+            remote repository with the name <arg choice="plain">REMOTE</arg>.
+            You can find all configured remote repositories with flatpak remotes.
+        </para>
+        <para>
+            By default, the output is formatted in a friendly format.
+            If you specify one of the options --show-ref, --show-commit,
+            --show-parent, or --show-metadata, the output is instead formatted
+            in a machine-readable format.
+        </para>
+        <para>
+            Unless overridden with the --system, --user, or --installation options,
+            this command uses either the default system-wide installation or the
+            per-user one, depending on which has the specified
+            <arg choice="plain">REMOTE</arg>.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Use the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Use the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Use a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Assume that <arg choice="plain">REF</arg> is a runtime if not explicitly specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    Assume that <arg choice="plain">REF</arg> is an app if not explicitly specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The default architecture to look for, if not given explicitly in the <arg choice="plain">REF</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--commit=COMMIT</option></term>
+
+                <listitem><para>
+                    Show information about the specific commit, rather than the latest version.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--log</option></term>
+
+                <listitem><para>
+                    Display a log of previous versions.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-r</option></term>
+                <term><option>--show-ref</option></term>
+
+                <listitem><para>
+                    Show the matched ref.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-c</option></term>
+                <term><option>--show-commit</option></term>
+
+                <listitem><para>
+                    Show the commit id.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-p</option></term>
+                <term><option>--show-parent</option></term>
+
+                <listitem><para>
+                    Show the parent commit id.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-m</option></term>
+                <term><option>--show-metadata</option></term>
+
+                <listitem><para>
+                    Show the metadata.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user remote-info flathub org.gnome.gedit</command>
+        </para>
+<programlisting>
+Ref: app/org.gnome.gedit/x86_64/stable
+ID: org.gnome.gedit
+Arch: x86_64
+Branch: stable
+Date: 2017-07-31 16:05:22 +0000
+Subject: Build org.gnome.gedit at 3ec291fc1ce4d78220527fa79576f4cc1481ebe5
+Commit: 3de7e9dde3bb8382aad9dfbbff20eccd9bf2100bc1887a3619ec0372e8066bf7
+Parent: -
+Download size: 3,4 MB
+Installed size: 11,1 MB
+Runtime: org.gnome.Platform/x86_64/3.24
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+                <citerefentry><refentrytitle>flatpak-remote-ls</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote-ls.xml b/doc/flatpak-remote-ls.xml
new file mode 100644 (file)
index 0000000..33bcc29
--- /dev/null
@@ -0,0 +1,200 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote-ls">
+
+    <refentryinfo>
+        <title>flatpak remote-ls</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote-ls</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote-ls</refname>
+        <refpurpose>Show available runtimes and applications</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak remote-ls</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt">REMOTE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Shows runtimes and applications that are available in the
+            remote repository with the name <arg choice="plain">REMOTE</arg>,
+            or all remotes if one isn't specified. You can find all configured
+            remote repositories with <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+        </para>
+        <para>
+            Unless overridden with the --system, --user, or --installation options,
+            this command uses either the default system-wide installation or the
+            per-user one, depending on which has the specified
+            <arg choice="plain">REMOTE</arg>.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Use the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Use the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Use a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-d</option></term>
+                <term><option>--show-details</option></term>
+
+                <listitem><para>
+                    Show arches, branches and commit ids, in addition to the names.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Show only runtimes, omit applications.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    Show only applications, omit runtimes.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--all</option></term>
+                <term><option>-a</option></term>
+
+                <listitem><para> Show everything. By default locale and
+                debug extensions as well as secondary arches when the primary
+                arch in available are hidden.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--updates</option></term>
+
+                <listitem><para>
+                    Show only those which have updates available.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    Show only those matching the specied architecture. By default, only
+                    supported architectures are shown. Use --arch=* to show all archtectures.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user remote-ls --app testrepo</command>
+        </para>
+<programlisting>
+org.gnome.Builder
+org.freedesktop.glxgears
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote-modify.xml b/doc/flatpak-remote-modify.xml
new file mode 100644 (file)
index 0000000..9e96143
--- /dev/null
@@ -0,0 +1,281 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote-modify">
+
+    <refentryinfo>
+        <title>flatpak remote-modify</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote-modify</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote-modify</refname>
+        <refpurpose>Modify a remote repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak remote-modify</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">NAME</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Modifies options for an existing remote repository in the flatpak repository configuration.
+            <arg choice="plain">NAME</arg> is the name for the remote.
+        </para>
+        <para>
+            Unless overridden with the --system, --user, or --installation options,
+            this command uses either the default system-wide installation or the
+            per-user one, depending on which has the specified
+            <arg choice="plain">REMOTE</arg>.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Modify the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Modify the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Modify a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-gpg-verify</option></term>
+
+                <listitem><para>
+                    Disable GPG verification for the added remote.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-verify</option></term>
+
+                <listitem><para>
+                    Enable GPG verification for the added remote.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--prio=PRIO</option></term>
+
+                <listitem><para>
+                    Set the priority for the remote. Default is 1, higher is more prioritized. This is
+                    mainly used for graphical installation tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-enumerate</option></term>
+
+                <listitem><para>
+                    Mark the remote as not enumerated. This means the remote will
+                    not be used to list applications, for instance in graphical
+                    installation tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-use-for-deps</option></term>
+
+                <listitem><para>
+                    Mark the remote as not to be used for automatic runtime
+                    dependency resolution.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disable</option></term>
+
+                <listitem><para>
+                    Disable the remote. Disabled remotes will not be automatically updated from.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--enable</option></term>
+
+                <listitem><para>
+                    Enable the remote.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--enumerate</option></term>
+
+                <listitem><para>
+                    Mark the remote as enumerated. This means the remote will
+                    be used to list applications, for instance in graphical
+                    installation tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--use-for-deps</option></term>
+
+                <listitem><para>
+                    Mark the remote as to be used for automatic runtime
+                    dependency resolution.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--title=TITLE</option></term>
+
+                <listitem><para>
+                    A title for the remote, e.g. for display in a UI.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--default-branch=BRANCH</option></term>
+
+                <listitem><para>
+                    A default branch to for the remote, mainly for use in a UI.
+                </para></listitem>
+            </varlistentry>
+
+            <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+            <varlistentry>
+                <term><option>-FIXME-collection-id=COLLECTION-ID</option></term>
+
+                <listitem><para>
+                    The globally unique identifier of the remote repository, to
+                    allow mirrors to be grouped. This must only be set to the
+                    collection ID provided by the remote, and must not be set if the
+                    remote does not provide an collection ID.
+                </para></listitem>
+            </varlistentry>
+            -->
+
+            <varlistentry>
+                <term><option>--url=URL</option></term>
+
+                <listitem><para>
+                    Set a new URL.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--update-metadata</option></term>
+
+                <listitem><para>
+                    A default branch to for the remote, mainly for use in a UI.
+                </para></listitem>
+                <listitem><para>
+                    Update the remote's extra metadata from the OSTree repository's summary
+                    file. Only xa.title and xa.default-branch are supported at the moment.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gpg-import=FILE</option></term>
+
+                <listitem><para>
+                     Import gpg keys from the specified keyring file as
+                     trusted for the new remote. If the file is - the
+                     keyring is read from standard input.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user remote-modify --no-gpg-verify test-repo</command>
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-add</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-delete</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remote.xml b/doc/flatpak-remote.xml
new file mode 100644 (file)
index 0000000..8d8b8ad
--- /dev/null
@@ -0,0 +1,171 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remote">
+
+    <refentryinfo>
+        <title>flatpak remote</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remote</refentrytitle>
+        <manvolnum>5</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remote</refname>
+        <refpurpose>Configuration for a remote</refpurpose>
+    </refnamediv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Flatpak stores information about configured remotes for an installation location in
+            <filename>$installation/repo/config</filename>. For example, the remotes for the
+            default system-wide installation are in
+            <filename>$prefix/var/lib/flatpak/repo/config</filename>, and the remotes for the
+            per-user installation are in <filename>$HOME/.local/share/flatpak/repo/config</filename>.
+       </para>
+
+       <para>
+            Normally, it is not necessary to edit remote config files directly, the
+            flatpak remote-modify command should be used to change properties of remotes.
+       </para>
+
+       <para>
+            System-wide remotes can be statically preconfigured by dropping
+            config fragments into <filename>/etc/flatpak/remotes.d/</filename>.
+       </para>
+    </refsect1>
+
+    <refsect1>
+        <title>File format</title>
+
+        <para>
+            The remote config file format is using the same .ini file format that is used for systemd
+            unit files or application .desktop files.
+        </para>
+
+        <refsect2>
+            <title>[remote …]</title>
+            <para>
+                All the configuration for the the remote with name NAME is contained in the
+                [remote "NAME"] group.
+            </para>
+            <para>
+                The following keys are recognized by OSTree, among others:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>url</option> (string)</term>
+                    <listitem><para>The url for the remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>gpg-verify</option> (boolean)</term>
+                    <listitem><para>Whether to use GPG verification for content from this remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>gpg-verify-summary</option> (boolean)</term>
+                    <listitem>
+                        <para>Whether to use GPG verification for the summary of this remote.</para>
+                        <!--
+                        FIXME: Uncomment this when P2P support is made unconditional on enable-p2p.
+                        <para>This is ignored if <option>collection-id</option> is set, as refs are verified in commit metadata in that case. Enabling <option>gpg-verify-summary</option> would break peer to peer distribution of refs.</para>
+                        -->
+                    </listitem>
+                </varlistentry>
+                <!-- FIXME: Uncomment this when enable-p2p is enabled unconditionally.
+                <varlistentry>
+                    <term><option>collection-id</option> (string)</term>
+                    <listitem><para>The globally unique identifier for the upstream collection repository, to allow mirrors to be grouped.</para></listitem>
+                </varlistentry>
+                -->
+            </variablelist>
+            <para>
+                All flatpak-specific keys have a xa. prefix:
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><option>xa.disable</option> (boolean)</term>
+                    <listitem><para>Whether the remote is disabled. Defaults to false.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.prio</option> (integer)</term>
+                    <listitem><para>The priority for the remote. This is used when listing remotes. Defaults to 1.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.noenumerate</option> (boolean)</term>
+                    <listitem><para>Whether this remote should be used when presenting available contents. Defaults to true.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.nodeps</option> (boolean)</term>
+                    <listitem><para>Whether this remote should be used when searching for dependencies. Defaults to true.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.title</option> (string)</term>
+                    <listitem><para>An optional title to use when presenting this remote in a UI.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.title-is-set</option> (boolean)</term>
+                    <listitem><para>This key is set to true if <option>xa.title</option> has been explicitly set.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.default-branch</option> (string)</term>
+                    <listitem><para>The default branch to use when installing from this remote.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.default-branch-is-set</option> (boolean)</term>
+                    <listitem><para>This key is set to true if <option>xa.default-branch</option> has been explicitly set.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.main-ref</option> (string)</term>
+                    <listitem><para>The main reference served by this remote. This is used for origin remotes of applications installed via a flatpakref file.</para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><option>xa.oci</option> (boolean)</term>
+                    <listitem><para>Whether this is an OCI remote. Defaults to false.</para></listitem>
+                </varlistentry>
+            </variablelist>
+        </refsect2>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+<programlisting>
+[remote "gnome-nightly-apps"]
+gpg-verify=true
+gpg-verify-summary=true
+<!--
+FIXME: Uncomment this when P2P support is made unconditional on enable-p2p.
+gpg-verify-summary=false
+collection-id=org.gnome.Apps.Nightly
+-->
+url=https://sdk.gnome.org/nightly/repo-apps/
+xa.title=GNOME Applications
+</programlisting>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak-remote-modify</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-remotes.xml b/doc/flatpak-remotes.xml
new file mode 100644 (file)
index 0000000..e89374f
--- /dev/null
@@ -0,0 +1,159 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-remotes">
+
+    <refentryinfo>
+        <title>flatpak remotes</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak remotes</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-remotes</refname>
+        <refpurpose>List remote repositories</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak remotes</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Lists the known remote repositories, in priority order.
+        </para>
+        <para>
+            By default, both per-user and system-wide installations
+            are shown. Use the --user, --system or --installation
+            options to change this.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Show the per-user configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Show the default system-wide configuration.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Show a system-wide installation by <arg choice="plain">NAME</arg> among
+                    those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-d</option></term>
+                <term><option>--show-details</option></term>
+
+                <listitem><para>
+                    Show more information for each repository in addition to the name.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--show-disabled</option></term>
+
+                <listitem><para>
+                    Show disabled repos.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak remotes --user --show-details</command>
+        </para>
+<programlisting>
+testrepo       Test Repository  http://209.132.179.91/repo/ no-gpg-verify
+</programlisting>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-add</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote-delete</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+            </para>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-repo.xml b/doc/flatpak-repo.xml
new file mode 100644 (file)
index 0000000..d1fbbae
--- /dev/null
@@ -0,0 +1,108 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-repo">
+
+    <refentryinfo>
+        <title>flatpak repo</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak repo</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-repo</refname>
+        <refpurpose>Show information about a local repository</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak repo</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">LOCATION</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Show information about a local repository.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--info</option></term>
+
+                <listitem><para>
+                    Print general information about a local repository.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--branches</option></term>
+
+                <listitem><para>
+                    List the branches in a local repository.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--metadata=BRANCH</option></term>
+
+                <listitem><para>
+                  Print metadata for a branch in the repository.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak repo --info ~/my-repo</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-info</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-run.xml b/doc/flatpak-run.xml
new file mode 100644 (file)
index 0000000..0294a15
--- /dev/null
@@ -0,0 +1,424 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-run">
+
+    <refentryinfo>
+        <title>flatpak run</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak run</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-run</refname>
+        <refpurpose>Run an application or open a shell in a runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak run</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">REF</arg>
+                <arg choice="opt" rep="repeat">ARG</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            If <arg choice="plain">REF</arg> names an installed application,
+            flatpak runs the application in a sandboxed environment. Extra
+            arguments are passed on to the application.
+        </para>
+        <para>
+            If <arg choice="plain">REF</arg> names a runtime, a shell is opened in the
+            runtime. This is useful for development and testing.
+        </para>
+        <para>
+            flatpak creates a sandboxed environment for the application to run in
+            by mounting the right runtime at <filename>/usr</filename> and a writable
+            directory at <filename>/var</filename>, whose content is preserved between
+            application runs. The application itself is mounted at <filename>/app</filename>.
+        </para>
+        <para>
+            The details of the sandboxed environment are controlled by the application
+            metadata and various options like --share and --socket that are passed to the run
+            command: Access is allowed if it was requested either in the application
+            metadata file or with an option and the user hasn't overridden it.
+        </para>
+        <para>
+            The remaining arguments are passed to the command that gets run in the sandboxed
+            environment. See the <option>--file-forwarding</option> for handling of file arguments.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to install for.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--command=COMMAND</option></term>
+
+                <listitem><para>
+                    The command to run instead of the one listed in the application metadata.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--branch=BRANCH</option></term>
+
+                <listitem><para>
+                    The branch to use.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-d</option></term>
+                <term><option>--devel</option></term>
+
+                <listitem><para>
+                    Use the devel runtime that is specified in the application metadata instead of the regular runtime, and use a seccomp profile that is less likely to break development tools.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime=RUNTIME</option></term>
+
+                <listitem><para>
+                  Use this runtime instead of the one that is specified in the application metadata.
+                  This is a full tuple, like for example <arg choice="plain">org.freedesktop.Sdk/x86_64/1.2</arg>, but
+                  partial tuples are allowed. Any empty or missing parts are filled in with the corresponding
+                  values specified by the app.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime-version=VERSION</option></term>
+
+                <listitem><para>
+                  Use this version of the runtime instead of the one that is specified in the application metadata.
+                  This overrides any version specified with the --runtime option.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--share=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--unshare=SUBSYSTEM</option></term>
+
+                <listitem><para>
+                    Don't share a subsystem with the host session. This overrides
+                    the Context section from the application metadata.
+                    SUBSYSTEM must be one of: network, ipc.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--socket=SOCKET</option></term>
+
+                <listitem><para>
+                    Expose a well known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nosocket=SOCKET</option></term>
+
+                <listitem><para>
+                    Don't expose a well known socket to the application. This overrides to
+                    the Context section from the application metadata.
+                    SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--device=DEVICE</option></term>
+
+                <listitem><para>
+                    Expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nodevice=DEVICE</option></term>
+
+                <listitem><para>
+                    Don't expose a device to the application. This overrides to
+                    the Context section from the application metadata.
+                    DEVICE must be one of: dri, kvm, all.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--allow=FEATURE</option></term>
+
+                <listitem><para>
+                    Allow access to a specific feature. This overrides to
+                    the Context section from the application metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--disallow=FEATURE</option></term>
+
+                <listitem><para>
+                    Disallow access to a specific feature. This overrides to
+                    the Context section from the application metadata.
+                    FEATURE must be one of: devel, multiarch.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--filesystem=FS</option></term>
+
+                <listitem><para>
+                    Allow the application access to a subset of the filesystem.
+                    This overrides to the Context section from the application metadata.
+                    FS can be one of: home, host, xdg-desktop, xdg-documents, xdg-download,
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos,
+                    xdg-run, xdg-config, xdg-cache, xdg-data,
+                    an absolute path, or a homedir-relative path like ~/dir or paths
+                    relative to the xdg dirs, like xdg-download/subdir.
+                    The optional :ro suffix indicates that the location will be read-only.
+                    The optional :create suffix indicates that the location will be read-write and created if it doesn't exist.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--nofilesystem=FILESYSTEM</option></term>
+
+                <listitem><para>
+                    Remove access to the specified subset of the filesystem from
+                    the application. This overrides to the Context section from the
+                    application metadata.
+                    FILESYSTEM can be one of: home, host, xdg-desktop, xdg-documents, xdg-download
+                    xdg-music, xdg-pictures, xdg-public-share, xdg-templates, xdg-videos,
+                    an absolute path, or a homedir-relative path like ~/dir.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--add-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Add generic policy option. For example, "--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2" would map to this metadata:
+<programlisting>
+[Policy subsystem]
+key=v1;v2;
+</programlisting>
+                </para></listitem>
+                <listitem><para>
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--remove-policy=SUBSYSTEM.KEY=VALUE</option></term>
+
+                <listitem><para>
+                    Remove generic policy option. This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--env=VAR=VALUE</option></term>
+
+                <listitem><para>
+                    Set an environment variable in the application.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well known name NAME on the session bus.
+                    If NAME ends with .*, it allows the application to own all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well known name NAME on the session bus.
+                    If NAME ends with .*, it allows the application to talk to all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-own-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to own the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to own all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system-talk-name=NAME</option></term>
+
+                <listitem><para>
+                    Allow the application to talk to the well known name NAME on the system bus.
+                    If NAME ends with .*, it allows the application to talk to all matching names.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--persist=FILENAME</option></term>
+
+                <listitem><para>
+                    If the application doesn't have access to the real homedir, make the (homedir-relative) path
+                    FILENAME a bind mount to the corresponding path in the per-application directory,
+                    allowing that location to be used for persistent data.
+                    This overrides to the Context section from the application metadata.
+                    This option can be used multiple times.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--log-session-bus</option></term>
+
+                <listitem><para>
+                    Log session bus traffic. This can be useful to see what access you need to allow in
+                    your D-Bus policy.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--log-system-bus</option></term>
+
+                <listitem><para>
+                    Log system bus traffic. This can be useful to see what access you need to allow in
+                    your D-Bus policy.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--file-forwarding</option></term>
+
+                <listitem><para>
+                    If this option is specified, the remaining arguments are scanned, and all arguments
+                    that are enclosed between a pair of '@@' arguments are interpreted as file paths,
+                    exported in the document store, and passed to the command in the form of the
+                    resulting document path. Arguments between '@@u' and '@@' are considered uris,
+                    and any file: uris are exported. The exports are non-persistent and with read and write
+                    permissions for the application.
+                </para></listitem>
+            </varlistentry>
+
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak run org.gnome.GEdit</command>
+        </para>
+        <para>
+            <command>$ flatpak run --devel --command=bash org.gnome.Builder</command>
+        </para>
+        <para>
+            <command>$ flatpak run --command=bash org.gnome.Sdk</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-override</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-enter</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-search.xml b/doc/flatpak-search.xml
new file mode 100644 (file)
index 0000000..6c40894
--- /dev/null
@@ -0,0 +1,101 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-search">
+
+    <refentryinfo>
+        <title>flatpak search</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Patrick</firstname>
+                <surname>Griffis</surname>
+                <email>tingping@tingping.se</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak search</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-search</refname>
+        <refpurpose>Search for applications and runtimes</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak search</command>
+                <arg choice="plain">TEXT</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Searches for applications and runtimes matching
+            <arg choice="plain">TEXT</arg>. Note that this uses appstream data
+            that can be updated with <citerefentry><refentrytitle>flatpak-update</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Only search through remotes in the per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Only search through remotes in the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Show a system-wide installation by <arg choice="plain">NAME</arg> among
+                    those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-uninstall.xml b/doc/flatpak-uninstall.xml
new file mode 100644 (file)
index 0000000..0a19b61
--- /dev/null
@@ -0,0 +1,204 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-uninstall">
+
+    <refentryinfo>
+        <title>dxg-app uninstall</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak uninstall</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-uninstall</refname>
+        <refpurpose>Uninstall an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak uninstall</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt" rep="repeat">REF</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Uninstalls an application or runtime. <arg choice="plain">REF</arg> is a reference to the
+            application or runtime to uninstall.
+        </para>
+        <para>
+            Each <arg choice="plain">REF</arg> arguments is a full or partial indentifier in the
+            flatpak ref format, which looks like "(app|runtime)/ID/ARCH/BRANCH". All elements
+            except ID are optional and can be left out, including the slashes,
+            so most of the time you need only specify ID. Any part left out will be matched
+            against what is installed, and if there are multiple matches an error message
+            will list the alternatives.
+        </para>
+        <para>
+            By default this looks for both installed apps and runtime
+            with the given <arg choice="plain">NAME</arg>, but you can
+            limit this by using the --app or --runtime option.
+        </para>
+        <para>
+            Normally, this command removes the ref for this application/runtime from the
+            local OSTree repository and purges and objects that are no longer
+            needed to free up disk space. If the same application is later
+            reinstalled, the objects will be pulled from the remote repository
+            again. The --keep-ref option can be used to prevent this.
+        </para>
+        <para>
+            If all branches of the application/runtime are removed, this command
+            also purges the data directory for the application.
+        </para>
+        <para>
+            Unless overridden with the --user or the --installation option, this command updates
+            the default system-wide installation.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--keep-ref</option></term>
+
+                <listitem><para>
+                    Keep the ref for the application and the objects belonging to it
+                    in the local repository.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Updates a per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Updates the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Updates a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to uninstall, instead of the architecture of
+                    the host system.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    Only look for an app with the given name.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Only look for a runtime with the given name.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-related</option></term>
+
+                <listitem><para>
+                    Don't uninstall related extensions, such as the locale data.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--force-remove</option></term>
+                <listitem><para>
+                    Remove files even if they're in use by a running application.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user uninstall org.gnome.GEdit</command>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak-update.xml b/doc/flatpak-update.xml
new file mode 100644 (file)
index 0000000..52924ca
--- /dev/null
@@ -0,0 +1,271 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak-update">
+
+    <refentryinfo>
+        <title>flatpak update</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak update</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak-update</refname>
+        <refpurpose>Update an application or runtime</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak update</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="opt" rep="repeat">REF</arg>
+            </cmdsynopsis>
+            <cmdsynopsis>
+                <command>flatpak update</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="plain">--appstream</arg>
+                <arg choice="opt">REMOTE</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            Updates applications and runtimes. <arg choice="plain">REF</arg> is a reference to the
+            application or runtime to update. If no <arg choice="plain">REF</arg> is given, everything
+            is updated, as well as appstream info for all remotes.
+        </para>
+        <para>
+            Each <arg choice="plain">REF</arg> arguments is a full or partial indentifier in the
+            flatpak ref format, which looks like "(app|runtime)/ID/ARCH/BRANCH". All elements
+            except ID are optional and can be left out, including the slashes,
+            so most of the time you need only specify ID. Any part left out will be matched
+            against what is installed, and if there are multiple matches an error message
+            will list the alternatives.
+        </para>
+        <para>
+            By default this looks for both apps and runtimes with the given <arg choice="plain">REF</arg>,
+            but you can limit this by using the --app or --runtime option, or by supplying the initial
+            element in the REF.
+        </para>
+        <para>
+            Normally, this command updates the application to the tip
+            of its branch. But it is possible to check out another commit,
+            with the --commit option.
+        </para>
+        <para>
+            Note that updating a runtime is different from installing
+            a different branch, and runtime updates are expected to keep
+            strict compatibility. If an application update does cause
+            a problem, it is possible to go back to the previous
+            version, with the --commit option.
+        </para>
+        <para>
+            Unless overridden with the --user, --system or --installation option, this command updates
+            any matching refs in the standard system-wide installation and the per-user one.
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--user</option></term>
+
+                <listitem><para>
+                    Update a per-user installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--system</option></term>
+
+                <listitem><para>
+                    Update the default system-wide installation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--installation=NAME</option></term>
+
+                <listitem><para>
+                    Updates a system-wide installation specified by <arg choice="plain">NAME</arg>
+                    among those defined in <filename>/etc/flatpak/installations.d/</filename>.
+                    Using <arg choice="plain">--installation=default</arg> is equivalent to using
+                    <arg choice="plain">--system</arg>.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--arch=ARCH</option></term>
+
+                <listitem><para>
+                    The architecture to update for.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--subpath=PATH</option></term>
+
+                <listitem><para>
+                  Install only a subpath of the ref. This is mainly used to install a subset of locales.
+                  This can be added multiple times to install multiple subpaths.
+                  If this is not specified the subpaths specified at install time are reused.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--commit=COMMIT</option></term>
+
+                <listitem><para>
+                    Update to this commit, instead of the tip of the branch.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-deploy</option></term>
+
+                <listitem><para>
+                    Download the latest version, but don't deploy it.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-pull</option></term>
+
+                <listitem><para>
+                    Don't download the latest version, deploy whatever is locally available.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-related</option></term>
+
+                <listitem><para>
+                    Don't download related extensions, such as the locale data.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--no-deps</option></term>
+
+                <listitem><para>
+                    Don't update or install runtime dependencies when installing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--app</option></term>
+
+                <listitem><para>
+                    Only look for an app with the given name.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--appstream</option></term>
+
+                <listitem><para>
+                    Update appstream for <arg choice="plain">REMOTE</arg>, or all remotes if no remote is specified.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--runtime</option></term>
+
+                <listitem><para>
+                    Only look for a runtime with the given name.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-y</option></term>
+                <term><option>--assumeyes</option></term>
+                <listitem><para>
+                    Automatically answer yes to all questions (or pick the most prioritized answer). This is useful for automation.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--force-remove</option></term>
+                <listitem><para>
+                    Remove old files even if they're in use by a running application.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Examples</title>
+
+        <para>
+            <command>$ flatpak --user update org.gnome.GEdit</command>
+        </para>
+
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+        <para>
+            <citerefentry><refentrytitle>flatpak</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+            <citerefentry><refentrytitle>flatpak-list</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/flatpak.xml b/doc/flatpak.xml
new file mode 100644 (file)
index 0000000..72c0e13
--- /dev/null
@@ -0,0 +1,446 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="flatpak">
+
+    <refentryinfo>
+        <title>flatpak</title>
+        <productname>flatpak</productname>
+
+        <authorgroup>
+            <author>
+                <contrib>Developer</contrib>
+                <firstname>Alexander</firstname>
+                <surname>Larsson</surname>
+                <email>alexl@redhat.com</email>
+            </author>
+        </authorgroup>
+    </refentryinfo>
+
+    <refmeta>
+        <refentrytitle>flatpak</refentrytitle>
+        <manvolnum>1</manvolnum>
+    </refmeta>
+
+    <refnamediv>
+        <refname>flatpak</refname>
+        <refpurpose>Build, install and run applications and runtimes</refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+            <cmdsynopsis>
+                <command>flatpak</command>
+                <arg choice="opt" rep="repeat">OPTION</arg>
+                <arg choice="req">COMMAND</arg>
+            </cmdsynopsis>
+    </refsynopsisdiv>
+
+    <refsect1>
+        <title>Description</title>
+
+        <para>
+            flatpak is a tool for managing applications and the runtimes
+            they use. In the flatpak model, applications can be built and
+            distributed independently from the host system they are used
+            on, and they are isolated from the host system ('sandboxed')
+            to some degree, at runtime.
+        </para>
+
+        <para>
+            flatpak can operate in system-wide or per-user mode. The system-wide
+            data (runtimes, applications and configuration) is located in
+            <filename>$prefix/var/lib/flatpak/</filename>, and the per-user
+            data is in <filename>$HOME/.local/share/flatpak/</filename>.
+            Below these locations, there is a local repository in the
+            <filename>repo/</filename> subdirectory and installed runtimes
+            and applications are in the corresponding <filename>runtime/</filename>
+            and <filename>app/</filename> subdirectories.
+        </para>
+
+        <para>
+            System-wide remotes can be statically preconfigured by dropping
+            config fragments into <filename>/etc/flatpak/remotes.d/</filename>.
+        </para>
+
+        <para>
+            In addition to the system-wide installation in <filename>$prefix/var/lib/flatpak/</filename>,
+            which is always considered the default one unless overridden, more
+            system-wide installations can be defined via configuration files in
+            <filename>/etc/flatpak/installations.d/</filename>, which must define
+            at least the id of the installation and the absolute path to it.
+            Other optional parameters like <arg choice="plain">DisplayName</arg>,
+            <arg choice="plain">Priority</arg> or <arg choice="plain">StorageType</arg>
+            are also supported.
+        </para>
+
+        <para>
+            flatpak uses OSTree to distribute and deploy data. The repositories
+            it uses are OSTree repositories and can be manipulated with the
+            <command>ostree</command> utility. Installed runtimes and
+            applications are OSTree checkouts.
+        </para>
+    </refsect1>
+
+    <refsect1>
+        <title>Options</title>
+
+        <para>The following options are understood:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><option>-h</option></term>
+                <term><option>--help</option></term>
+
+                <listitem><para>
+                    Show help options and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>-v</option></term>
+                <term><option>--verbose</option></term>
+
+                <listitem><para>
+                    Print debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--ostree-verbose</option></term>
+
+                <listitem><para>
+                    Print OSTree debug information during command processing.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--version</option></term>
+
+                <listitem><para>
+                    Print version information and exit.
+                </para></listitem>
+            </varlistentry>
+
+           <varlistentry>
+                <term><option>--default-arch</option></term>
+
+                <listitem><para>
+                    Print the default arch and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--supported-arches</option></term>
+
+                <listitem><para>
+                    Print the supported arches in priority order and exit.
+                </para></listitem>
+            </varlistentry>
+
+            <varlistentry>
+                <term><option>--gl-drivers</option></term>
+
+                <listitem><para>
+                    Print the list of active gl drivers and exit.
+                </para></listitem>
+            </varlistentry>
+
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Commands</title>
+
+        <para>Commands for managing installed applications and runtimes:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-install</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Install an application or a runtime from a remote or bundle.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-update</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Update an installed application or runtime.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-uninstall</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Uninstall an installed application or runtime.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-list</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    List installed applications and/or runtimes.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-info</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Show information for an installed application or runtime.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-config</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Manage flatpak configuration.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+
+
+        <para>Commands for finding applications and runtimes:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-search</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Search for applications and runtimes.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+
+
+        <para>Commands for running applications:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-run</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Run an application.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-override</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Override permissions for an application.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-make-current</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Specify the default version to run.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-enter</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Enter the namespace of a running application.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+
+        <para>Commands for managing file access:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-document-export</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Grant an application access to a specific file.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-document-unexport</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Revoke access to a specific file.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-document-info</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Show information about a specific file.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-document-list</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    List exported files.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+
+
+        <para>Commands for managing remote repositories:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remotes</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    List all configured remote repositories.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remote-add</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Add a new remote repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remote-modify</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Modify properties of a configured remote repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remote-delete</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Delete a configured remote repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remote-ls</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    List contents of a configured remote repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-remote-info</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Show information about a ref in a configured remote repository.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+
+        <para>Commands for building applications:</para>
+
+        <variablelist>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-init</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Initialize a build directory.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Run a build command in a build directory.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-finish</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Finalizes a build directory for export.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-export</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Export a build directory to a repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-bundle</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Create a bundle file from a build directory.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-import-bundle</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Import a file bundle into a local repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-sign</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Sign an application or runtime after its been exported.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-update-repo</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Update the summary file in a repository.
+                </para></listitem>
+            </varlistentry>
+            <varlistentry>
+                <term><citerefentry><refentrytitle>flatpak-build-commit-from</refentrytitle><manvolnum>1</manvolnum></citerefentry></term>
+
+                <listitem><para>
+                    Create a new commit based on an existing ref.
+                </para></listitem>
+            </varlistentry>
+        </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>Environment</title>
+            <para>
+              Besides standard environment variables such as <envar>XDG_DATA_DIRS</envar> and
+              <envar>XDG_DATA_HOME</envar>, flatpak is consulting some of its own.
+            </para>
+            <variablelist>
+                <varlistentry>
+                    <term><envar>FLATPAK_USER_DIR</envar></term>
+
+                    <listitem><para>
+                      The location of the per-user installation. If this is not set,
+                      <filename>$XDG_DATA_HOME/flatpak</filename> is used.
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><envar>FLATPAK_SYSTEM_DIR</envar></term>
+
+                    <listitem><para>
+                      The location of the default system-wide installation. If this is not set,
+                      <filename>/var/lib/flatpak</filename> is used (unless overridden at build
+                      time by --localstatedir or --with-system-install-dir).
+                    </para></listitem>
+                </varlistentry>
+                <varlistentry>
+                    <term><envar>FLATPAK_CONFIG_DIR</envar></term>
+
+                    <listitem><para>
+                      The location of flatpak site configuration. If this is not set,
+                      <filename>/etc/flatpak</filename> is used (unless overridden at build
+                      time by --sysconfdir).
+                    </para></listitem>
+                </varlistentry>
+            </variablelist>
+    </refsect1>
+
+    <refsect1>
+        <title>See also</title>
+
+            <para>
+                <citerefentry><refentrytitle>ostree</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>ostree.repo</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>flatpak-remote</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+            </para>
+
+    </refsect1>
+
+</refentry>
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
new file mode 100644 (file)
index 0000000..dd14496
--- /dev/null
@@ -0,0 +1,39 @@
+DOC_MODULE = flatpak
+DOC_MAIN_SGML_FILE = flatpak-docs.xml
+DOC_SOURCE_DIR = $(top_srcdir)/lib $(top_builddir)/lib
+
+SCAN_OPTIONS = --rebuild-types \
+    --ignore-decorators='FLATPAK_EXTERN'
+SCANGOBJ_OPTIONS =
+MKDB_OPTIONS = --output-format=xml --name-space=flatpak
+FIXXREF_OPTIONS =
+
+HFILE_GLOB = $(top_srcdir)/lib/*.h $(top_builddir)/lib/*.h
+CFILE_GLOB = $(top_srcdir)/lib/*.c
+
+IGNORE_HFILES = \
+       flatpak-enum-types.h \
+       flatpak-installed-ref-private.h \
+       flatpak-remote-ref-private.h \
+       flatpak-remote-private.h
+
+EXTRA_HFILES =
+
+HTML_IMAGES =
+
+content_files =
+expand_content_files = 
+
+AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib $(BASE_CFLAGS)
+GTKDOC_LIBS = $(top_builddir)/libflatpak.la $(BASE_LIBS)
+
+include $(top_srcdir)/gtk-doc.make
+
+EXTRA_DIST += version.xml.in
+
+if ENABLE_GTK_DOC_CHECK
+TESTS_ENVIRONMENT = \
+       DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
+       SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
+TESTS = $(GTKDOC_CHECK)
+endif
diff --git a/doc/reference/Makefile.in b/doc/reference/Makefile.in
new file mode 100644 (file)
index 0000000..755a859
--- /dev/null
@@ -0,0 +1,1211 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- mode: makefile -*-
+
+####################################
+# Everything below here is generic #
+####################################
+VPATH = @srcdir@
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \  ]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc/reference
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libglnx/libglnx.m4 \
+       $(top_srcdir)/m4/attributes.m4 $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/glibtests.m4 $(top_srcdir)/m4/gtk-doc.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = version.xml
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red='\e[0;31m'; \
+    grn='\e[0;32m'; \
+    lgn='\e[1;32m'; \
+    blu='\e[1;34m'; \
+    mgn='\e[0;35m'; \
+    brg='\e[1m'; \
+    std='\e[m'; \
+  fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__recheck_rx = ^[    ]*:recheck:[    ]*
+am__global_test_result_rx = ^[         ]*:global-test-result:[         ]*
+am__copy_in_global_log_rx = ^[         ]*:copy-in-global-log:[         ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+  recheck = 1; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+        { \
+          if ((getline line2 < ($$0 ".log")) < 0) \
+           recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+        { \
+          recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+        { \
+          break; \
+        } \
+    }; \
+  if (recheck) \
+    print $$0; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+  print "fatal: making $@: " msg | "cat >&2"; \
+  exit 1; \
+} \
+function rst_section(header) \
+{ \
+  print header; \
+  len = length(header); \
+  for (i = 1; i <= len; i = i + 1) \
+    printf "="; \
+  printf "\n\n"; \
+} \
+{ \
+  copy_in_global_log = 1; \
+  global_test_result = "RUN"; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+         fatal("failed to read from " $$0 ".trs"); \
+      if (line ~ /$(am__global_test_result_rx)/) \
+        { \
+          sub("$(am__global_test_result_rx)", "", line); \
+          sub("[       ]*$$", "", line); \
+          global_test_result = line; \
+        } \
+      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+        copy_in_global_log = 0; \
+    }; \
+  if (copy_in_global_log) \
+    { \
+      rst_section(global_test_result ": " $$0); \
+      while ((rc = (getline line < ($$0 ".log"))) != 0) \
+      { \
+        if (rc < 0) \
+          fatal("failed to read from " $$0 ".log"); \
+        print line; \
+      }; \
+      printf "\n"; \
+    }; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test.  Creates the
+# directory for the log if needed.  Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log.  Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup);                                     \
+$(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
+srcdir=$(srcdir); export srcdir;                       \
+case "$@" in                                           \
+  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;   \
+    *) am__odir=.;;                                    \
+esac;                                                  \
+test "x$$am__odir" = x"." || test -d "$$am__odir"      \
+  || $(MKDIR_P) "$$am__odir" || exit $$?;              \
+if test -f "./$$f"; then dir=./;                       \
+elif test -f "$$f"; then dir=;                         \
+else dir="$(srcdir)/"; fi;                             \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
+case " $(XFAIL_TESTS) " in                             \
+  *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed).  The result is saved in the shell variable
+# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+  bases='$(TEST_LOGS)'; \
+  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+  bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+       $(TEST_LOG_FLAGS)
+am__set_b = \
+  case '$@' in \
+    */*) \
+      case '$*' in \
+        */*) b='$*';; \
+          *) b=`echo '$@' | sed 's/\.log$$//'`; \
+       esac;; \
+    *) \
+      b='$*';; \
+  esac
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.xml.in \
+       $(top_srcdir)/gtk-doc.make $(top_srcdir)/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_GLIB_CFLAGS = @APPSTREAM_GLIB_CFLAGS@
+APPSTREAM_GLIB_LIBS = @APPSTREAM_GLIB_LIBS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+BASE_LIBS = @BASE_LIBS@
+BWRAP = @BWRAP@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DBUS_CONFIG_DIR = @DBUS_CONFIG_DIR@
+DBUS_SERVICE_DIR = @DBUS_SERVICE_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEP_GPGME_CFLAGS = @DEP_GPGME_CFLAGS@
+DEP_GPGME_LIBS = @DEP_GPGME_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLATPAK_INTERFACE_AGE = @FLATPAK_INTERFACE_AGE@
+FLATPAK_MAJOR_VERSION = @FLATPAK_MAJOR_VERSION@
+FLATPAK_MICRO_VERSION = @FLATPAK_MICRO_VERSION@
+FLATPAK_MINOR_VERSION = @FLATPAK_MINOR_VERSION@
+FLATPAK_VERSION = @FLATPAK_VERSION@
+FUSE_CFLAGS = @FUSE_CFLAGS@
+FUSE_LIBS = @FUSE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GPGME_CONFIG = @GPGME_CONFIG@
+GPGME_PTHREAD_CFLAGS = @GPGME_PTHREAD_CFLAGS@
+GPGME_PTHREAD_LIBS = @GPGME_PTHREAD_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
+INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
+JSON_CFLAGS = @JSON_CFLAGS@
+JSON_LIBS = @JSON_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@
+LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OSTREE_CFLAGS = @OSTREE_CFLAGS@
+OSTREE_LIBS = @OSTREE_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PRIVILEGED_GROUP = @PRIVILEGED_GROUP@
+PROFILE_DIR = @PROFILE_DIR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+STRIP = @STRIP@
+SUDO_BIN = @SUDO_BIN@
+SYSTEM_FONTS_DIR = @SYSTEM_FONTS_DIR@
+SYSTEM_FONT_CACHE_DIRS = @SYSTEM_FONT_CACHE_DIRS@
+SYSTEM_INSTALL_DIR = @SYSTEM_INSTALL_DIR@
+USE_NLS = @USE_NLS@
+VALGRIND = @VALGRIND@
+VALGRIND_ENABLED = @VALGRIND_ENABLED@
+VALGRIND_HAVE_TOOL_memcheck = @VALGRIND_HAVE_TOOL_memcheck@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+XAUTH_CFLAGS = @XAUTH_CFLAGS@
+XAUTH_LIBS = @XAUTH_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMLCATALOG = @XMLCATALOG@
+XMLTO = @XMLTO@
+XMLTO_FLAGS = @XMLTO_FLAGS@
+XML_CATALOG_FILE = @XML_CATALOG_FILE@
+XSLTPROC = @XSLTPROC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+installed_test_metadir = @installed_test_metadir@
+installed_testdir = @installed_testdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
+systemduserunitdir = @systemduserunitdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+DOC_MODULE = flatpak
+DOC_MAIN_SGML_FILE = flatpak-docs.xml
+DOC_SOURCE_DIR = $(top_srcdir)/lib $(top_builddir)/lib
+SCAN_OPTIONS = --rebuild-types \
+    --ignore-decorators='FLATPAK_EXTERN'
+
+SCANGOBJ_OPTIONS = 
+MKDB_OPTIONS = --output-format=xml --name-space=flatpak
+FIXXREF_OPTIONS = 
+HFILE_GLOB = $(top_srcdir)/lib/*.h $(top_builddir)/lib/*.h
+CFILE_GLOB = $(top_srcdir)/lib/*.c
+IGNORE_HFILES = \
+       flatpak-enum-types.h \
+       flatpak-installed-ref-private.h \
+       flatpak-remote-ref-private.h \
+       flatpak-remote-private.h
+
+EXTRA_HFILES = 
+HTML_IMAGES = 
+content_files = 
+expand_content_files = 
+AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib $(BASE_CFLAGS)
+GTKDOC_LIBS = $(top_builddir)/libflatpak.la $(BASE_LIBS)
+@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = 
+@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE)
+SETUP_FILES = \
+       $(content_files)                \
+       $(expand_content_files)         \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt
+
+EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) version.xml.in
+DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \
+       html-build.stamp pdf-build.stamp \
+       sgml.stamp html.stamp pdf.stamp
+
+SCANOBJ_FILES = \
+       $(DOC_MODULE).args       \
+       $(DOC_MODULE).hierarchy  \
+       $(DOC_MODULE).interfaces \
+       $(DOC_MODULE).prerequisites \
+       $(DOC_MODULE).signals
+
+REPORT_FILES = \
+       $(DOC_MODULE)-undocumented.txt \
+       $(DOC_MODULE)-undeclared.txt \
+       $(DOC_MODULE)-unused.txt
+
+CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
+@GTK_DOC_BUILD_HTML_FALSE@HTML_BUILD_STAMP = 
+@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp
+@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = 
+@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp
+
+#### setup ####
+GTK_DOC_V_SETUP = $(GTK_DOC_V_SETUP_@AM_V@)
+GTK_DOC_V_SETUP_ = $(GTK_DOC_V_SETUP_@AM_DEFAULT_V@)
+GTK_DOC_V_SETUP_0 = @echo "  DOC   Preparing build";
+
+#### scan ####
+GTK_DOC_V_SCAN = $(GTK_DOC_V_SCAN_@AM_V@)
+GTK_DOC_V_SCAN_ = $(GTK_DOC_V_SCAN_@AM_DEFAULT_V@)
+GTK_DOC_V_SCAN_0 = @echo "  DOC   Scanning header files";
+GTK_DOC_V_INTROSPECT = $(GTK_DOC_V_INTROSPECT_@AM_V@)
+GTK_DOC_V_INTROSPECT_ = $(GTK_DOC_V_INTROSPECT_@AM_DEFAULT_V@)
+GTK_DOC_V_INTROSPECT_0 = @echo "  DOC   Introspecting gobjects";
+
+#### xml ####
+GTK_DOC_V_XML = $(GTK_DOC_V_XML_@AM_V@)
+GTK_DOC_V_XML_ = $(GTK_DOC_V_XML_@AM_DEFAULT_V@)
+GTK_DOC_V_XML_0 = @echo "  DOC   Building XML";
+
+#### html ####
+GTK_DOC_V_HTML = $(GTK_DOC_V_HTML_@AM_V@)
+GTK_DOC_V_HTML_ = $(GTK_DOC_V_HTML_@AM_DEFAULT_V@)
+GTK_DOC_V_HTML_0 = @echo "  DOC   Building HTML";
+GTK_DOC_V_XREF = $(GTK_DOC_V_XREF_@AM_V@)
+GTK_DOC_V_XREF_ = $(GTK_DOC_V_XREF_@AM_DEFAULT_V@)
+GTK_DOC_V_XREF_0 = @echo "  DOC   Fixing cross-references";
+
+#### pdf ####
+GTK_DOC_V_PDF = $(GTK_DOC_V_PDF_@AM_V@)
+GTK_DOC_V_PDF_ = $(GTK_DOC_V_PDF_@AM_DEFAULT_V@)
+GTK_DOC_V_PDF_0 = @echo "  DOC   Building PDF";
+@ENABLE_GTK_DOC_CHECK_TRUE@TESTS_ENVIRONMENT = \
+@ENABLE_GTK_DOC_CHECK_TRUE@    DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
+@ENABLE_GTK_DOC_CHECK_TRUE@    SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
+
+@ENABLE_GTK_DOC_CHECK_TRUE@TESTS = $(GTKDOC_CHECK)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .log .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/reference/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --foreign doc/reference/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+$(top_srcdir)/gtk-doc.make $(am__empty):
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+version.xml: $(top_builddir)/config.status $(srcdir)/version.xml.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+       rm -f $< $@
+       $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+       @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+       @$(am__set_TESTS_bases); \
+       am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+       redo_bases=`for i in $$bases; do \
+                     am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+                   done`; \
+       if test -n "$$redo_bases"; then \
+         redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+         redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+         if $(am__make_dryrun); then :; else \
+           rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+         fi; \
+       fi; \
+       if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       elif test -n "$$redo_logs"; then \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi; \
+       if $(am__make_dryrun); then :; else \
+         st=0;  \
+         errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+         for i in $$redo_bases; do \
+           test -f $$i.trs && test -r $$i.trs \
+             || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+           test -f $$i.log && test -r $$i.log \
+             || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+         done; \
+         test $$st -eq 0 || exit 1; \
+       fi
+       @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+       ws='[   ]'; \
+       results=`for b in $$bases; do echo $$b.trs; done`; \
+       test -n "$$results" || results=/dev/null; \
+       all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
+       pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
+       fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
+       skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
+       xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+       xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+       error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+       if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+         success=true; \
+       else \
+         success=false; \
+       fi; \
+       br='==================='; br=$$br$$br$$br$$br; \
+       result_count () \
+       { \
+           if test x"$$1" = x"--maybe-color"; then \
+             maybe_colorize=yes; \
+           elif test x"$$1" = x"--no-color"; then \
+             maybe_colorize=no; \
+           else \
+             echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+           fi; \
+           shift; \
+           desc=$$1 count=$$2; \
+           if test $$maybe_colorize = yes && test $$count -gt 0; then \
+             color_start=$$3 color_end=$$std; \
+           else \
+             color_start= color_end=; \
+           fi; \
+           echo "$${color_start}# $$desc $$count$${color_end}"; \
+       }; \
+       create_testsuite_report () \
+       { \
+         result_count $$1 "TOTAL:" $$all   "$$brg"; \
+         result_count $$1 "PASS: " $$pass  "$$grn"; \
+         result_count $$1 "SKIP: " $$skip  "$$blu"; \
+         result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+         result_count $$1 "FAIL: " $$fail  "$$red"; \
+         result_count $$1 "XPASS:" $$xpass "$$red"; \
+         result_count $$1 "ERROR:" $$error "$$mgn"; \
+       }; \
+       {                                                               \
+         echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
+           $(am__rst_title);                                           \
+         create_testsuite_report --no-color;                           \
+         echo;                                                         \
+         echo ".. contents:: :depth: 2";                               \
+         echo;                                                         \
+         for b in $$bases; do echo $$b; done                           \
+           | $(am__create_global_log);                                 \
+       } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
+       mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
+       if $$success; then                                              \
+         col="$$grn";                                                  \
+        else                                                           \
+         col="$$red";                                                  \
+         test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
+       fi;                                                             \
+       echo "$${col}$$br$${std}";                                      \
+       echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
+       echo "$${col}$$br$${std}";                                      \
+       create_testsuite_report --maybe-color;                          \
+       echo "$$col$$br$$std";                                          \
+       if $$success; then :; else                                      \
+         echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
+         if test -n "$(PACKAGE_BUGREPORT)"; then                       \
+           echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+         fi;                                                           \
+         echo "$$col$$br$$std";                                        \
+       fi;                                                             \
+       $$success || exit 1
+
+check-TESTS:
+       @list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
+       @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+       @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+       @set +e; $(am__set_TESTS_bases); \
+       log_list=`for i in $$bases; do echo $$i.log; done`; \
+       trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+       log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+       exit $$?;
+recheck: all 
+       @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+       @set +e; $(am__set_TESTS_bases); \
+       bases=`for i in $$bases; do echo $$i; done \
+                | $(am__list_recheck_tests)` || exit 1; \
+       log_list=`for i in $$bases; do echo $$i.log; done`; \
+       log_list=`echo $$log_list`; \
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+               am__force_recheck=am--force-recheck \
+               TEST_LOGS="$$log_list"; \
+       exit $$?
+.test.log:
+       @p='$<'; \
+       $(am__set_b); \
+       $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+       --log-file $$b.log --trs-file $$b.trs \
+       $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@      @p='$<'; \
+@am__EXEEXT_TRUE@      $(am__set_b); \
+@am__EXEEXT_TRUE@      $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@      --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@      $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@      "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+@ENABLE_GTK_DOC_FALSE@all-local:
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+       -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+       -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+       -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic \
+       maintainer-clean-local
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-local
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+       clean-generic clean-libtool clean-local cscopelist-am ctags-am \
+       dist-hook distclean distclean-generic distclean-libtool \
+       distclean-local distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-man install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic maintainer-clean-local mostlyclean \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       recheck tags-am uninstall uninstall-am uninstall-local
+
+.PRECIOUS: Makefile
+
+
+gtkdoc-check.test: Makefile
+       $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
+               echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
+               chmod +x $@
+
+all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+.PHONY: all-gtk-doc
+
+@ENABLE_GTK_DOC_TRUE@all-local: all-gtk-doc
+
+docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+
+$(REPORT_FILES): sgml-build.stamp
+
+setup-build.stamp:
+       -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+         files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
+         if test "x$$files" != "x" ; then \
+           for file in $$files ; do \
+             destdir=`dirname $(abs_builddir)/$$file`; \
+             test -d "$$destdir" || mkdir -p "$$destdir"; \
+             test -f $(abs_srcdir)/$$file && \
+               cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
+           done; \
+         fi; \
+       fi
+       $(AM_V_at)touch setup-build.stamp
+
+scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
+       $(GTK_DOC_V_SCAN)_source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+         _source_dir="$${_source_dir} --source-dir=$$i" ; \
+       done ; \
+       gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
+       $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
+         scanobj_options=""; \
+         gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+         if test "$$?" = "0"; then \
+           if test "x$(V)" = "x1"; then \
+             scanobj_options="--verbose"; \
+           fi; \
+         fi; \
+         CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
+         gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
+       else \
+         for i in $(SCANOBJ_FILES) ; do \
+           test -f $$i || touch $$i ; \
+         done \
+       fi
+       $(AM_V_at)touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
+       @true
+
+sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) xml/gtkdocentities.ent
+       $(GTK_DOC_V_XML)_source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+         _source_dir="$${_source_dir} --source-dir=$$i" ; \
+       done ; \
+       gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
+       $(AM_V_at)touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+$(DOC_MAIN_SGML_FILE): sgml-build.stamp
+       @true
+
+xml/gtkdocentities.ent: Makefile
+       $(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \
+               echo "<!ENTITY package \"$(PACKAGE)\">"; \
+               echo "<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
+               echo "<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
+               echo "<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
+               echo "<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
+               echo "<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
+               echo "<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
+       ) > $@
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
+       $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
+       mkhtml_options=""; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+       if test "$$?" = "0"; then \
+         if test "x$(V)" = "x1"; then \
+           mkhtml_options="$$mkhtml_options --verbose"; \
+         fi; \
+       fi; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
+       if test "$$?" = "0"; then \
+         mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
+       fi; \
+       cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+       -@test "x$(HTML_IMAGES)" = "x" || \
+       for file in $(HTML_IMAGES) ; do \
+         test -f $(abs_srcdir)/$$file && cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
+         test -f $(abs_builddir)/$$file && cp $(abs_builddir)/$$file $(abs_builddir)/html; \
+       done;
+       $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       $(AM_V_at)touch html-build.stamp
+
+pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
+       $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
+       mkpdf_options=""; \
+       gtkdoc-mkpdf 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+       if test "$$?" = "0"; then \
+         if test "x$(V)" = "x1"; then \
+           mkpdf_options="$$mkpdf_options --verbose"; \
+         fi; \
+       fi; \
+       if test "x$(HTML_IMAGES)" != "x"; then \
+         for img in $(HTML_IMAGES); do \
+           part=`dirname $$img`; \
+           echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
+           if test $$? != 0; then \
+             mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
+           fi; \
+         done; \
+       fi; \
+       gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
+       $(AM_V_at)touch pdf-build.stamp
+
+##############
+
+clean-local:
+       @rm -f *~ *.bak
+       @rm -rf .libs
+       @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
+         rm -f $(DOC_MODULE).types; \
+       fi
+       @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
+         rm -f $(DOC_MODULE)-sections.txt; \
+       fi
+
+distclean-local:
+       @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
+           $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+       @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+           rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
+       fi
+
+maintainer-clean-local:
+       @rm -rf xml html
+
+install-data-local:
+       @installfiles=`echo $(builddir)/html/*`; \
+       if test "$$installfiles" = '$(builddir)/html/*'; \
+       then echo 1>&2 'Nothing to install' ; \
+       else \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+         else \
+           installdir="$(DESTDIR)$(TARGET_DIR)"; \
+         fi; \
+         $(mkinstalldirs) $${installdir} ; \
+         for i in $$installfiles; do \
+           echo ' $(INSTALL_DATA) '$$i ; \
+           $(INSTALL_DATA) $$i $${installdir}; \
+         done; \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
+             $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
+         fi; \
+         $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
+       fi
+
+uninstall-local:
+       @if test -n "$(DOC_MODULE_VERSION)"; then \
+         installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+       else \
+         installdir="$(DESTDIR)$(TARGET_DIR)"; \
+       fi; \
+       rm -rf $${installdir}
+
+#
+# Require gtk-doc when making dist
+#
+@HAVE_GTK_DOC_TRUE@dist-check-gtkdoc: docs
+@HAVE_GTK_DOC_FALSE@dist-check-gtkdoc:
+@HAVE_GTK_DOC_FALSE@   @echo "*** gtk-doc is needed to run 'make dist'.         ***"
+@HAVE_GTK_DOC_FALSE@   @echo "*** gtk-doc was not found when 'configure' ran.   ***"
+@HAVE_GTK_DOC_FALSE@   @echo "*** please install gtk-doc and rerun 'configure'. ***"
+@HAVE_GTK_DOC_FALSE@   @false
+
+dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
+       @mkdir $(distdir)/html
+       @cp ./html/* $(distdir)/html
+       @-cp ./$(DOC_MODULE).pdf $(distdir)/
+       @-cp ./$(DOC_MODULE).types $(distdir)/
+       @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
+       @cd $(distdir) && rm -f $(DISTCLEANFILES)
+       @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
+
+.PHONY : dist-hook-local docs
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/reference/flatpak-docs.xml b/doc/reference/flatpak-docs.xml
new file mode 100644 (file)
index 0000000..d74a6fb
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+  <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
+  <!ENTITY version SYSTEM "version.xml">
+]>
+<book id="index">
+  <bookinfo>
+    <title>Flatpak Library Reference Manual</title>
+    <releaseinfo>
+      For flatpak &version;
+    </releaseinfo>
+  </bookinfo>
+
+  <chapter>
+    <title>Flatpak</title>
+    <xi:include href="xml/flatpak-installation.xml"/>
+    <xi:include href="xml/flatpak-ref.xml"/>
+    <xi:include href="xml/flatpak-installed-ref.xml"/>
+    <xi:include href="xml/flatpak-remote-ref.xml"/>
+    <xi:include href="xml/flatpak-remote.xml"/>
+    <xi:include href="xml/flatpak-bundle-ref.xml"/>
+    <xi:include href="xml/flatpak-error.xml"/>
+    <xi:include href="xml/flatpak-version-macros.xml"/>
+  </chapter>
+
+  <chapter id="object-tree">
+    <title>Object Hierarchy</title>
+    <xi:include href="xml/tree_index.sgml"/>
+  </chapter>
+
+  <index id="full-api-index">
+    <title>API Index</title>
+    <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+  </index>
+
+<!-- no deprecated api yet
+  <index id="deprecated-api-index" role="deprecated">
+    <title>Index of deprecated API</title>
+    <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
+  </index>
+-->
+
+  <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
diff --git a/doc/reference/flatpak-overrides.txt b/doc/reference/flatpak-overrides.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/doc/reference/flatpak-sections.txt b/doc/reference/flatpak-sections.txt
new file mode 100644 (file)
index 0000000..fa16003
--- /dev/null
@@ -0,0 +1,170 @@
+<SECTION>
+<FILE>flatpak-installation</FILE>
+<TITLE>FlatpakInstallation</TITLE>
+FlatpakInstallation
+flatpak_installation_new_system
+flatpak_installation_new_system_with_id
+flatpak_installation_new_user
+flatpak_installation_new_for_path
+flatpak_installation_get_is_user
+flatpak_installation_get_path
+flatpak_installation_create_monitor
+flatpak_installation_install
+flatpak_installation_install_full
+flatpak_installation_update
+flatpak_installation_update_full
+flatpak_installation_uninstall
+flatpak_installation_launch
+flatpak_installation_get_current_installed_app
+flatpak_installation_get_display_name
+flatpak_installation_get_id
+flatpak_installation_get_installed_ref
+flatpak_installation_get_priority
+flatpak_installation_get_storage_type
+flatpak_installation_list_installed_refs
+flatpak_installation_list_installed_refs_by_kind
+flatpak_installation_list_installed_refs_for_update
+flatpak_installation_list_installed_related_refs_sync
+flatpak_installation_list_remote_refs_sync
+flatpak_installation_list_remote_related_refs_sync
+flatpak_installation_list_remotes
+flatpak_installation_get_remote_by_name
+flatpak_installation_fetch_remote_metadata_sync
+flatpak_installation_fetch_remote_ref_sync
+flatpak_installation_fetch_remote_size_sync
+flatpak_installation_load_app_overrides
+flatpak_installation_update_appstream_sync
+flatpak_installation_install_bundle
+flatpak_installation_install_ref_file
+flatpak_installation_drop_caches
+flatpak_installation_modify_remote
+flatpak_installation_remove_remote
+flatpak_installation_update_remote_sync
+flatpak_get_default_arch
+flatpak_get_supported_arches
+flatpak_get_system_installations
+FlatpakProgressCallback
+FlatpakUpdateFlags
+FlatpakInstallFlags
+FlatpakStorageType
+<SUBSECTION Standard>
+FLATPAK_INSTALLATION
+FLATPAK_IS_INSTALLATION
+FLATPAK_TYPE_INSTALLATION
+FlatpakInstallationClass
+flatpak_installation_get_type
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-installed-ref</FILE>
+<TITLE>FlatpakInstalledRef</TITLE>
+FlatpakInstalledRef
+flatpak_installed_ref_get_deploy_dir
+flatpak_installed_ref_get_installed_size
+flatpak_installed_ref_get_is_current
+flatpak_installed_ref_get_latest_commit
+flatpak_installed_ref_get_origin
+flatpak_installed_ref_load_metadata
+flatpak_installed_ref_get_subpaths
+<SUBSECTION Standard>
+FlatpakInstalledRefClass
+FLATPAK_INSTALLED_REF
+FLATPAK_IS_INSTALLED_REF
+FLATPAK_TYPE_INSTALLED_REF
+flatpak_installed_ref_get_type
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-remote-ref</FILE>
+<TITLE>FlatpakRemoteRef</TITLE>
+FlatpakRemoteRef
+flatpak_remote_ref_get_remote_name
+<SUBSECTION Standard>
+FLATPAK_IS_REMOTE_REF
+FLATPAK_REMOTE_REF
+FLATPAK_TYPE_REMOTE_REF
+FlatpakRemoteRefClass
+flatpak_remote_ref_get_type
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-ref</FILE>
+<TITLE>FlatpakRef</TITLE>
+FlatpakRef
+FlatpakRefKind
+flatpak_ref_format_ref
+flatpak_ref_get_arch
+flatpak_ref_get_branch
+flatpak_ref_get_commit
+flatpak_ref_get_kind
+flatpak_ref_get_name
+flatpak_ref_parse
+<SUBSECTION Standard>
+FlatpakRefClass
+FLATPAK_IS_REF
+FLATPAK_REF
+FLATPAK_TYPE_REF
+flatpak_ref_get_type
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-remote</FILE>
+<TITLE>FlatpakRemote</TITLE>
+FlatpakRemote
+flatpak_remote_new
+flatpak_remote_get_name
+flatpak_remote_get_appstream_dir
+flatpak_remote_get_appstream_timestamp
+flatpak_remote_get_gpg_verify
+flatpak_remote_set_gpg_verify
+flatpak_remote_set_gpg_key
+flatpak_remote_get_noenumerate
+flatpak_remote_set_noenumerate
+flatpak_remote_get_prio
+flatpak_remote_set_prio
+flatpak_remote_get_title
+flatpak_remote_set_title
+flatpak_remote_get_url
+flatpak_remote_set_url
+flatpak_remote_get_disabled
+flatpak_remote_set_disabled
+<SUBSECTION Standard>
+FlatpakRemoteClass
+FLATPAK_IS_REMOTE
+FLATPAK_REMOTE
+FLATPAK_TYPE_REMOTE
+flatpak_remote_get_type
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-version-macros</FILE>
+FLATPAK_MAJOR_VERSION
+FLATPAK_MINOR_VERSION
+FLATPAK_MICRO_VERSION
+FLATPAK_EXTERN
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-error</FILE>
+FLATPAK_ERROR
+FlatpakError
+flatpak_error_quark
+</SECTION>
+
+<SECTION>
+<FILE>flatpak-bundle-ref</FILE>
+FlatpakBundleRef
+flatpak_bundle_ref_new
+flatpak_bundle_ref_get_file
+flatpak_bundle_ref_get_metadata
+flatpak_bundle_ref_get_appstream
+flatpak_bundle_ref_get_icon
+flatpak_bundle_ref_get_origin
+flatpak_bundle_ref_get_installed_size
+<SUBSECTION Standard>
+FlatpakBundleRefClass
+FLATPAK_TYPE_BUNDLE_REF
+FLATPAK_BUNDLE_REF
+FLATPAK_IS_BUNDLE_REF
+flatpak_bundle_ref_get_type
+</SECTION>
diff --git a/doc/reference/flatpak.types b/doc/reference/flatpak.types
new file mode 100644 (file)
index 0000000..f5148d9
--- /dev/null
@@ -0,0 +1,7 @@
+flatpak_bundle_ref_get_type
+flatpak_installation_get_type
+flatpak_installed_ref_get_type
+flatpak_ref_get_type
+flatpak_related_ref_get_type
+flatpak_remote_get_type
+flatpak_remote_ref_get_type
diff --git a/doc/reference/html/FlatpakInstallation.html b/doc/reference/html/FlatpakInstallation.html
new file mode 100644 (file)
index 0000000..0eeb1f1
--- /dev/null
@@ -0,0 +1,2697 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>FlatpakInstallation: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="ch01.html" title="Flatpak">
+<link rel="next" href="FlatpakRef.html" title="FlatpakRef">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#FlatpakInstallation.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#FlatpakInstallation.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="ch01.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="FlatpakRef.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="FlatpakInstallation"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="FlatpakInstallation.top_of_page"></a>FlatpakInstallation</span></h2>
+<p>FlatpakInstallation — Installation information</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="FlatpakInstallation.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-system" title="flatpak_installation_new_system ()">flatpak_installation_new_system</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-system-with-id" title="flatpak_installation_new_system_with_id ()">flatpak_installation_new_system_with_id</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-user" title="flatpak_installation_new_user ()">flatpak_installation_new_user</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-for-path" title="flatpak_installation_new_for_path ()">flatpak_installation_new_for_path</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-is-user" title="flatpak_installation_get_is_user ()">flatpak_installation_get_is_user</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GFile</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-path" title="flatpak_installation_get_path ()">flatpak_installation_get_path</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GFileMonitor</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-create-monitor" title="flatpak_installation_create_monitor ()">flatpak_installation_create_monitor</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install" title="flatpak_installation_install ()">flatpak_installation_install</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-full" title="flatpak_installation_install_full ()">flatpak_installation_install_full</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update" title="flatpak_installation_update ()">flatpak_installation_update</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-full" title="flatpak_installation_update_full ()">flatpak_installation_update_full</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-uninstall" title="flatpak_installation_uninstall ()">flatpak_installation_uninstall</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-launch" title="flatpak_installation_launch ()">flatpak_installation_launch</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-current-installed-app" title="flatpak_installation_get_current_installed_app ()">flatpak_installation_get_current_installed_app</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-display-name" title="flatpak_installation_get_display_name ()">flatpak_installation_get_display_name</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-id" title="flatpak_installation_get_id ()">flatpak_installation_get_id</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-installed-ref" title="flatpak_installation_get_installed_ref ()">flatpak_installation_get_installed_ref</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gint</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-priority" title="flatpak_installation_get_priority ()">flatpak_installation_get_priority</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstallation.html#FlatpakStorageType" title="enum FlatpakStorageType"><span class="returnvalue">FlatpakStorageType</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-storage-type" title="flatpak_installation_get_storage_type ()">flatpak_installation_get_storage_type</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs" title="flatpak_installation_list_installed_refs ()">flatpak_installation_list_installed_refs</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs-by-kind" title="flatpak_installation_list_installed_refs_by_kind ()">flatpak_installation_list_installed_refs_by_kind</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs-for-update" title="flatpak_installation_list_installed_refs_for_update ()">flatpak_installation_list_installed_refs_for_update</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-related-refs-sync" title="flatpak_installation_list_installed_related_refs_sync ()">flatpak_installation_list_installed_related_refs_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remote-refs-sync" title="flatpak_installation_list_remote_refs_sync ()">flatpak_installation_list_remote_refs_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remote-related-refs-sync" title="flatpak_installation_list_remote_related_refs_sync ()">flatpak_installation_list_remote_related_refs_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remotes" title="flatpak_installation_list_remotes ()">flatpak_installation_list_remotes</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="returnvalue">FlatpakRemote</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-remote-by-name" title="flatpak_installation_get_remote_by_name ()">flatpak_installation_get_remote_by_name</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GBytes</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-metadata-sync" title="flatpak_installation_fetch_remote_metadata_sync ()">flatpak_installation_fetch_remote_metadata_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="returnvalue">FlatpakRemoteRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-ref-sync" title="flatpak_installation_fetch_remote_ref_sync ()">flatpak_installation_fetch_remote_ref_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-size-sync" title="flatpak_installation_fetch_remote_size_sync ()">flatpak_installation_fetch_remote_size_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-load-app-overrides" title="flatpak_installation_load_app_overrides ()">flatpak_installation_load_app_overrides</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-appstream-sync" title="flatpak_installation_update_appstream_sync ()">flatpak_installation_update_appstream_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-bundle" title="flatpak_installation_install_bundle ()">flatpak_installation_install_bundle</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="returnvalue">FlatpakRemoteRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-ref-file" title="flatpak_installation_install_ref_file ()">flatpak_installation_install_ref_file</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-drop-caches" title="flatpak_installation_drop_caches ()">flatpak_installation_drop_caches</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()">flatpak_installation_modify_remote</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-remove-remote" title="flatpak_installation_remove_remote ()">flatpak_installation_remove_remote</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-remote-sync" title="flatpak_installation_update_remote_sync ()">flatpak_installation_update_remote_sync</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-get-default-arch" title="flatpak_get_default_arch ()">flatpak_get_default_arch</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *const *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-get-supported-arches" title="flatpak_get_supported_arches ()">flatpak_get_supported_arches</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GPtrArray</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstallation.html#flatpak-get-system-installations" title="flatpak_get_system_installations ()">flatpak_get_system_installations</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<span class="c_punctuation">(</span><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()">*FlatpakProgressCallback</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstallation.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="FlatpakInstallation.html#FlatpakInstallation-struct" title="struct FlatpakInstallation">FlatpakInstallation</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags">FlatpakUpdateFlags</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="FlatpakInstallation.html#FlatpakInstallFlags" title="enum FlatpakInstallFlags">FlatpakInstallFlags</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="FlatpakInstallation.html#FlatpakStorageType" title="enum FlatpakStorageType">FlatpakStorageType</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstallation.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> FlatpakInstallation
+</pre>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstallation.description"></a><h2>Description</h2>
+<p>FlatpakInstallation is the toplevel object that software installers
+should use to operate on an flatpak applications.</p>
+<p>An FlatpakInstallation object provides information about an installation
+location for flatpak applications. Typical installation locations are either
+system-wide (in $prefix/var/lib/flatpak) or per-user (in ~/.local/share/flatpak).</p>
+<p>FlatpakInstallation can list configured remotes as well as installed application
+and runtime references (in short: refs). It can also run, install, update and
+uninstall applications and runtimes.</p>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstallation.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-installation-new-system"></a><h3>flatpak_installation_new_system ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+flatpak_installation_new_system (<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                 <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> for the system-wide installation.</p>
+<div class="refsect3">
+<a name="flatpak-installation-new-system.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-new-system.returns"></a><h4>Returns</h4>
+<p>a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-new-system-with-id"></a><h3>flatpak_installation_new_system_with_id ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+flatpak_installation_new_system_with_id
+                               (<em class="parameter"><code>const <span class="type">char</span> *id</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> for the system-wide installation <em class="parameter"><code>id</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-new-system-with-id.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>id</p></td>
+<td class="parameter_description"><p>the ID of the system-wide installation. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-new-system-with-id.returns"></a><h4>Returns</h4>
+<p>a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-new-user"></a><h3>flatpak_installation_new_user ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+flatpak_installation_new_user (<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                               <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> for the per-user installation.</p>
+<div class="refsect3">
+<a name="flatpak-installation-new-user.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-new-user.returns"></a><h4>Returns</h4>
+<p>a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-new-for-path"></a><h3>flatpak_installation_new_for_path ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="returnvalue">FlatpakInstallation</span></a> *
+flatpak_installation_new_for_path (<em class="parameter"><code><span class="type">GFile</span> *path</code></em>,
+                                   <em class="parameter"><code><span class="type">gboolean</span> user</code></em>,
+                                   <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> for the installation at the given <em class="parameter"><code>path</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-new-for-path.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>path</p></td>
+<td class="parameter_description"><p>a <span class="type">GFile</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user</p></td>
+<td class="parameter_description"><p>whether this is a user-specific location</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-new-for-path.returns"></a><h4>Returns</h4>
+<p>a new <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-is-user"></a><h3>flatpak_installation_get_is_user ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_get_is_user (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns whether the installation is for a user-specific location.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-is-user.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-is-user.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> if <em class="parameter"><code>self</code></em>
+is a per-user installation</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-path"></a><h3>flatpak_installation_get_path ()</h3>
+<pre class="programlisting"><span class="returnvalue">GFile</span> *
+flatpak_installation_get_path (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns the installation location for <em class="parameter"><code>self</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-path.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-path.returns"></a><h4>Returns</h4>
+<p>an <span class="type">GFile</span>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-create-monitor"></a><h3>flatpak_installation_create_monitor ()</h3>
+<pre class="programlisting"><span class="returnvalue">GFileMonitor</span> *
+flatpak_installation_create_monitor (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                     <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                     <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Gets monitor object for the installation. The returned file monitor will
+emit the <span class="type">“changed”</span> signal whenever an application or runtime
+was installed, uninstalled or updated.</p>
+<div class="refsect3">
+<a name="flatpak-installation-create-monitor.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-create-monitor.returns"></a><h4>Returns</h4>
+<p>a new <span class="type">GFileMonitor</span> instance, or <code class="literal">NULL</code> on error. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-install"></a><h3>flatpak_installation_install ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_install (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                              <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                              <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                              <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                              <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                              <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                              <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                              <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                              <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                              <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Install a new application or runtime.</p>
+<p>Note that this function was originally written to always return a
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a>. Since 0.9.13, passing
+FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak
+repository without deploying them, however this function will
+be unable to provide information on the installed ref, so
+FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond
+accordingly.</p>
+<div class="refsect3">
+<a name="flatpak-installation-install.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>name of the remote to use</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>what this ref contains (an <a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a>)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app/runtime to fetch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>which branch to fetch (default: 'master'). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>progress callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-install.returns"></a><h4>Returns</h4>
+<p>The ref for the newly installed app or <code class="literal">NULL</code> on failure. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-install-full"></a><h3>flatpak_installation_install_full ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_install_full (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                   <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakInstallFlags" title="enum FlatpakInstallFlags"><span class="type">FlatpakInstallFlags</span></a> flags</code></em>,
+                                   <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                   <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                   <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                   <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                   <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                                   <em class="parameter"><code>const <span class="type">char</span> * const *subpaths</code></em>,
+                                   <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                                   <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                                   <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Install a new application or runtime.</p>
+<p>Note that this function was originally written to always return a
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a>. Since 0.9.13, passing
+FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak
+repository without deploying them, however this function will
+be unable to provide information on the installed ref, so
+FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond
+accordingly.</p>
+<div class="refsect3">
+<a name="flatpak-installation-install-full.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flags</p></td>
+<td class="parameter_description"><p>set of <a class="link" href="FlatpakInstallation.html#FlatpakInstallFlags" title="enum FlatpakInstallFlags"><span class="type">FlatpakInstallFlags</span></a> flag</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>name of the remote to use</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>what this ref contains (an <a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a>)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app/runtime to fetch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>which branch to fetch (default: 'master'). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>subpaths</p></td>
+<td class="parameter_description"><p>A list of subpaths to fetch, or <code class="literal">NULL</code> for everything. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>progress callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-install-full.returns"></a><h4>Returns</h4>
+<p>The ref for the newly installed app or <code class="literal">NULL</code> on failure. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-update"></a><h3>flatpak_installation_update ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_update (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                             <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags"><span class="type">FlatpakUpdateFlags</span></a> flags</code></em>,
+                             <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                             <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                             <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                             <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                             <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Update an application or runtime.</p>
+<div class="refsect3">
+<a name="flatpak-installation-update.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flags</p></td>
+<td class="parameter_description"><p>set of <a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags"><span class="type">FlatpakUpdateFlags</span></a> flag</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>whether this is an app or runtime</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app or runtime to update</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>architecture of the app or runtime to update (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>name of the branch of the app or runtime to update (default: master). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>the callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-update.returns"></a><h4>Returns</h4>
+<p>The ref for the newly updated app (or the same if no update) or <code class="literal">NULL</code> on failure. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-update-full"></a><h3>flatpak_installation_update_full ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_update_full (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                  <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags"><span class="type">FlatpakUpdateFlags</span></a> flags</code></em>,
+                                  <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                  <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                  <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                  <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                                  <em class="parameter"><code>const <span class="type">char</span> * const *subpaths</code></em>,
+                                  <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                                  <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                                  <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                  <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Update an application or runtime.</p>
+<div class="refsect3">
+<a name="flatpak-installation-update-full.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flags</p></td>
+<td class="parameter_description"><p>set of <a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags"><span class="type">FlatpakUpdateFlags</span></a> flag</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>whether this is an app or runtime</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app or runtime to update</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>architecture of the app or runtime to update (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>name of the branch of the app or runtime to update (default: master). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>subpaths</p></td>
+<td class="parameter_description"><p>A list of subpaths to fetch, or <code class="literal">NULL</code> for everything. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>the callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-update-full.returns"></a><h4>Returns</h4>
+<p>The ref for the newly updated app (or the same if no update) or <code class="literal">NULL</code> on failure. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-uninstall"></a><h3>flatpak_installation_uninstall ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_uninstall (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                                <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Uninstall an application or runtime.</p>
+<div class="refsect3">
+<a name="flatpak-installation-uninstall.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>what this ref contains (an <a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a>)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app or runtime to uninstall</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>architecture of the app or runtime to uninstall</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>name of the branch of the app or runtime to uninstall</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>the callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-uninstall.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> on success</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-launch"></a><h3>flatpak_installation_launch ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_launch (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                             <em class="parameter"><code>const <span class="type">char</span> *commit</code></em>,
+                             <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                             <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Launch an installed application.</p>
+<p>You can use <a class="link" href="FlatpakInstallation.html#flatpak-installation-get-installed-ref" title="flatpak_installation_get_installed_ref ()"><code class="function">flatpak_installation_get_installed_ref()</code></a> or
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-current-installed-app" title="flatpak_installation_get_current_installed_app ()"><code class="function">flatpak_installation_get_current_installed_app()</code></a> to find out what builds
+are available, in order to get a value for <em class="parameter"><code>commit</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-launch.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app to launch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to launch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>which branch of the application (default: "master"). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>commit</p></td>
+<td class="parameter_description"><p>the commit of <em class="parameter"><code>branch</code></em>
+to launch. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-launch.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code>, unless an error occurred</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-current-installed-app"></a><h3>flatpak_installation_get_current_installed_app ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_get_current_installed_app
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Get the last build of reference <em class="parameter"><code>name</code></em>
+ that was installed with
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install" title="flatpak_installation_install ()"><code class="function">flatpak_installation_install()</code></a>, or <code class="literal">NULL</code> if the reference has
+never been installed locally.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-current-installed-app.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>the name of the app</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-current-installed-app.returns"></a><h4>Returns</h4>
+<p>an <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-display-name"></a><h3>flatpak_installation_get_display_name ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_installation_get_display_name (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns the display name of the system installation for <em class="parameter"><code>self</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-display-name.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-display-name.returns"></a><h4>Returns</h4>
+<p>a string with the installation's display name. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-id"></a><h3>flatpak_installation_get_id ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_installation_get_id (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns the ID of the system installation for <em class="parameter"><code>self</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-id.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-id.returns"></a><h4>Returns</h4>
+<p>a string with the installation's ID. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-installed-ref"></a><h3>flatpak_installation_get_installed_ref ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_get_installed_ref
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Returns information about an installed ref, such as the available builds,
+its size, location, etc.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-installed-ref.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>whether this is an app or runtime</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app/runtime to fetch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>which branch to fetch (default: "master"). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-installed-ref.returns"></a><h4>Returns</h4>
+<p>an <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a>, or <code class="literal">NULL</code> if an error occurred. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-priority"></a><h3>flatpak_installation_get_priority ()</h3>
+<pre class="programlisting"><span class="returnvalue">gint</span>
+flatpak_installation_get_priority (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns the numeric priority of the system installation for <em class="parameter"><code>self</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-priority.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-priority.returns"></a><h4>Returns</h4>
+<p> an integer with the configured priority value</p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-storage-type"></a><h3>flatpak_installation_get_storage_type ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstallation.html#FlatpakStorageType" title="enum FlatpakStorageType"><span class="returnvalue">FlatpakStorageType</span></a>
+flatpak_installation_get_storage_type (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>);</pre>
+<p>Returns the type of storage of the system installation for <em class="parameter"><code>self</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-storage-type.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-storage-type.returns"></a><h4>Returns</h4>
+<p> a <a class="link" href="FlatpakInstallation.html#FlatpakStorageType" title="enum FlatpakStorageType"><span class="type">FlatpakStorageType</span></a></p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-installed-refs"></a><h3>flatpak_installation_list_installed_refs ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_installed_refs
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists the installed references.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakInstalledRef]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-installed-refs-by-kind"></a><h3>flatpak_installation_list_installed_refs_by_kind ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_installed_refs_by_kind
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists the installed references of a specific kind.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs-by-kind.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>the kind of installation</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs-by-kind.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakInstalledRef]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-installed-refs-for-update"></a><h3>flatpak_installation_list_installed_refs_for_update ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_installed_refs_for_update
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists the installed references that has a remote update that is not
+locally available. However, even though an app is not returned by this
+it can have local updates available that has not been deployed. Look
+at commit vs latest_commit on installed apps for this.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs-for-update.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-refs-for-update.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakInstalledRef]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-installed-related-refs-sync"></a><h3>flatpak_installation_list_installed_related_refs_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_installed_related_refs_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *ref</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists all the locally installed refs from <em class="parameter"><code>remote_name</code></em>
+ that are
+related to <em class="parameter"><code>ref</code></em>
+. These are things that are interesting to install,
+update, or uninstall together with <em class="parameter"><code>ref</code></em>
+. For instance, locale data
+or debug information.</p>
+<p>This function is similar to flatpak_installation_list_remote_related_refs_sync,
+but instead of looking at what is available on the remote, it only looks
+at the locally installed refs. This is useful for instance when you're
+looking for related refs to uninstall, or when you're planning to use
+FLATPAK_UPDATE_FLAGS_NO_PULL to install previously pulled refs.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-related-refs-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ref</p></td>
+<td class="parameter_description"><p>the ref</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-installed-related-refs-sync.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<span class="type">FlatpakRelatedRef</span> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakRelatedRef]</span></p>
+</div>
+<p class="since">Since: 0.6.7</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-remote-refs-sync"></a><h3>flatpak_installation_list_remote_refs_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_remote_refs_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists all the applications and runtimes in a remote.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-remote-refs-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-remote-refs-sync.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakRemoteRef]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-remote-related-refs-sync"></a><h3>flatpak_installation_list_remote_related_refs_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_remote_related_refs_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *ref</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists all the available refs on <em class="parameter"><code>remote_name</code></em>
+ that are related to
+<em class="parameter"><code>ref</code></em>
+, and the subpaths to use. These are things that are
+interesting to install, update, or uninstall together with
+<em class="parameter"><code>ref</code></em>
+. For instance, locale data or debug information.</p>
+<p>The returned list contains all available related refs, but not
+everyone should always be installed. For example,
+<code class="function">flatpak_related_ref_should_download()</code> returns TRUE if the
+reference should be installed/updated with the app, and
+<code class="function">flatpak_related_ref_should_delete()</code> returns TRUE if it
+should be uninstalled with the main ref.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-remote-related-refs-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ref</p></td>
+<td class="parameter_description"><p>the ref</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-remote-related-refs-sync.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<span class="type">FlatpakRelatedRef</span> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakRelatedRef]</span></p>
+</div>
+<p class="since">Since: 0.6.7</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-list-remotes"></a><h3>flatpak_installation_list_remotes ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_installation_list_remotes (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                   <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists the remotes, in priority (highest first) order. For same priority,
+an earlier added remote comes before a later added one.</p>
+<div class="refsect3">
+<a name="flatpak-installation-list-remotes.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-list-remotes.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakRemote]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-get-remote-by-name"></a><h3>flatpak_installation_get_remote_by_name ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="returnvalue">FlatpakRemote</span></a> *
+flatpak_installation_get_remote_by_name
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Looks up a remote by name.</p>
+<div class="refsect3">
+<a name="flatpak-installation-get-remote-by-name.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>a remote name</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-get-remote-by-name.returns"></a><h4>Returns</h4>
+<p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> instances, or <code class="literal">NULL</code> error. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-fetch-remote-metadata-sync"></a><h3>flatpak_installation_fetch_remote_metadata_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">GBytes</span> *
+flatpak_installation_fetch_remote_metadata_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *ref</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Obtains the metadata file from a commit.</p>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-metadata-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ref</p></td>
+<td class="parameter_description"><p>the ref</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-metadata-sync.returns"></a><h4>Returns</h4>
+<p>a <span class="type">GBytes</span> containing the flatpak metadata file,
+or <code class="literal">NULL</code> if an error occurred. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-fetch-remote-ref-sync"></a><h3>flatpak_installation_fetch_remote_ref_sync ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="returnvalue">FlatpakRemoteRef</span></a> *
+flatpak_installation_fetch_remote_ref_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a> kind</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *branch</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Gets the current remote branch of a ref in the remote.</p>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-ref-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>kind</p></td>
+<td class="parameter_description"><p>what this ref contains (an <a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a>)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>name of the app/runtime to fetch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>branch</p></td>
+<td class="parameter_description"><p>which branch to fetch (default: 'master'). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-ref-sync.returns"></a><h4>Returns</h4>
+<p>a <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> instance, or <code class="literal">NULL</code>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-fetch-remote-size-sync"></a><h3>flatpak_installation_fetch_remote_size_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_fetch_remote_size_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *ref</code></em>,
+                                <em class="parameter"><code><span class="type">guint64</span> *download_size</code></em>,
+                                <em class="parameter"><code><span class="type">guint64</span> *installed_size</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Gets information about the maximum amount of data that needs to be transferred
+to pull the ref from a remote repository, and about the amount of
+local disk space that is required to check out this commit.</p>
+<p>Note that if there are locally available data that are in the ref, which is common
+for instance if you're doing an update then the real download size may be smaller
+than what is returned here.</p>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-size-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ref</p></td>
+<td class="parameter_description"><p>the ref</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>download_size</p></td>
+<td class="parameter_description"><p>return location for the (maximum) download size. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>installed_size</p></td>
+<td class="parameter_description"><p>return location for the installed size. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-fetch-remote-size-sync.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code>, unless an error occurred</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-load-app-overrides"></a><h3>flatpak_installation_load_app_overrides ()</h3>
+<pre class="programlisting"><span class="returnvalue">char</span> *
+flatpak_installation_load_app_overrides
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *app_id</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Loads the metadata overrides file for an application.</p>
+<div class="refsect3">
+<a name="flatpak-installation-load-app-overrides.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>app_id</p></td>
+<td class="parameter_description"><p>an application id</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-load-app-overrides.returns"></a><h4>Returns</h4>
+<p>the contents of the overrides files,
+or <code class="literal">NULL</code> if an error occurred. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-update-appstream-sync"></a><h3>flatpak_installation_update_appstream_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_update_appstream_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *remote_name</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>,
+                                <em class="parameter"><code><span class="type">gboolean</span> *out_changed</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Updates the local copy of appstream for <em class="parameter"><code>remote_name</code></em>
+ for the specified <em class="parameter"><code>arch</code></em>
+.
+If you need progress feedback, use <code class="function">flatpak_installation_update_appstream_full_sync()</code>.</p>
+<div class="refsect3">
+<a name="flatpak-installation-update-appstream-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote_name</p></td>
+<td class="parameter_description"><p>the name of the remote</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>Architecture to update, or <code class="literal">NULL</code> for the local machine arch</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>out_changed</p></td>
+<td class="parameter_description"><p>Set to <code class="literal">TRUE</code> if the contents of the appstream changed, <code class="literal">FALSE</code> if nothing changed. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-update-appstream-sync.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> on success, or <code class="literal">FALSE</code> on error</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-install-bundle"></a><h3>flatpak_installation_install_bundle ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="returnvalue">FlatpakInstalledRef</span></a> *
+flatpak_installation_install_bundle (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                     <em class="parameter"><code><span class="type">GFile</span> *file</code></em>,
+                                     <em class="parameter"><code><a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()"><span class="type">FlatpakProgressCallback</span></a> progress</code></em>,
+                                     <em class="parameter"><code><span class="type">gpointer</span> progress_data</code></em>,
+                                     <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                     <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Install an application or runtime from an flatpak bundle file.
+See flatpak-build-bundle(1) for how to create bundles.</p>
+<div class="refsect3">
+<a name="flatpak-installation-install-bundle.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>file</p></td>
+<td class="parameter_description"><p>a <span class="type">GFile</span> that is an flatpak bundle</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>progress callback. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress_data</p></td>
+<td class="parameter_description"><p>user data passed to <em class="parameter"><code>progress</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> progress][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-install-bundle.returns"></a><h4>Returns</h4>
+<p>The ref for the newly installed app or <code class="literal">NULL</code> on failure. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-install-ref-file"></a><h3>flatpak_installation_install_ref_file ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="returnvalue">FlatpakRemoteRef</span></a> *
+flatpak_installation_install_ref_file (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                       <em class="parameter"><code><span class="type">GBytes</span> *ref_file_data</code></em>,
+                                       <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                       <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a remote based on the passed in .flatpakref file contents
+in <em class="parameter"><code>ref_file_data</code></em>
+ and returns the <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> that can be used
+to install it.</p>
+<p>Note, the <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> will not have the commit field set, to
+avoid unnecessary roundtrips. If you need that you have to resolve it
+explicitly with <a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-ref-sync" title="flatpak_installation_fetch_remote_ref_sync ()"><code class="function">flatpak_installation_fetch_remote_ref_sync()</code></a>.</p>
+<div class="refsect3">
+<a name="flatpak-installation-install-ref-file.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ref_file_data</p></td>
+<td class="parameter_description"><p>The ref file contents</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-install-ref-file.returns"></a><h4>Returns</h4>
+<p>a <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> if the remote has been added successfully, <code class="literal">NULL</code>
+on error. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+<p class="since">Since: 0.6.10</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-drop-caches"></a><h3>flatpak_installation_drop_caches ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_drop_caches (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                  <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                  <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Drops all internal (in-memory) caches. For instance, this may be needed to pick up new or changed
+remotes configured outside this installation instance.</p>
+<div class="refsect3">
+<a name="flatpak-installation-drop-caches.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-drop-caches.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> on error</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-modify-remote"></a><h3>flatpak_installation_modify_remote ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_modify_remote (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                    <em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *remote</code></em>,
+                                    <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                    <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Saves changes in the <em class="parameter"><code>remote</code></em>
+ object.</p>
+<div class="refsect3">
+<a name="flatpak-installation-modify-remote.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>remote</p></td>
+<td class="parameter_description"><p>the modified <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-modify-remote.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> if the modifications have been committed successfully</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-remove-remote"></a><h3>flatpak_installation_remove_remote ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_remove_remote (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                    <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                    <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                    <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Removes the remote with the given name from the installation.</p>
+<div class="refsect3">
+<a name="flatpak-installation-remove-remote.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>the name of the remote to remove</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-remove-remote.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> if the remote has been removed successfully</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installation-update-remote-sync"></a><h3>flatpak_installation_update_remote_sync ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installation_update_remote_sync
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
+                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Updates the local configuration of a remote repository by fetching
+the related information from the summary file in the remote OSTree
+repository and committing the changes to the local installation.</p>
+<div class="refsect3">
+<a name="flatpak-installation-update-remote-sync.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>the name of the remote to update</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installation-update-remote-sync.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> if the remote has been updated successfully</p>
+</div>
+<p class="since">Since: 0.6.13</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-get-default-arch"></a><h3>flatpak_get_default_arch ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_get_default_arch (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+<p>Returns the canonical name for the arch of the current machine.</p>
+<div class="refsect3">
+<a name="flatpak-get-default-arch.returns"></a><h4>Returns</h4>
+<p> an arch string</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-get-supported-arches"></a><h3>flatpak_get_supported_arches ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *const *
+flatpak_get_supported_arches (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+<p>Returns the canonical names for the arches that are supported (i.e. can run)
+on the current machine, in order of priority (default is first).</p>
+<div class="refsect3">
+<a name="flatpak-get-supported-arches.returns"></a><h4>Returns</h4>
+<p> a zero terminated array of arch strings</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-get-system-installations"></a><h3>flatpak_get_system_installations ()</h3>
+<pre class="programlisting"><span class="returnvalue">GPtrArray</span> *
+flatpak_get_system_installations (<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                  <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Lists the system installations according to the current configuration and current
+availability (e.g. doesn't return a configured installation if not reachable).</p>
+<div class="refsect3">
+<a name="flatpak-get-system-installations.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-get-system-installations.returns"></a><h4>Returns</h4>
+<p>an GPtrArray of
+<a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation"><span class="type">FlatpakInstallation</span></a> instances. </p>
+<p><span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> FlatpakInstallation]</span></p>
+</div>
+<p class="since">Since: 0.8</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakProgressCallback"></a><h3>FlatpakProgressCallback ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+<span class="c_punctuation">(</span>*FlatpakProgressCallback<span class="c_punctuation">)</span> (<em class="parameter"><code>const <span class="type">char</span> *status</code></em>,
+                            <em class="parameter"><code><span class="type">guint</span> progress</code></em>,
+                            <em class="parameter"><code><span class="type">gboolean</span> estimating</code></em>,
+                            <em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
+<p>The progress callback is called repeatedly during long-running operations
+such as installations or updates, and can be used to update progress information
+in a user interface.</p>
+<p>The callback occurs in the thread-default context of the caller.</p>
+<div class="refsect3">
+<a name="FlatpakProgressCallback.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>status</p></td>
+<td class="parameter_description"><p>A status string, suitable for display</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>progress</p></td>
+<td class="parameter_description"><p>percentage of completion</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>estimating</p></td>
+<td class="parameter_description"><p>whether <em class="parameter"><code>progress</code></em>
+is just an estimate</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>User data passed to the caller</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstallation.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakInstallation-struct"></a><h3>struct FlatpakInstallation</h3>
+<pre class="programlisting">struct FlatpakInstallation;</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakUpdateFlags"></a><h3>enum FlatpakUpdateFlags</h3>
+<p>Flags to alter the behavior of <a class="link" href="FlatpakInstallation.html#flatpak-installation-update" title="flatpak_installation_update ()"><code class="function">flatpak_installation_update()</code></a>.</p>
+<div class="refsect3">
+<a name="FlatpakUpdateFlags.members"></a><h4>Members</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-UPDATE-FLAGS-NONE:CAPS"></a>FLATPAK_UPDATE_FLAGS_NONE</p></td>
+<td class="enum_member_description">
+<p>Fetch remote builds and install the latest one (default)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-UPDATE-FLAGS-NO-DEPLOY:CAPS"></a>FLATPAK_UPDATE_FLAGS_NO_DEPLOY</p></td>
+<td class="enum_member_description">
+<p>Don't install any new builds that might be fetched</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-UPDATE-FLAGS-NO-PULL:CAPS"></a>FLATPAK_UPDATE_FLAGS_NO_PULL</p></td>
+<td class="enum_member_description">
+<p>Don't try to fetch new builds from the remote repo</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-UPDATE-FLAGS-NO-STATIC-DELTAS:CAPS"></a>FLATPAK_UPDATE_FLAGS_NO_STATIC_DELTAS</p></td>
+<td> </td>
+<td> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstallFlags"></a><h3>enum FlatpakInstallFlags</h3>
+<p>Flags to alter the behavior of <a class="link" href="FlatpakInstallation.html#flatpak-installation-install-full" title="flatpak_installation_install_full ()"><code class="function">flatpak_installation_install_full()</code></a>.</p>
+<div class="refsect3">
+<a name="FlatpakInstallFlags.members"></a><h4>Members</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-INSTALL-FLAGS-NONE:CAPS"></a>FLATPAK_INSTALL_FLAGS_NONE</p></td>
+<td class="enum_member_description">
+<p>Default</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-INSTALL-FLAGS-NO-STATIC-DELTAS:CAPS"></a>FLATPAK_INSTALL_FLAGS_NO_STATIC_DELTAS</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-INSTALL-FLAGS-NO-DEPLOY:CAPS"></a>FLATPAK_INSTALL_FLAGS_NO_DEPLOY</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-INSTALL-FLAGS-NO-PULL:CAPS"></a>FLATPAK_INSTALL_FLAGS_NO_PULL</p></td>
+<td> </td>
+<td> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakStorageType"></a><h3>enum FlatpakStorageType</h3>
+<p>Flags to alter the behavior of <a class="link" href="FlatpakInstallation.html#flatpak-installation-install-full" title="flatpak_installation_install_full ()"><code class="function">flatpak_installation_install_full()</code></a>.</p>
+<div class="refsect3">
+<a name="FlatpakStorageType.members"></a><h4>Members</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-STORAGE-TYPE-DEFAULT:CAPS"></a>FLATPAK_STORAGE_TYPE_DEFAULT</p></td>
+<td class="enum_member_description">
+<p>default</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-STORAGE-TYPE-HARD-DISK:CAPS"></a>FLATPAK_STORAGE_TYPE_HARD_DISK</p></td>
+<td class="enum_member_description">
+<p>installation is on a hard disk</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-STORAGE-TYPE-SDCARD:CAPS"></a>FLATPAK_STORAGE_TYPE_SDCARD</p></td>
+<td class="enum_member_description">
+<p>installation is on a SD card</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-STORAGE-TYPE-MMC:CAPS"></a>FLATPAK_STORAGE_TYPE_MMC</p></td>
+<td class="enum_member_description">
+<p>installation is on an MMC</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p class="since">Since: 0.6.15</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/FlatpakInstalledRef.html b/doc/reference/html/FlatpakInstalledRef.html
new file mode 100644 (file)
index 0000000..968b9b4
--- /dev/null
@@ -0,0 +1,435 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>FlatpakInstalledRef: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="FlatpakRef.html" title="FlatpakRef">
+<link rel="next" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#FlatpakInstalledRef.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#FlatpakInstalledRef.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#FlatpakInstalledRef.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="FlatpakRef.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="FlatpakRemoteRef.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="FlatpakInstalledRef"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="FlatpakInstalledRef.top_of_page"></a>FlatpakInstalledRef</span></h2>
+<p>FlatpakInstalledRef — Installed application reference</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-deploy-dir" title="flatpak_installed_ref_get_deploy_dir ()">flatpak_installed_ref_get_deploy_dir</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guint64</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-installed-size" title="flatpak_installed_ref_get_installed_size ()">flatpak_installed_ref_get_installed_size</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-is-current" title="flatpak_installed_ref_get_is_current ()">flatpak_installed_ref_get_is_current</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-latest-commit" title="flatpak_installed_ref_get_latest_commit ()">flatpak_installed_ref_get_latest_commit</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-origin" title="flatpak_installed_ref_get_origin ()">flatpak_installed_ref_get_origin</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GBytes</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-load-metadata" title="flatpak_installed_ref_load_metadata ()">flatpak_installed_ref_load_metadata</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> * const *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-subpaths" title="flatpak_installed_ref_get_subpaths ()">flatpak_installed_ref_get_subpaths</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table class="informaltable" border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--deploy-dir" title="The “deploy-dir” property">deploy-dir</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">guint64</span></td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--installed-size" title="The “installed-size” property">installed-size</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">gboolean</span></td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--is-current" title="The “is-current” property">is-current</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--latest-commit" title="The “latest-commit” property">latest-commit</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--origin" title="The “origin” property">origin</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GStrv</span></td>
+<td class="property_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--subpaths" title="The “subpaths” property">subpaths</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef-struct" title="struct FlatpakInstalledRef">FlatpakInstalledRef</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+        <span class="lineart">╰──</span> FlatpakInstalledRef
+</pre>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.description"></a><h2>Description</h2>
+<p>A FlatpakInstalledRef provides information about an installed
+application or runtime (in short: ref), such as the available
+builds, its size, location, etc.</p>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-deploy-dir"></a><h3>flatpak_installed_ref_get_deploy_dir ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_installed_ref_get_deploy_dir (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Gets the deploy dir of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-deploy-dir.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-deploy-dir.returns"></a><h4>Returns</h4>
+<p>the deploy dir. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-installed-size"></a><h3>flatpak_installed_ref_get_installed_size ()</h3>
+<pre class="programlisting"><span class="returnvalue">guint64</span>
+flatpak_installed_ref_get_installed_size
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Returns the installed size of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-installed-size.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-installed-size.returns"></a><h4>Returns</h4>
+<p> the installed size</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-is-current"></a><h3>flatpak_installed_ref_get_is_current ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_installed_ref_get_is_current (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Returns whether the ref is current.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-is-current.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-is-current.returns"></a><h4>Returns</h4>
+<p> <code class="literal">TRUE</code> if the ref is current</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-latest-commit"></a><h3>flatpak_installed_ref_get_latest_commit ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_installed_ref_get_latest_commit
+                               (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Gets the latest commit of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-latest-commit.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-latest-commit.returns"></a><h4>Returns</h4>
+<p>the latest commit. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-origin"></a><h3>flatpak_installed_ref_get_origin ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_installed_ref_get_origin (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Gets the origin of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-origin.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-origin.returns"></a><h4>Returns</h4>
+<p>the origin. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-load-metadata"></a><h3>flatpak_installed_ref_load_metadata ()</h3>
+<pre class="programlisting"><span class="returnvalue">GBytes</span> *
+flatpak_installed_ref_load_metadata (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>,
+                                     <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
+                                     <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Loads the metadata file for this ref.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-load-metadata.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>cancellable</p></td>
+<td class="parameter_description"><p>a <span class="type">GCancellable</span>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>a return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-load-metadata.returns"></a><h4>Returns</h4>
+<p>a <span class="type">GBytes</span> containing the metadata file,
+or <code class="literal">NULL</code> if an error occurred. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-installed-ref-get-subpaths"></a><h3>flatpak_installed_ref_get_subpaths ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> * const *
+flatpak_installed_ref_get_subpaths (<em class="parameter"><code><a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> *self</code></em>);</pre>
+<p>Returns the subpaths that are installed, or <code class="literal">NULL</code> if all files installed.</p>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-subpaths.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-installed-ref-get-subpaths.returns"></a><h4>Returns</h4>
+<p>A strv, or <code class="literal">NULL</code>. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakInstalledRef-struct"></a><h3>struct FlatpakInstalledRef</h3>
+<pre class="programlisting">struct FlatpakInstalledRef;</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakInstalledRef.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--deploy-dir"></a><h3>The <code class="literal">“deploy-dir”</code> property</h3>
+<pre class="programlisting">  “deploy-dir”               <span class="type">gchar</span> *</pre>
+<p>Where the application is installed.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--installed-size"></a><h3>The <code class="literal">“installed-size”</code> property</h3>
+<pre class="programlisting">  “installed-size”           <span class="type">guint64</span></pre>
+<p>The installed size of the application.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 0</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--is-current"></a><h3>The <code class="literal">“is-current”</code> property</h3>
+<pre class="programlisting">  “is-current”               <span class="type">gboolean</span></pre>
+<p>Whether the application is current.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--latest-commit"></a><h3>The <code class="literal">“latest-commit”</code> property</h3>
+<pre class="programlisting">  “latest-commit”            <span class="type">gchar</span> *</pre>
+<p>The latest commit.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--origin"></a><h3>The <code class="literal">“origin”</code> property</h3>
+<pre class="programlisting">  “origin”                   <span class="type">gchar</span> *</pre>
+<p>The origin.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakInstalledRef--subpaths"></a><h3>The <code class="literal">“subpaths”</code> property</h3>
+<pre class="programlisting">  “subpaths”                 <span class="type">GStrv</span></pre>
+<p>Flags: Read / Write</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/FlatpakRef.html b/doc/reference/html/FlatpakRef.html
new file mode 100644 (file)
index 0000000..a8707bc
--- /dev/null
@@ -0,0 +1,481 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>FlatpakRef: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="FlatpakInstallation.html" title="FlatpakInstallation">
+<link rel="next" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#FlatpakRef.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#FlatpakRef.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#FlatpakRef.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="FlatpakInstallation.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="FlatpakInstalledRef.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="FlatpakRef"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="FlatpakRef.top_of_page"></a>FlatpakRef</span></h2>
+<p>FlatpakRef — Application reference</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="FlatpakRef.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-format-ref" title="flatpak_ref_format_ref ()">flatpak_ref_format_ref</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-arch" title="flatpak_ref_get_arch ()">flatpak_ref_get_arch</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-branch" title="flatpak_ref_get_branch ()">flatpak_ref_get_branch</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-commit" title="flatpak_ref_get_commit ()">flatpak_ref_get_commit</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="returnvalue">FlatpakRefKind</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-kind" title="flatpak_ref_get_kind ()">flatpak_ref_get_kind</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-name" title="flatpak_ref_get_name ()">flatpak_ref_get_name</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="returnvalue">FlatpakRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRef.html#flatpak-ref-parse" title="flatpak_ref_parse ()">flatpak_ref_parse</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table class="informaltable" border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--arch" title="The “arch” property">arch</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--branch" title="The “branch” property">branch</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--collection-id" title="The “collection-id” property">collection-id</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--commit" title="The “commit” property">commit</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a></td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--kind" title="The “kind” property">kind</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRef.html#FlatpakRef--name" title="The “name” property">name</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="FlatpakRef.html#FlatpakRef-struct" title="struct FlatpakRef">FlatpakRef</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind">FlatpakRefKind</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> FlatpakRef
+        <span class="lineart">├──</span> <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef">FlatpakBundleRef</a>
+        <span class="lineart">├──</span> <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+        <span class="lineart">╰──</span> <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">FlatpakRemoteRef</a>
+</pre>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.description"></a><h2>Description</h2>
+<p>Currently flatpak manages two types of binary artifacts: applications, and
+runtimes. Applications contain a program that desktop users can run, while
+runtimes contain only libraries and data. An FlatpakRef object (or short: ref)
+can refer to either of these.</p>
+<p>Both applications and runtimes are identified by a 4-tuple of strings: kind,
+name, arch and branch, e.g. app/org.gnome.evince/x86_64/master. The functions
+<a class="link" href="FlatpakRef.html#flatpak-ref-parse" title="flatpak_ref_parse ()"><code class="function">flatpak_ref_parse()</code></a> and <a class="link" href="FlatpakRef.html#flatpak-ref-format-ref" title="flatpak_ref_format_ref ()"><code class="function">flatpak_ref_format_ref()</code></a> can be used to convert
+FlatpakRef objects into this string representation and back.</p>
+<p>To uniquely identify a particular version of an application or runtime, you
+need a commit.</p>
+<p>The subclasses <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef"><span class="type">FlatpakInstalledRef</span></a> and <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> provide more information
+for artifacts that are locally installed or available from a remote repository.</p>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-ref-format-ref"></a><h3>flatpak_ref_format_ref ()</h3>
+<pre class="programlisting"><span class="returnvalue">char</span> *
+flatpak_ref_format_ref (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Convert an FlatpakRef object into a string representation that
+can be parsed by <a class="link" href="FlatpakRef.html#flatpak-ref-parse" title="flatpak_ref_parse ()"><code class="function">flatpak_ref_parse()</code></a>.</p>
+<div class="refsect3">
+<a name="flatpak-ref-format-ref.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-format-ref.returns"></a><h4>Returns</h4>
+<p>string representation. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-get-arch"></a><h3>flatpak_ref_get_arch ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_ref_get_arch (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Gets the arch or the ref.</p>
+<div class="refsect3">
+<a name="flatpak-ref-get-arch.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-get-arch.returns"></a><h4>Returns</h4>
+<p>the arch. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-get-branch"></a><h3>flatpak_ref_get_branch ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_ref_get_branch (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Gets the branch of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-ref-get-branch.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-get-branch.returns"></a><h4>Returns</h4>
+<p>the branch. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-get-commit"></a><h3>flatpak_ref_get_commit ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_ref_get_commit (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Gets the commit of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-ref-get-commit.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-get-commit.returns"></a><h4>Returns</h4>
+<p>the commit. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-get-kind"></a><h3>flatpak_ref_get_kind ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="returnvalue">FlatpakRefKind</span></a>
+flatpak_ref_get_kind (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Gets the kind of artifact that this ref refers to.</p>
+<div class="refsect3">
+<a name="flatpak-ref-get-kind.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-get-kind.returns"></a><h4>Returns</h4>
+<p> the kind of artifact</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-get-name"></a><h3>flatpak_ref_get_name ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_ref_get_name (<em class="parameter"><code><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> *self</code></em>);</pre>
+<p>Gets the name of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-ref-get-name.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-get-name.returns"></a><h4>Returns</h4>
+<p>the name. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-ref-parse"></a><h3>flatpak_ref_parse ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="returnvalue">FlatpakRef</span></a> *
+flatpak_ref_parse (<em class="parameter"><code>const <span class="type">char</span> *ref</code></em>,
+                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Tries to parse a full ref name and return a <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a> (without a
+commit set) or fail if the ref is invalid somehow.</p>
+<div class="refsect3">
+<a name="flatpak-ref-parse.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>ref</p></td>
+<td class="parameter_description"><p>A string ref name, such as "app/org.test.App/86_64/master"</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-ref-parse.returns"></a><h4>Returns</h4>
+<p>an <a class="link" href="FlatpakRef.html" title="FlatpakRef"><span class="type">FlatpakRef</span></a>, or <code class="literal">NULL</code>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakRef-struct"></a><h3>struct FlatpakRef</h3>
+<pre class="programlisting">struct FlatpakRef;</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRefKind"></a><h3>enum FlatpakRefKind</h3>
+<p>The kind of artifact that a FlatpakRef refers to.</p>
+<div class="refsect3">
+<a name="FlatpakRefKind.members"></a><h4>Members</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-REF-KIND-APP:CAPS"></a>FLATPAK_REF_KIND_APP</p></td>
+<td class="enum_member_description">
+<p>An application</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-REF-KIND-RUNTIME:CAPS"></a>FLATPAK_REF_KIND_RUNTIME</p></td>
+<td class="enum_member_description">
+<p>A runtime that applications can use.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRef.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="FlatpakRef--arch"></a><h3>The <code class="literal">“arch”</code> property</h3>
+<pre class="programlisting">  “arch”                     <span class="type">gchar</span> *</pre>
+<p>The architecture of the application or runtime.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRef--branch"></a><h3>The <code class="literal">“branch”</code> property</h3>
+<pre class="programlisting">  “branch”                   <span class="type">gchar</span> *</pre>
+<p>The branch of the application or runtime.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRef--collection-id"></a><h3>The <code class="literal">“collection-id”</code> property</h3>
+<pre class="programlisting">  “collection-id”            <span class="type">gchar</span> *</pre>
+<p>The collection ID.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRef--commit"></a><h3>The <code class="literal">“commit”</code> property</h3>
+<pre class="programlisting">  “commit”                   <span class="type">gchar</span> *</pre>
+<p>The commit.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRef--kind"></a><h3>The <code class="literal">“kind”</code> property</h3>
+<pre class="programlisting">  “kind”                     <a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind"><span class="type">FlatpakRefKind</span></a></pre>
+<p>The kind of artifact.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FLATPAK_REF_KIND_APP</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRef--name"></a><h3>The <code class="literal">“name”</code> property</h3>
+<pre class="programlisting">  “name”                     <span class="type">gchar</span> *</pre>
+<p>The name of the application or runtime.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/FlatpakRemote.html b/doc/reference/html/FlatpakRemote.html
new file mode 100644 (file)
index 0000000..989ecc6
--- /dev/null
@@ -0,0 +1,800 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>FlatpakRemote: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">
+<link rel="next" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemote.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemote.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemote.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="FlatpakRemoteRef.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="flatpak-flatpak-bundle-ref.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="FlatpakRemote"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="FlatpakRemote.top_of_page"></a>FlatpakRemote</span></h2>
+<p>FlatpakRemote — Remote repository</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="FlatpakRemote.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="returnvalue">FlatpakRemote</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-new" title="flatpak_remote_new ()">flatpak_remote_new</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-name" title="flatpak_remote_get_name ()">flatpak_remote_get_name</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GFile</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-appstream-dir" title="flatpak_remote_get_appstream_dir ()">flatpak_remote_get_appstream_dir</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GFile</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-appstream-timestamp" title="flatpak_remote_get_appstream_timestamp ()">flatpak_remote_get_appstream_timestamp</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-gpg-verify" title="flatpak_remote_get_gpg_verify ()">flatpak_remote_get_gpg_verify</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-gpg-verify" title="flatpak_remote_set_gpg_verify ()">flatpak_remote_set_gpg_verify</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-gpg-key" title="flatpak_remote_set_gpg_key ()">flatpak_remote_set_gpg_key</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-noenumerate" title="flatpak_remote_get_noenumerate ()">flatpak_remote_get_noenumerate</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-noenumerate" title="flatpak_remote_set_noenumerate ()">flatpak_remote_set_noenumerate</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">int</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-prio" title="flatpak_remote_get_prio ()">flatpak_remote_get_prio</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-prio" title="flatpak_remote_set_prio ()">flatpak_remote_set_prio</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-title" title="flatpak_remote_get_title ()">flatpak_remote_get_title</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-title" title="flatpak_remote_set_title ()">flatpak_remote_set_title</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-url" title="flatpak_remote_get_url ()">flatpak_remote_get_url</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-url" title="flatpak_remote_set_url ()">flatpak_remote_set_url</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gboolean</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-disabled" title="flatpak_remote_get_disabled ()">flatpak_remote_get_disabled</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-disabled" title="flatpak_remote_set_disabled ()">flatpak_remote_set_disabled</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table class="informaltable" border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRemote.html#FlatpakRemote--name" title="The “name” property">name</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">FlatpakRemoteType</span></td>
+<td class="property_name"><a class="link" href="FlatpakRemote.html#FlatpakRemote--type" title="The “type” property">type</a></td>
+<td class="property_flags">Read / Write / Construct Only</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="FlatpakRemote.html#FlatpakRemote-struct" title="struct FlatpakRemote">FlatpakRemote</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> FlatpakRemote
+</pre>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.description"></a><h2>Description</h2>
+<p>A <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> object provides information about a remote
+repository (or short: remote) that has been configured.</p>
+<p>At its most basic level, a remote has a name and the URL for
+the repository. In addition, they provide some additional
+information that can be useful when presenting repositories
+in a UI, such as a title, a priority or a "don't enumerate"
+flags.</p>
+<p>To obtain FlatpakRemote objects for the configured remotes
+on a system, use <a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remotes" title="flatpak_installation_list_remotes ()"><code class="function">flatpak_installation_list_remotes()</code></a> or
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-remote-by-name" title="flatpak_installation_get_remote_by_name ()"><code class="function">flatpak_installation_get_remote_by_name()</code></a>.</p>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-remote-new"></a><h3>flatpak_remote_new ()</h3>
+<pre class="programlisting"><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="returnvalue">FlatpakRemote</span></a> *
+flatpak_remote_new (<em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre>
+<p>Returns a new remote object which can be used to configure a new remote.</p>
+<p>Note: This is a local configuration object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-new.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>name</p></td>
+<td class="parameter_description"><p>a name</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-new.returns"></a><h4>Returns</h4>
+<p>a new <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-name"></a><h3>flatpak_remote_get_name ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_remote_get_name (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns the name of the remote repository.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-name.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-name.returns"></a><h4>Returns</h4>
+<p>the name. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-appstream-dir"></a><h3>flatpak_remote_get_appstream_dir ()</h3>
+<pre class="programlisting"><span class="returnvalue">GFile</span> *
+flatpak_remote_get_appstream_dir (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                                  <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>);</pre>
+<p>Returns the directory where this remote will store locally cached
+appstream information for the specified <em class="parameter"><code>arch</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-appstream-dir.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-appstream-dir.returns"></a><h4>Returns</h4>
+<p>a <span class="type">GFile</span>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-appstream-timestamp"></a><h3>flatpak_remote_get_appstream_timestamp ()</h3>
+<pre class="programlisting"><span class="returnvalue">GFile</span> *
+flatpak_remote_get_appstream_timestamp
+                               (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                                <em class="parameter"><code>const <span class="type">char</span> *arch</code></em>);</pre>
+<p>Returns the timestamp file that will be updated whenever the appstream information
+has been updated (or tried to update) for the specified <em class="parameter"><code>arch</code></em>
+.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-appstream-timestamp.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>arch</p></td>
+<td class="parameter_description"><p>which architecture to fetch (default: current architecture). </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-appstream-timestamp.returns"></a><h4>Returns</h4>
+<p>a <span class="type">GFile</span>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-gpg-verify"></a><h3>flatpak_remote_get_gpg_verify ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_remote_get_gpg_verify (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns whether GPG verification is enabled for the remote.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-gpg-verify.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-gpg-verify.returns"></a><h4>Returns</h4>
+<p> whether GPG verification is enabled</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-gpg-verify"></a><h3>flatpak_remote_set_gpg_verify ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_gpg_verify (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                               <em class="parameter"><code><span class="type">gboolean</span> gpg_verify</code></em>);</pre>
+<p>Sets the gpg_verify config of this remote. See <a class="link" href="FlatpakRemote.html#flatpak-remote-get-gpg-verify" title="flatpak_remote_get_gpg_verify ()"><code class="function">flatpak_remote_get_gpg_verify()</code></a>.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-gpg-verify.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>gpg_verify</p></td>
+<td class="parameter_description"><p>a bool</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-gpg-key"></a><h3>flatpak_remote_set_gpg_key ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_gpg_key (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                            <em class="parameter"><code><span class="type">GBytes</span> *gpg_key</code></em>);</pre>
+<p>Sets the trusted gpg key for this remote.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-gpg-key.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>gpg_key</p></td>
+<td class="parameter_description"><p>a <span class="type">GBytes</span> with gpg binary key data</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-noenumerate"></a><h3>flatpak_remote_get_noenumerate ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_remote_get_noenumerate (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns whether this remote should be used to list applications.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-noenumerate.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-noenumerate.returns"></a><h4>Returns</h4>
+<p> whether the remote is marked as "don't enumerate"</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-noenumerate"></a><h3>flatpak_remote_set_noenumerate ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_noenumerate (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                                <em class="parameter"><code><span class="type">gboolean</span> noenumerate</code></em>);</pre>
+<p>Sets the noenumeration config of this remote. See <a class="link" href="FlatpakRemote.html#flatpak-remote-get-noenumerate" title="flatpak_remote_get_noenumerate ()"><code class="function">flatpak_remote_get_noenumerate()</code></a>.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-noenumerate.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>noenumerate</p></td>
+<td class="parameter_description"><p>a bool</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-prio"></a><h3>flatpak_remote_get_prio ()</h3>
+<pre class="programlisting"><span class="returnvalue">int</span>
+flatpak_remote_get_prio (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns the priority for the remote.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-prio.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-prio.returns"></a><h4>Returns</h4>
+<p> the priority</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-prio"></a><h3>flatpak_remote_set_prio ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_prio (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                         <em class="parameter"><code><span class="type">int</span> prio</code></em>);</pre>
+<p>Sets the prio config of this remote. See <a class="link" href="FlatpakRemote.html#flatpak-remote-get-prio" title="flatpak_remote_get_prio ()"><code class="function">flatpak_remote_get_prio()</code></a>.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-prio.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>prio</p></td>
+<td class="parameter_description"><p>a bool</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-title"></a><h3>flatpak_remote_get_title ()</h3>
+<pre class="programlisting"><span class="returnvalue">char</span> *
+flatpak_remote_get_title (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns the title of the remote.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-title.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-title.returns"></a><h4>Returns</h4>
+<p>the title. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-title"></a><h3>flatpak_remote_set_title ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_title (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                          <em class="parameter"><code>const <span class="type">char</span> *title</code></em>);</pre>
+<p>Sets the repository title of this remote.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-title.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>title</p></td>
+<td class="parameter_description"><p>The new title</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-url"></a><h3>flatpak_remote_get_url ()</h3>
+<pre class="programlisting"><span class="returnvalue">char</span> *
+flatpak_remote_get_url (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns the repository URL of this remote.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-url.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-url.returns"></a><h4>Returns</h4>
+<p>the URL. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-url"></a><h3>flatpak_remote_set_url ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_url (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                        <em class="parameter"><code>const <span class="type">char</span> *url</code></em>);</pre>
+<p>Sets the repository URL of this remote.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-url.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>url</p></td>
+<td class="parameter_description"><p>The new url</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-get-disabled"></a><h3>flatpak_remote_get_disabled ()</h3>
+<pre class="programlisting"><span class="returnvalue">gboolean</span>
+flatpak_remote_get_disabled (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>);</pre>
+<p>Returns whether this remote is disabled.</p>
+<div class="refsect3">
+<a name="flatpak-remote-get-disabled.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-get-disabled.returns"></a><h4>Returns</h4>
+<p> whether the remote is marked as "don't enumerate"</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-remote-set-disabled"></a><h3>flatpak_remote_set_disabled ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+flatpak_remote_set_disabled (<em class="parameter"><code><a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a> *self</code></em>,
+                             <em class="parameter"><code><span class="type">gboolean</span> disabled</code></em>);</pre>
+<p>Sets the disabled config of this remote. See <code class="function">flatpak_remote_get_disable()</code>.</p>
+<p>Note: This is a local modification of this object, you must commit changes
+using <a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()"><code class="function">flatpak_installation_modify_remote()</code></a> for the changes to take
+effect.</p>
+<div class="refsect3">
+<a name="flatpak-remote-set-disabled.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemote.html" title="FlatpakRemote"><span class="type">FlatpakRemote</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>disabled</p></td>
+<td class="parameter_description"><p>a bool</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakRemote-struct"></a><h3>struct FlatpakRemote</h3>
+<pre class="programlisting">struct FlatpakRemote;</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemote.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="FlatpakRemote--name"></a><h3>The <code class="literal">“name”</code> property</h3>
+<pre class="programlisting">  “name”                     <span class="type">gchar</span> *</pre>
+<p>Name of the remote, as used in configuration files and when interfacing
+with OSTree. This is typically human readable, but could be generated, and
+must conform to <code class="function">ostree_validate_remote_name()</code>. It should typically not be
+presented in the UI.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakRemote--type"></a><h3>The <code class="literal">“type”</code> property</h3>
+<pre class="programlisting">  “type”                     <span class="type">FlatpakRemoteType</span></pre>
+<p>The type of the remote: whether it comes from static configuration files
+(<em class="parameter"><code>FLATPAK_REMOTE_TYPE_STATIC</code></em>
+) or has been dynamically found from the local
+network or a mounted USB drive (<em class="parameter"><code>FLATPAK_REMOTE_TYPE_LAN</code></em>
+,
+<em class="parameter"><code>FLATPAK_REMOTE_TYPE_USB</code></em>
+). Dynamic remotes may be added and removed over
+time.</p>
+<p>Flags: Read / Write / Construct Only</p>
+<p>Default value: FLATPAK_REMOTE_TYPE_STATIC</p>
+<p class="since">Since: 0.9.8</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/FlatpakRemoteRef.html b/doc/reference/html/FlatpakRemoteRef.html
new file mode 100644 (file)
index 0000000..0893547
--- /dev/null
@@ -0,0 +1,143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>FlatpakRemoteRef: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">
+<link rel="next" href="FlatpakRemote.html" title="FlatpakRemote">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemoteRef.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemoteRef.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#FlatpakRemoteRef.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="FlatpakInstalledRef.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="FlatpakRemote.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="FlatpakRemoteRef"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="FlatpakRemoteRef.top_of_page"></a>FlatpakRemoteRef</span></h2>
+<p>FlatpakRemoteRef — Remote application reference</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody><tr>
+<td class="function_type">const <span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="FlatpakRemoteRef.html#flatpak-remote-ref-get-remote-name" title="flatpak_remote_ref_get_remote_name ()">flatpak_remote_ref_get_remote_name</a> <span class="c_punctuation">()</span>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table class="informaltable" border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody><tr>
+<td class="property_type">
+<span class="type">gchar</span> *</td>
+<td class="property_name"><a class="link" href="FlatpakRemoteRef.html#FlatpakRemoteRef--remote-name" title="The “remote-name” property">remote-name</a></td>
+<td class="property_flags">Read / Write</td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="FlatpakRemoteRef.html#FlatpakRemoteRef-struct" title="struct FlatpakRemoteRef">FlatpakRemoteRef</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+        <span class="lineart">╰──</span> FlatpakRemoteRef
+</pre>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.description"></a><h2>Description</h2>
+<p>A FlatpakRemoteRef provides information about an application or runtime
+(in short: ref) that is available from a remote repository.</p>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-remote-ref-get-remote-name"></a><h3>flatpak_remote_ref_get_remote_name ()</h3>
+<pre class="programlisting">const <span class="returnvalue">char</span> *
+flatpak_remote_ref_get_remote_name (<em class="parameter"><code><a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a> *self</code></em>);</pre>
+<p>Gets the remote name of the ref.</p>
+<div class="refsect3">
+<a name="flatpak-remote-ref-get-remote-name.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef"><span class="type">FlatpakRemoteRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-remote-ref-get-remote-name.returns"></a><h4>Returns</h4>
+<p>the remote name. </p>
+<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakRemoteRef-struct"></a><h3>struct FlatpakRemoteRef</h3>
+<pre class="programlisting">struct FlatpakRemoteRef;</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="FlatpakRemoteRef.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="FlatpakRemoteRef--remote-name"></a><h3>The <code class="literal">“remote-name”</code> property</h3>
+<pre class="programlisting">  “remote-name”              <span class="type">gchar</span> *</pre>
+<p>The name of the remote.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: NULL</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/annotation-glossary.html b/doc/reference/html/annotation-glossary.html
new file mode 100644 (file)
index 0000000..925d85d
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Annotation Glossary: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="prev" href="full-api-index.html" title="API Index">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"><span id="nav_glossary"><a class="shortcut" href="#glsA">A</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsC">C</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsE">E</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsN">N</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsO">O</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsS">S</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#glsT">T</a></span></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
+<td><a accesskey="p" href="full-api-index.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><img src="right-insensitive.png" width="16" height="16" border="0"></td>
+</tr></table>
+<div class="glossary">
+<div class="titlepage"><div><div><h1 class="title">
+<a name="annotation-glossary"></a>Annotation Glossary</h1></div></div></div>
+<a name="glsA"></a><h3 class="title">A</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-allow-none"></a>allow-none</span></dt>
+<dd class="glossdef"><p>NULL is OK, both for passing and for returning.</p></dd>
+<a name="glsC"></a><h3 class="title">C</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-closure"></a>closure</span></dt>
+<dd class="glossdef"><p>This parameter is a 'user_data', for callbacks; many bindings can pass NULL here.</p></dd>
+<a name="glsE"></a><h3 class="title">E</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-element-type"></a>element-type</span></dt>
+<dd class="glossdef"><p>Generics and defining elements of containers and arrays.</p></dd>
+<a name="glsN"></a><h3 class="title">N</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-nullable"></a>nullable</span></dt>
+<dd class="glossdef"><p>NULL may be passed as the value in, out, in-out; or as a return value.</p></dd>
+<a name="glsO"></a><h3 class="title">O</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-out"></a>out</span></dt>
+<dd class="glossdef"><p>Parameter for returning results. Default is <acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>.</p></dd>
+<a name="glsS"></a><h3 class="title">S</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-scope%20call"></a>scope call</span></dt>
+<dd class="glossdef"><p>The callback is valid only during the call to the method.</p></dd>
+<a name="glsT"></a><h3 class="title">T</h3>
+<dt><span class="glossterm"><a name="annotation-glossterm-transfer%20container"></a>transfer container</span></dt>
+<dd class="glossdef"><p>Free data container after the code is done.</p></dd>
+<dt><span class="glossterm"><a name="annotation-glossterm-transfer%20full"></a>transfer full</span></dt>
+<dd class="glossdef"><p>Free data after the code is done.</p></dd>
+<dt><span class="glossterm"><a name="annotation-glossterm-transfer%20none"></a>transfer none</span></dt>
+<dd class="glossdef"><p>Don't free data after the code is done.</p></dd>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/ch01.html b/doc/reference/html/ch01.html
new file mode 100644 (file)
index 0000000..bb92211
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Flatpak: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="prev" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="next" href="FlatpakInstallation.html" title="FlatpakInstallation">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
+<td><a accesskey="p" href="index.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="FlatpakInstallation.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="chapter">
+<div class="titlepage"><div><div><h1 class="title">
+<a name="id-1.2"></a>Flatpak</h1></div></div></div>
+<div class="toc"><dl class="toc">
+<dt>
+<span class="refentrytitle"><a href="FlatpakInstallation.html">FlatpakInstallation</a></span><span class="refpurpose"> — Installation information</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRef.html">FlatpakRef</a></span><span class="refpurpose"> — Application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakInstalledRef.html">FlatpakInstalledRef</a></span><span class="refpurpose"> — Installed application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRemoteRef.html">FlatpakRemoteRef</a></span><span class="refpurpose"> — Remote application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRemote.html">FlatpakRemote</a></span><span class="refpurpose"> — Remote repository</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-flatpak-bundle-ref.html">flatpak-bundle-ref</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-Error-codes.html">Error codes</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-Version-information.html">Version information</a></span><span class="refpurpose"></span>
+</dt>
+</dl></div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/flatpak-Error-codes.html b/doc/reference/html/flatpak-Error-codes.html
new file mode 100644 (file)
index 0000000..3bb783c
--- /dev/null
@@ -0,0 +1,132 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Error codes: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">
+<link rel="next" href="flatpak-Version-information.html" title="Version information">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#flatpak-Error-codes.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="flatpak-flatpak-bundle-ref.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="flatpak-Version-information.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="flatpak-Error-codes"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="flatpak-Error-codes.top_of_page"></a>Error codes</span></h2>
+<p>Error codes</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="flatpak-Error-codes.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody><tr>
+<td class="function_type">
+<span class="returnvalue">GQuark</span>
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-Error-codes.html#flatpak-error-quark" title="flatpak_error_quark ()">flatpak_error_quark</a> <span class="c_punctuation">()</span>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="flatpak-Error-codes.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="flatpak-Error-codes.html#FLATPAK-ERROR:CAPS" title="FLATPAK_ERROR">FLATPAK_ERROR</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="flatpak-Error-codes.html#FlatpakError" title="enum FlatpakError">FlatpakError</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="flatpak-Error-codes.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="flatpak-Error-codes.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-error-quark"></a><h3>flatpak_error_quark ()</h3>
+<pre class="programlisting"><span class="returnvalue">GQuark</span>
+flatpak_error_quark (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="flatpak-Error-codes.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FLATPAK-ERROR:CAPS"></a><h3>FLATPAK_ERROR</h3>
+<pre class="programlisting">#define FLATPAK_ERROR flatpak_error_quark ()
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FlatpakError"></a><h3>enum FlatpakError</h3>
+<p>Error codes for library functions.</p>
+<div class="refsect3">
+<a name="FlatpakError.members"></a><h4>Members</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-ERROR-ALREADY-INSTALLED:CAPS"></a>FLATPAK_ERROR_ALREADY_INSTALLED</p></td>
+<td class="enum_member_description">
+<p>App/runtime is already installed</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-ERROR-NOT-INSTALLED:CAPS"></a>FLATPAK_ERROR_NOT_INSTALLED</p></td>
+<td class="enum_member_description">
+<p>App/runtime is not installed</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="FLATPAK-ERROR-ONLY-PULLED:CAPS"></a>FLATPAK_ERROR_ONLY_PULLED</p></td>
+<td class="enum_member_description">
+<p>App/runtime was only pulled into the local
+                            repository but not installed.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/flatpak-Version-information.html b/doc/reference/html/flatpak-Version-information.html
new file mode 100644 (file)
index 0000000..9f51046
--- /dev/null
@@ -0,0 +1,98 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Version information: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="flatpak-Error-codes.html" title="Error codes">
+<link rel="next" href="object-tree.html" title="Object Hierarchy">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#flatpak-Version-information.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="flatpak-Error-codes.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="object-tree.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="flatpak-Version-information"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="flatpak-Version-information.top_of_page"></a>Version information</span></h2>
+<p>Version information</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="flatpak-Version-information.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="flatpak-Version-information.html#FLATPAK-MAJOR-VERSION:CAPS" title="FLATPAK_MAJOR_VERSION">FLATPAK_MAJOR_VERSION</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="flatpak-Version-information.html#FLATPAK-MINOR-VERSION:CAPS" title="FLATPAK_MINOR_VERSION">FLATPAK_MINOR_VERSION</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="flatpak-Version-information.html#FLATPAK-MICRO-VERSION:CAPS" title="FLATPAK_MICRO_VERSION">FLATPAK_MICRO_VERSION</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="flatpak-Version-information.html#FLATPAK-EXTERN:CAPS" title="FLATPAK_EXTERN">FLATPAK_EXTERN</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="flatpak-Version-information.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="flatpak-Version-information.functions_details"></a><h2>Functions</h2>
+<p></p>
+</div>
+<div class="refsect1">
+<a name="flatpak-Version-information.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FLATPAK-MAJOR-VERSION:CAPS"></a><h3>FLATPAK_MAJOR_VERSION</h3>
+<pre class="programlisting">#define FLATPAK_MAJOR_VERSION (0)
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FLATPAK-MINOR-VERSION:CAPS"></a><h3>FLATPAK_MINOR_VERSION</h3>
+<pre class="programlisting">#define FLATPAK_MINOR_VERSION (10)
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FLATPAK-MICRO-VERSION:CAPS"></a><h3>FLATPAK_MICRO_VERSION</h3>
+<pre class="programlisting">#define FLATPAK_MICRO_VERSION (2)
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="FLATPAK-EXTERN:CAPS"></a><h3>FLATPAK_EXTERN</h3>
+<pre class="programlisting">#define FLATPAK_EXTERN extern
+</pre>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/flatpak-flatpak-bundle-ref.html b/doc/reference/html/flatpak-flatpak-bundle-ref.html
new file mode 100644 (file)
index 0000000..e7f98e1
--- /dev/null
@@ -0,0 +1,361 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>flatpak-bundle-ref: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="ch01.html" title="Flatpak">
+<link rel="prev" href="FlatpakRemote.html" title="FlatpakRemote">
+<link rel="next" href="flatpak-Error-codes.html" title="Error codes">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#flatpak-flatpak-bundle-ref.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#flatpak-flatpak-bundle-ref.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#flatpak-flatpak-bundle-ref.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="FlatpakRemote.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="flatpak-Error-codes.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="flatpak-flatpak-bundle-ref"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="flatpak-flatpak-bundle-ref.top_of_page"></a>flatpak-bundle-ref</span></h2>
+<p>flatpak-bundle-ref</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="returnvalue">FlatpakBundleRef</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-new" title="flatpak_bundle_ref_new ()">flatpak_bundle_ref_new</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GFile</span> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-file" title="flatpak_bundle_ref_get_file ()">flatpak_bundle_ref_get_file</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GBytes</span> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-metadata" title="flatpak_bundle_ref_get_metadata ()">flatpak_bundle_ref_get_metadata</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GBytes</span> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-appstream" title="flatpak_bundle_ref_get_appstream ()">flatpak_bundle_ref_get_appstream</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GBytes</span> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-icon" title="flatpak_bundle_ref_get_icon ()">flatpak_bundle_ref_get_icon</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">char</span> *
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-origin" title="flatpak_bundle_ref_get_origin ()">flatpak_bundle_ref_get_origin</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guint64</span>
+</td>
+<td class="function_name">
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-installed-size" title="flatpak_bundle_ref_get_installed_size ()">flatpak_bundle_ref_get_installed_size</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table class="informaltable" border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody><tr>
+<td class="property_type">
+<span class="type">GFile</span> *</td>
+<td class="property_name"><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef--file" title="The “file” property">file</a></td>
+<td class="property_flags">Read / Write</td>
+</tr></tbody>
+</table></div>
+</div>
+<a name="FlatpakBundleRef"></a><div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef-struct" title="struct FlatpakBundleRef">FlatpakBundleRef</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    GObject
+    <span class="lineart">╰──</span> <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+        <span class="lineart">╰──</span> FlatpakBundleRef
+</pre>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-new"></a><h3>flatpak_bundle_ref_new ()</h3>
+<pre class="programlisting"><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="returnvalue">FlatpakBundleRef</span></a> *
+flatpak_bundle_ref_new (<em class="parameter"><code><span class="type">GFile</span> *file</code></em>,
+                        <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
+<p>Creates a new bundle ref for the given file.</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-new.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>file</p></td>
+<td class="parameter_description"><p>a <span class="type">GFile</span></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>error</p></td>
+<td class="parameter_description"><p>return location for an error. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-new.returns"></a><h4>Returns</h4>
+<p> a new bundle ref.</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-file"></a><h3>flatpak_bundle_ref_get_file ()</h3>
+<pre class="programlisting"><span class="returnvalue">GFile</span> *
+flatpak_bundle_ref_get_file (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>);</pre>
+<p>Get the file this bundle is stored in.</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-file.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-file.returns"></a><h4>Returns</h4>
+<p> (transfer full) : an <span class="type">GFile</span></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-metadata"></a><h3>flatpak_bundle_ref_get_metadata ()</h3>
+<pre class="programlisting"><span class="returnvalue">GBytes</span> *
+flatpak_bundle_ref_get_metadata (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>);</pre>
+<p>Get the metadata for the app/runtime</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-metadata.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-metadata.returns"></a><h4>Returns</h4>
+<p> (transfer full) : an <span class="type">GBytes</span> with the metadata contents, or <code class="literal">NULL</code></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-appstream"></a><h3>flatpak_bundle_ref_get_appstream ()</h3>
+<pre class="programlisting"><span class="returnvalue">GBytes</span> *
+flatpak_bundle_ref_get_appstream (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>);</pre>
+<p>Get the compressed appstream for the app/runtime</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-appstream.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-appstream.returns"></a><h4>Returns</h4>
+<p> (transfer full) : an <span class="type">GBytes</span> with the appstream contents, or <code class="literal">NULL</code></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-icon"></a><h3>flatpak_bundle_ref_get_icon ()</h3>
+<pre class="programlisting"><span class="returnvalue">GBytes</span> *
+flatpak_bundle_ref_get_icon (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>,
+                             <em class="parameter"><code><span class="type">int</span> size</code></em>);</pre>
+<p>Get the icon png data for the app/runtime</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-icon.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>size</p></td>
+<td class="parameter_description"><p>64 or 128</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-icon.returns"></a><h4>Returns</h4>
+<p> (transfer full) : an <span class="type">GBytes</span> with png contents</p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-origin"></a><h3>flatpak_bundle_ref_get_origin ()</h3>
+<pre class="programlisting"><span class="returnvalue">char</span> *
+flatpak_bundle_ref_get_origin (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>);</pre>
+<p>Get the origin url stored in the bundle</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-origin.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-origin.returns"></a><h4>Returns</h4>
+<p> (transfer full) : an url string, or <code class="literal">NULL</code></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="flatpak-bundle-ref-get-installed-size"></a><h3>flatpak_bundle_ref_get_installed_size ()</h3>
+<pre class="programlisting"><span class="returnvalue">guint64</span>
+flatpak_bundle_ref_get_installed_size (<em class="parameter"><code><a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef"><span class="type">FlatpakBundleRef</span></a> *self</code></em>);</pre>
+<p>Returns the installed size for the bundle.</p>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-installed-size.parameters"></a><h4>Parameters</h4>
+<div class="informaltable"><table class="informaltable" width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>self</p></td>
+<td class="parameter_description"><p>a FlatpakBundleRef</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="flatpak-bundle-ref-get-installed-size.returns"></a><h4>Returns</h4>
+<p> the installed size</p>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="FlatpakBundleRef-struct"></a><h3>struct FlatpakBundleRef</h3>
+<pre class="programlisting">struct FlatpakBundleRef;</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="flatpak-flatpak-bundle-ref.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="FlatpakBundleRef--file"></a><h3>The <code class="literal">“file”</code> property</h3>
+<pre class="programlisting">  “file”                     <span class="type">GFile</span> *</pre>
+<p>Flags: Read / Write</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/flatpak.devhelp2 b/doc/reference/html/flatpak.devhelp2
new file mode 100644 (file)
index 0000000..fda27ec
--- /dev/null
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<book xmlns="http://www.devhelp.net/book" title="Flatpak Library Reference Manual" link="index.html" author="" name="flatpak" version="2" language="c">
+  <chapters>
+    <sub name="Flatpak" link="ch01.html">
+      <sub name="FlatpakInstallation" link="FlatpakInstallation.html"/>
+      <sub name="FlatpakRef" link="FlatpakRef.html"/>
+      <sub name="FlatpakInstalledRef" link="FlatpakInstalledRef.html"/>
+      <sub name="FlatpakRemoteRef" link="FlatpakRemoteRef.html"/>
+      <sub name="FlatpakRemote" link="FlatpakRemote.html"/>
+      <sub name="flatpak-bundle-ref" link="flatpak-flatpak-bundle-ref.html"/>
+      <sub name="Error codes" link="flatpak-Error-codes.html"/>
+      <sub name="Version information" link="flatpak-Version-information.html"/>
+    </sub>
+    <sub name="Object Hierarchy" link="object-tree.html"/>
+    <sub name="API Index" link="full-api-index.html"/>
+    <sub name="Annotation Glossary" link="annotation-glossary.html"/>
+  </chapters>
+  <functions>
+    <keyword type="function" name="flatpak_installation_new_system ()" link="FlatpakInstallation.html#flatpak-installation-new-system"/>
+    <keyword type="function" name="flatpak_installation_new_system_with_id ()" link="FlatpakInstallation.html#flatpak-installation-new-system-with-id" since="0.8"/>
+    <keyword type="function" name="flatpak_installation_new_user ()" link="FlatpakInstallation.html#flatpak-installation-new-user"/>
+    <keyword type="function" name="flatpak_installation_new_for_path ()" link="FlatpakInstallation.html#flatpak-installation-new-for-path"/>
+    <keyword type="function" name="flatpak_installation_get_is_user ()" link="FlatpakInstallation.html#flatpak-installation-get-is-user"/>
+    <keyword type="function" name="flatpak_installation_get_path ()" link="FlatpakInstallation.html#flatpak-installation-get-path"/>
+    <keyword type="function" name="flatpak_installation_create_monitor ()" link="FlatpakInstallation.html#flatpak-installation-create-monitor"/>
+    <keyword type="function" name="flatpak_installation_install ()" link="FlatpakInstallation.html#flatpak-installation-install"/>
+    <keyword type="function" name="flatpak_installation_install_full ()" link="FlatpakInstallation.html#flatpak-installation-install-full"/>
+    <keyword type="function" name="flatpak_installation_update ()" link="FlatpakInstallation.html#flatpak-installation-update"/>
+    <keyword type="function" name="flatpak_installation_update_full ()" link="FlatpakInstallation.html#flatpak-installation-update-full"/>
+    <keyword type="function" name="flatpak_installation_uninstall ()" link="FlatpakInstallation.html#flatpak-installation-uninstall"/>
+    <keyword type="function" name="flatpak_installation_launch ()" link="FlatpakInstallation.html#flatpak-installation-launch"/>
+    <keyword type="function" name="flatpak_installation_get_current_installed_app ()" link="FlatpakInstallation.html#flatpak-installation-get-current-installed-app"/>
+    <keyword type="function" name="flatpak_installation_get_display_name ()" link="FlatpakInstallation.html#flatpak-installation-get-display-name" since="0.8"/>
+    <keyword type="function" name="flatpak_installation_get_id ()" link="FlatpakInstallation.html#flatpak-installation-get-id" since="0.8"/>
+    <keyword type="function" name="flatpak_installation_get_installed_ref ()" link="FlatpakInstallation.html#flatpak-installation-get-installed-ref"/>
+    <keyword type="function" name="flatpak_installation_get_priority ()" link="FlatpakInstallation.html#flatpak-installation-get-priority" since="0.8"/>
+    <keyword type="function" name="flatpak_installation_get_storage_type ()" link="FlatpakInstallation.html#flatpak-installation-get-storage-type" since="0.8"/>
+    <keyword type="function" name="flatpak_installation_list_installed_refs ()" link="FlatpakInstallation.html#flatpak-installation-list-installed-refs"/>
+    <keyword type="function" name="flatpak_installation_list_installed_refs_by_kind ()" link="FlatpakInstallation.html#flatpak-installation-list-installed-refs-by-kind"/>
+    <keyword type="function" name="flatpak_installation_list_installed_refs_for_update ()" link="FlatpakInstallation.html#flatpak-installation-list-installed-refs-for-update"/>
+    <keyword type="function" name="flatpak_installation_list_installed_related_refs_sync ()" link="FlatpakInstallation.html#flatpak-installation-list-installed-related-refs-sync" since="0.6.7"/>
+    <keyword type="function" name="flatpak_installation_list_remote_refs_sync ()" link="FlatpakInstallation.html#flatpak-installation-list-remote-refs-sync"/>
+    <keyword type="function" name="flatpak_installation_list_remote_related_refs_sync ()" link="FlatpakInstallation.html#flatpak-installation-list-remote-related-refs-sync" since="0.6.7"/>
+    <keyword type="function" name="flatpak_installation_list_remotes ()" link="FlatpakInstallation.html#flatpak-installation-list-remotes"/>
+    <keyword type="function" name="flatpak_installation_get_remote_by_name ()" link="FlatpakInstallation.html#flatpak-installation-get-remote-by-name"/>
+    <keyword type="function" name="flatpak_installation_fetch_remote_metadata_sync ()" link="FlatpakInstallation.html#flatpak-installation-fetch-remote-metadata-sync"/>
+    <keyword type="function" name="flatpak_installation_fetch_remote_ref_sync ()" link="FlatpakInstallation.html#flatpak-installation-fetch-remote-ref-sync"/>
+    <keyword type="function" name="flatpak_installation_fetch_remote_size_sync ()" link="FlatpakInstallation.html#flatpak-installation-fetch-remote-size-sync"/>
+    <keyword type="function" name="flatpak_installation_load_app_overrides ()" link="FlatpakInstallation.html#flatpak-installation-load-app-overrides"/>
+    <keyword type="function" name="flatpak_installation_update_appstream_sync ()" link="FlatpakInstallation.html#flatpak-installation-update-appstream-sync"/>
+    <keyword type="function" name="flatpak_installation_install_bundle ()" link="FlatpakInstallation.html#flatpak-installation-install-bundle"/>
+    <keyword type="function" name="flatpak_installation_install_ref_file ()" link="FlatpakInstallation.html#flatpak-installation-install-ref-file" since="0.6.10"/>
+    <keyword type="function" name="flatpak_installation_drop_caches ()" link="FlatpakInstallation.html#flatpak-installation-drop-caches"/>
+    <keyword type="function" name="flatpak_installation_modify_remote ()" link="FlatpakInstallation.html#flatpak-installation-modify-remote"/>
+    <keyword type="function" name="flatpak_installation_remove_remote ()" link="FlatpakInstallation.html#flatpak-installation-remove-remote"/>
+    <keyword type="function" name="flatpak_installation_update_remote_sync ()" link="FlatpakInstallation.html#flatpak-installation-update-remote-sync" since="0.6.13"/>
+    <keyword type="function" name="flatpak_get_default_arch ()" link="FlatpakInstallation.html#flatpak-get-default-arch"/>
+    <keyword type="function" name="flatpak_get_supported_arches ()" link="FlatpakInstallation.html#flatpak-get-supported-arches"/>
+    <keyword type="function" name="flatpak_get_system_installations ()" link="FlatpakInstallation.html#flatpak-get-system-installations" since="0.8"/>
+    <keyword type="function" name="FlatpakProgressCallback ()" link="FlatpakInstallation.html#FlatpakProgressCallback"/>
+    <keyword type="struct" name="struct FlatpakInstallation" link="FlatpakInstallation.html#FlatpakInstallation-struct"/>
+    <keyword type="enum" name="enum FlatpakUpdateFlags" link="FlatpakInstallation.html#FlatpakUpdateFlags"/>
+    <keyword type="enum" name="enum FlatpakInstallFlags" link="FlatpakInstallation.html#FlatpakInstallFlags"/>
+    <keyword type="enum" name="enum FlatpakStorageType" link="FlatpakInstallation.html#FlatpakStorageType" since="0.6.15"/>
+    <keyword type="function" name="flatpak_ref_format_ref ()" link="FlatpakRef.html#flatpak-ref-format-ref"/>
+    <keyword type="function" name="flatpak_ref_get_arch ()" link="FlatpakRef.html#flatpak-ref-get-arch"/>
+    <keyword type="function" name="flatpak_ref_get_branch ()" link="FlatpakRef.html#flatpak-ref-get-branch"/>
+    <keyword type="function" name="flatpak_ref_get_commit ()" link="FlatpakRef.html#flatpak-ref-get-commit"/>
+    <keyword type="function" name="flatpak_ref_get_kind ()" link="FlatpakRef.html#flatpak-ref-get-kind"/>
+    <keyword type="function" name="flatpak_ref_get_name ()" link="FlatpakRef.html#flatpak-ref-get-name"/>
+    <keyword type="function" name="flatpak_ref_parse ()" link="FlatpakRef.html#flatpak-ref-parse"/>
+    <keyword type="struct" name="struct FlatpakRef" link="FlatpakRef.html#FlatpakRef-struct"/>
+    <keyword type="enum" name="enum FlatpakRefKind" link="FlatpakRef.html#FlatpakRefKind"/>
+    <keyword type="property" name="The “arch” property" link="FlatpakRef.html#FlatpakRef--arch"/>
+    <keyword type="property" name="The “branch” property" link="FlatpakRef.html#FlatpakRef--branch"/>
+    <keyword type="property" name="The “collection-id” property" link="FlatpakRef.html#FlatpakRef--collection-id"/>
+    <keyword type="property" name="The “commit” property" link="FlatpakRef.html#FlatpakRef--commit"/>
+    <keyword type="property" name="The “kind” property" link="FlatpakRef.html#FlatpakRef--kind"/>
+    <keyword type="property" name="The “name” property" link="FlatpakRef.html#FlatpakRef--name"/>
+    <keyword type="function" name="flatpak_installed_ref_get_deploy_dir ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-deploy-dir"/>
+    <keyword type="function" name="flatpak_installed_ref_get_installed_size ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-installed-size"/>
+    <keyword type="function" name="flatpak_installed_ref_get_is_current ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-is-current"/>
+    <keyword type="function" name="flatpak_installed_ref_get_latest_commit ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-latest-commit"/>
+    <keyword type="function" name="flatpak_installed_ref_get_origin ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-origin"/>
+    <keyword type="function" name="flatpak_installed_ref_load_metadata ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-load-metadata"/>
+    <keyword type="function" name="flatpak_installed_ref_get_subpaths ()" link="FlatpakInstalledRef.html#flatpak-installed-ref-get-subpaths"/>
+    <keyword type="struct" name="struct FlatpakInstalledRef" link="FlatpakInstalledRef.html#FlatpakInstalledRef-struct"/>
+    <keyword type="property" name="The “deploy-dir” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--deploy-dir"/>
+    <keyword type="property" name="The “installed-size” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--installed-size"/>
+    <keyword type="property" name="The “is-current” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--is-current"/>
+    <keyword type="property" name="The “latest-commit” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--latest-commit"/>
+    <keyword type="property" name="The “origin” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--origin"/>
+    <keyword type="property" name="The “subpaths” property" link="FlatpakInstalledRef.html#FlatpakInstalledRef--subpaths"/>
+    <keyword type="function" name="flatpak_remote_ref_get_remote_name ()" link="FlatpakRemoteRef.html#flatpak-remote-ref-get-remote-name"/>
+    <keyword type="struct" name="struct FlatpakRemoteRef" link="FlatpakRemoteRef.html#FlatpakRemoteRef-struct"/>
+    <keyword type="property" name="The “remote-name” property" link="FlatpakRemoteRef.html#FlatpakRemoteRef--remote-name"/>
+    <keyword type="function" name="flatpak_remote_new ()" link="FlatpakRemote.html#flatpak-remote-new"/>
+    <keyword type="function" name="flatpak_remote_get_name ()" link="FlatpakRemote.html#flatpak-remote-get-name"/>
+    <keyword type="function" name="flatpak_remote_get_appstream_dir ()" link="FlatpakRemote.html#flatpak-remote-get-appstream-dir"/>
+    <keyword type="function" name="flatpak_remote_get_appstream_timestamp ()" link="FlatpakRemote.html#flatpak-remote-get-appstream-timestamp"/>
+    <keyword type="function" name="flatpak_remote_get_gpg_verify ()" link="FlatpakRemote.html#flatpak-remote-get-gpg-verify"/>
+    <keyword type="function" name="flatpak_remote_set_gpg_verify ()" link="FlatpakRemote.html#flatpak-remote-set-gpg-verify"/>
+    <keyword type="function" name="flatpak_remote_set_gpg_key ()" link="FlatpakRemote.html#flatpak-remote-set-gpg-key"/>
+    <keyword type="function" name="flatpak_remote_get_noenumerate ()" link="FlatpakRemote.html#flatpak-remote-get-noenumerate"/>
+    <keyword type="function" name="flatpak_remote_set_noenumerate ()" link="FlatpakRemote.html#flatpak-remote-set-noenumerate"/>
+    <keyword type="function" name="flatpak_remote_get_prio ()" link="FlatpakRemote.html#flatpak-remote-get-prio"/>
+    <keyword type="function" name="flatpak_remote_set_prio ()" link="FlatpakRemote.html#flatpak-remote-set-prio"/>
+    <keyword type="function" name="flatpak_remote_get_title ()" link="FlatpakRemote.html#flatpak-remote-get-title"/>
+    <keyword type="function" name="flatpak_remote_set_title ()" link="FlatpakRemote.html#flatpak-remote-set-title"/>
+    <keyword type="function" name="flatpak_remote_get_url ()" link="FlatpakRemote.html#flatpak-remote-get-url"/>
+    <keyword type="function" name="flatpak_remote_set_url ()" link="FlatpakRemote.html#flatpak-remote-set-url"/>
+    <keyword type="function" name="flatpak_remote_get_disabled ()" link="FlatpakRemote.html#flatpak-remote-get-disabled"/>
+    <keyword type="function" name="flatpak_remote_set_disabled ()" link="FlatpakRemote.html#flatpak-remote-set-disabled"/>
+    <keyword type="struct" name="struct FlatpakRemote" link="FlatpakRemote.html#FlatpakRemote-struct"/>
+    <keyword type="property" name="The “name” property" link="FlatpakRemote.html#FlatpakRemote--name"/>
+    <keyword type="property" name="The “type” property" link="FlatpakRemote.html#FlatpakRemote--type"/>
+    <keyword type="function" name="flatpak_bundle_ref_new ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-new"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_file ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-file"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_metadata ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-metadata"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_appstream ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-appstream"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_icon ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-icon"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_origin ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-origin"/>
+    <keyword type="function" name="flatpak_bundle_ref_get_installed_size ()" link="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-installed-size"/>
+    <keyword type="struct" name="struct FlatpakBundleRef" link="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef-struct"/>
+    <keyword type="property" name="The “file” property" link="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef--file"/>
+    <keyword type="function" name="flatpak_error_quark ()" link="flatpak-Error-codes.html#flatpak-error-quark"/>
+    <keyword type="macro" name="FLATPAK_ERROR" link="flatpak-Error-codes.html#FLATPAK-ERROR:CAPS"/>
+    <keyword type="enum" name="enum FlatpakError" link="flatpak-Error-codes.html#FlatpakError"/>
+    <keyword type="macro" name="FLATPAK_MAJOR_VERSION" link="flatpak-Version-information.html#FLATPAK-MAJOR-VERSION:CAPS"/>
+    <keyword type="macro" name="FLATPAK_MINOR_VERSION" link="flatpak-Version-information.html#FLATPAK-MINOR-VERSION:CAPS"/>
+    <keyword type="macro" name="FLATPAK_MICRO_VERSION" link="flatpak-Version-information.html#FLATPAK-MICRO-VERSION:CAPS"/>
+    <keyword type="macro" name="FLATPAK_EXTERN" link="flatpak-Version-information.html#FLATPAK-EXTERN:CAPS"/>
+    <keyword type="constant" name="FLATPAK_UPDATE_FLAGS_NONE" link="FlatpakInstallation.html#FLATPAK-UPDATE-FLAGS-NONE:CAPS"/>
+    <keyword type="constant" name="FLATPAK_UPDATE_FLAGS_NO_DEPLOY" link="FlatpakInstallation.html#FLATPAK-UPDATE-FLAGS-NO-DEPLOY:CAPS"/>
+    <keyword type="constant" name="FLATPAK_UPDATE_FLAGS_NO_PULL" link="FlatpakInstallation.html#FLATPAK-UPDATE-FLAGS-NO-PULL:CAPS"/>
+    <keyword type="constant" name="FLATPAK_UPDATE_FLAGS_NO_STATIC_DELTAS" link="FlatpakInstallation.html#FLATPAK-UPDATE-FLAGS-NO-STATIC-DELTAS:CAPS"/>
+    <keyword type="constant" name="FLATPAK_INSTALL_FLAGS_NONE" link="FlatpakInstallation.html#FLATPAK-INSTALL-FLAGS-NONE:CAPS"/>
+    <keyword type="constant" name="FLATPAK_INSTALL_FLAGS_NO_STATIC_DELTAS" link="FlatpakInstallation.html#FLATPAK-INSTALL-FLAGS-NO-STATIC-DELTAS:CAPS"/>
+    <keyword type="constant" name="FLATPAK_INSTALL_FLAGS_NO_DEPLOY" link="FlatpakInstallation.html#FLATPAK-INSTALL-FLAGS-NO-DEPLOY:CAPS"/>
+    <keyword type="constant" name="FLATPAK_INSTALL_FLAGS_NO_PULL" link="FlatpakInstallation.html#FLATPAK-INSTALL-FLAGS-NO-PULL:CAPS"/>
+    <keyword type="constant" name="FLATPAK_STORAGE_TYPE_DEFAULT" link="FlatpakInstallation.html#FLATPAK-STORAGE-TYPE-DEFAULT:CAPS"/>
+    <keyword type="constant" name="FLATPAK_STORAGE_TYPE_HARD_DISK" link="FlatpakInstallation.html#FLATPAK-STORAGE-TYPE-HARD-DISK:CAPS"/>
+    <keyword type="constant" name="FLATPAK_STORAGE_TYPE_SDCARD" link="FlatpakInstallation.html#FLATPAK-STORAGE-TYPE-SDCARD:CAPS"/>
+    <keyword type="constant" name="FLATPAK_STORAGE_TYPE_MMC" link="FlatpakInstallation.html#FLATPAK-STORAGE-TYPE-MMC:CAPS"/>
+    <keyword type="constant" name="FLATPAK_REF_KIND_APP" link="FlatpakRef.html#FLATPAK-REF-KIND-APP:CAPS"/>
+    <keyword type="constant" name="FLATPAK_REF_KIND_RUNTIME" link="FlatpakRef.html#FLATPAK-REF-KIND-RUNTIME:CAPS"/>
+    <keyword type="constant" name="FLATPAK_ERROR_ALREADY_INSTALLED" link="flatpak-Error-codes.html#FLATPAK-ERROR-ALREADY-INSTALLED:CAPS"/>
+    <keyword type="constant" name="FLATPAK_ERROR_NOT_INSTALLED" link="flatpak-Error-codes.html#FLATPAK-ERROR-NOT-INSTALLED:CAPS"/>
+    <keyword type="constant" name="FLATPAK_ERROR_ONLY_PULLED" link="flatpak-Error-codes.html#FLATPAK-ERROR-ONLY-PULLED:CAPS"/>
+  </functions>
+</book>
diff --git a/doc/reference/html/full-api-index.html b/doc/reference/html/full-api-index.html
new file mode 100644 (file)
index 0000000..488e43c
--- /dev/null
@@ -0,0 +1,510 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>API Index: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="prev" href="object-tree.html" title="Object Hierarchy">
+<link rel="next" href="annotation-glossary.html" title="Annotation Glossary">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"><span id="nav_index"><a class="shortcut" href="#idxB">B</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxE">E</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxG">G</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxI">I</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxM">M</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxP">P</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxR">R</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxS">S</a>
+                     <span class="dim">|</span> 
+                  <a class="shortcut" href="#idxU">U</a></span></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
+<td><a accesskey="p" href="object-tree.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="annotation-glossary.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="index">
+<div class="titlepage"><div><div><h1 class="title">
+<a name="full-api-index"></a>API Index</h1></div></div></div>
+<a name="idx"></a><a name="idxB"></a><h3 class="title">B</h3>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef-struct" title="struct FlatpakBundleRef">FlatpakBundleRef</a>, struct in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef--file" title="The “file” property">FlatpakBundleRef:file</a>, object property in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-appstream" title="flatpak_bundle_ref_get_appstream ()">flatpak_bundle_ref_get_appstream</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-file" title="flatpak_bundle_ref_get_file ()">flatpak_bundle_ref_get_file</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-icon" title="flatpak_bundle_ref_get_icon ()">flatpak_bundle_ref_get_icon</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-installed-size" title="flatpak_bundle_ref_get_installed_size ()">flatpak_bundle_ref_get_installed_size</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-metadata" title="flatpak_bundle_ref_get_metadata ()">flatpak_bundle_ref_get_metadata</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-get-origin" title="flatpak_bundle_ref_get_origin ()">flatpak_bundle_ref_get_origin</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-flatpak-bundle-ref.html#flatpak-bundle-ref-new" title="flatpak_bundle_ref_new ()">flatpak_bundle_ref_new</a>, function in <a class="link" href="flatpak-flatpak-bundle-ref.html" title="flatpak-bundle-ref">flatpak-bundle-ref</a>
+</dt>
+<dd></dd>
+<a name="idxE"></a><h3 class="title">E</h3>
+<dt>
+<a class="link" href="flatpak-Error-codes.html#FLATPAK-ERROR:CAPS" title="FLATPAK_ERROR">FLATPAK_ERROR</a>, macro in <a class="link" href="flatpak-Error-codes.html" title="Error codes">Error codes</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-Error-codes.html#FlatpakError" title="enum FlatpakError">FlatpakError</a>, enum in <a class="link" href="flatpak-Error-codes.html" title="Error codes">Error codes</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-Error-codes.html#flatpak-error-quark" title="flatpak_error_quark ()">flatpak_error_quark</a>, function in <a class="link" href="flatpak-Error-codes.html" title="Error codes">Error codes</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-Version-information.html#FLATPAK-EXTERN:CAPS" title="FLATPAK_EXTERN">FLATPAK_EXTERN</a>, macro in <a class="link" href="flatpak-Version-information.html" title="Version information">Version information</a>
+</dt>
+<dd></dd>
+<a name="idxG"></a><h3 class="title">G</h3>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-get-default-arch" title="flatpak_get_default_arch ()">flatpak_get_default_arch</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-get-supported-arches" title="flatpak_get_supported_arches ()">flatpak_get_supported_arches</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-get-system-installations" title="flatpak_get_system_installations ()">flatpak_get_system_installations</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<a name="idxI"></a><h3 class="title">I</h3>
+<dt>
+<a class="link" href="FlatpakInstallation.html#FlatpakInstallation-struct" title="struct FlatpakInstallation">FlatpakInstallation</a>, struct in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-create-monitor" title="flatpak_installation_create_monitor ()">flatpak_installation_create_monitor</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-drop-caches" title="flatpak_installation_drop_caches ()">flatpak_installation_drop_caches</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-metadata-sync" title="flatpak_installation_fetch_remote_metadata_sync ()">flatpak_installation_fetch_remote_metadata_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-ref-sync" title="flatpak_installation_fetch_remote_ref_sync ()">flatpak_installation_fetch_remote_ref_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-fetch-remote-size-sync" title="flatpak_installation_fetch_remote_size_sync ()">flatpak_installation_fetch_remote_size_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-current-installed-app" title="flatpak_installation_get_current_installed_app ()">flatpak_installation_get_current_installed_app</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-display-name" title="flatpak_installation_get_display_name ()">flatpak_installation_get_display_name</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-id" title="flatpak_installation_get_id ()">flatpak_installation_get_id</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-installed-ref" title="flatpak_installation_get_installed_ref ()">flatpak_installation_get_installed_ref</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-is-user" title="flatpak_installation_get_is_user ()">flatpak_installation_get_is_user</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-path" title="flatpak_installation_get_path ()">flatpak_installation_get_path</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-priority" title="flatpak_installation_get_priority ()">flatpak_installation_get_priority</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-remote-by-name" title="flatpak_installation_get_remote_by_name ()">flatpak_installation_get_remote_by_name</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-get-storage-type" title="flatpak_installation_get_storage_type ()">flatpak_installation_get_storage_type</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install" title="flatpak_installation_install ()">flatpak_installation_install</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-bundle" title="flatpak_installation_install_bundle ()">flatpak_installation_install_bundle</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-full" title="flatpak_installation_install_full ()">flatpak_installation_install_full</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-install-ref-file" title="flatpak_installation_install_ref_file ()">flatpak_installation_install_ref_file</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-launch" title="flatpak_installation_launch ()">flatpak_installation_launch</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs" title="flatpak_installation_list_installed_refs ()">flatpak_installation_list_installed_refs</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs-by-kind" title="flatpak_installation_list_installed_refs_by_kind ()">flatpak_installation_list_installed_refs_by_kind</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-refs-for-update" title="flatpak_installation_list_installed_refs_for_update ()">flatpak_installation_list_installed_refs_for_update</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-installed-related-refs-sync" title="flatpak_installation_list_installed_related_refs_sync ()">flatpak_installation_list_installed_related_refs_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remotes" title="flatpak_installation_list_remotes ()">flatpak_installation_list_remotes</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remote-refs-sync" title="flatpak_installation_list_remote_refs_sync ()">flatpak_installation_list_remote_refs_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-list-remote-related-refs-sync" title="flatpak_installation_list_remote_related_refs_sync ()">flatpak_installation_list_remote_related_refs_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-load-app-overrides" title="flatpak_installation_load_app_overrides ()">flatpak_installation_load_app_overrides</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-modify-remote" title="flatpak_installation_modify_remote ()">flatpak_installation_modify_remote</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-for-path" title="flatpak_installation_new_for_path ()">flatpak_installation_new_for_path</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-system" title="flatpak_installation_new_system ()">flatpak_installation_new_system</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-system-with-id" title="flatpak_installation_new_system_with_id ()">flatpak_installation_new_system_with_id</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-new-user" title="flatpak_installation_new_user ()">flatpak_installation_new_user</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-remove-remote" title="flatpak_installation_remove_remote ()">flatpak_installation_remove_remote</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-uninstall" title="flatpak_installation_uninstall ()">flatpak_installation_uninstall</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update" title="flatpak_installation_update ()">flatpak_installation_update</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-appstream-sync" title="flatpak_installation_update_appstream_sync ()">flatpak_installation_update_appstream_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-full" title="flatpak_installation_update_full ()">flatpak_installation_update_full</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#flatpak-installation-update-remote-sync" title="flatpak_installation_update_remote_sync ()">flatpak_installation_update_remote_sync</a>, function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef-struct" title="struct FlatpakInstalledRef">FlatpakInstalledRef</a>, struct in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--deploy-dir" title="The “deploy-dir” property">FlatpakInstalledRef:deploy-dir</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--installed-size" title="The “installed-size” property">FlatpakInstalledRef:installed-size</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--is-current" title="The “is-current” property">FlatpakInstalledRef:is-current</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--latest-commit" title="The “latest-commit” property">FlatpakInstalledRef:latest-commit</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--origin" title="The “origin” property">FlatpakInstalledRef:origin</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#FlatpakInstalledRef--subpaths" title="The “subpaths” property">FlatpakInstalledRef:subpaths</a>, object property in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-deploy-dir" title="flatpak_installed_ref_get_deploy_dir ()">flatpak_installed_ref_get_deploy_dir</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-installed-size" title="flatpak_installed_ref_get_installed_size ()">flatpak_installed_ref_get_installed_size</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-is-current" title="flatpak_installed_ref_get_is_current ()">flatpak_installed_ref_get_is_current</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-latest-commit" title="flatpak_installed_ref_get_latest_commit ()">flatpak_installed_ref_get_latest_commit</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-origin" title="flatpak_installed_ref_get_origin ()">flatpak_installed_ref_get_origin</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-get-subpaths" title="flatpak_installed_ref_get_subpaths ()">flatpak_installed_ref_get_subpaths</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstalledRef.html#flatpak-installed-ref-load-metadata" title="flatpak_installed_ref_load_metadata ()">flatpak_installed_ref_load_metadata</a>, function in <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakInstallation.html#FlatpakInstallFlags" title="enum FlatpakInstallFlags">FlatpakInstallFlags</a>, enum in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<a name="idxM"></a><h3 class="title">M</h3>
+<dt>
+<a class="link" href="flatpak-Version-information.html#FLATPAK-MAJOR-VERSION:CAPS" title="FLATPAK_MAJOR_VERSION">FLATPAK_MAJOR_VERSION</a>, macro in <a class="link" href="flatpak-Version-information.html" title="Version information">Version information</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-Version-information.html#FLATPAK-MICRO-VERSION:CAPS" title="FLATPAK_MICRO_VERSION">FLATPAK_MICRO_VERSION</a>, macro in <a class="link" href="flatpak-Version-information.html" title="Version information">Version information</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="flatpak-Version-information.html#FLATPAK-MINOR-VERSION:CAPS" title="FLATPAK_MINOR_VERSION">FLATPAK_MINOR_VERSION</a>, macro in <a class="link" href="flatpak-Version-information.html" title="Version information">Version information</a>
+</dt>
+<dd></dd>
+<a name="idxP"></a><h3 class="title">P</h3>
+<dt>
+<a class="link" href="FlatpakInstallation.html#FlatpakProgressCallback" title="FlatpakProgressCallback ()">FlatpakProgressCallback</a>, user_function in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<a name="idxR"></a><h3 class="title">R</h3>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef-struct" title="struct FlatpakRef">FlatpakRef</a>, struct in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--arch" title="The “arch” property">FlatpakRef:arch</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--branch" title="The “branch” property">FlatpakRef:branch</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--collection-id" title="The “collection-id” property">FlatpakRef:collection-id</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--commit" title="The “commit” property">FlatpakRef:commit</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--kind" title="The “kind” property">FlatpakRef:kind</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRef--name" title="The “name” property">FlatpakRef:name</a>, object property in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#FlatpakRefKind" title="enum FlatpakRefKind">FlatpakRefKind</a>, enum in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-format-ref" title="flatpak_ref_format_ref ()">flatpak_ref_format_ref</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-arch" title="flatpak_ref_get_arch ()">flatpak_ref_get_arch</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-branch" title="flatpak_ref_get_branch ()">flatpak_ref_get_branch</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-commit" title="flatpak_ref_get_commit ()">flatpak_ref_get_commit</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-kind" title="flatpak_ref_get_kind ()">flatpak_ref_get_kind</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-get-name" title="flatpak_ref_get_name ()">flatpak_ref_get_name</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRef.html#flatpak-ref-parse" title="flatpak_ref_parse ()">flatpak_ref_parse</a>, function in <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#FlatpakRemote-struct" title="struct FlatpakRemote">FlatpakRemote</a>, struct in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#FlatpakRemote--name" title="The “name” property">FlatpakRemote:name</a>, object property in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#FlatpakRemote--type" title="The “type” property">FlatpakRemote:type</a>, object property in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemoteRef.html#FlatpakRemoteRef-struct" title="struct FlatpakRemoteRef">FlatpakRemoteRef</a>, struct in <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">FlatpakRemoteRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemoteRef.html#FlatpakRemoteRef--remote-name" title="The “remote-name” property">FlatpakRemoteRef:remote-name</a>, object property in <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">FlatpakRemoteRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-appstream-dir" title="flatpak_remote_get_appstream_dir ()">flatpak_remote_get_appstream_dir</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-appstream-timestamp" title="flatpak_remote_get_appstream_timestamp ()">flatpak_remote_get_appstream_timestamp</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-disabled" title="flatpak_remote_get_disabled ()">flatpak_remote_get_disabled</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-gpg-verify" title="flatpak_remote_get_gpg_verify ()">flatpak_remote_get_gpg_verify</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-name" title="flatpak_remote_get_name ()">flatpak_remote_get_name</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-noenumerate" title="flatpak_remote_get_noenumerate ()">flatpak_remote_get_noenumerate</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-prio" title="flatpak_remote_get_prio ()">flatpak_remote_get_prio</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-title" title="flatpak_remote_get_title ()">flatpak_remote_get_title</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-get-url" title="flatpak_remote_get_url ()">flatpak_remote_get_url</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-new" title="flatpak_remote_new ()">flatpak_remote_new</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemoteRef.html#flatpak-remote-ref-get-remote-name" title="flatpak_remote_ref_get_remote_name ()">flatpak_remote_ref_get_remote_name</a>, function in <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">FlatpakRemoteRef</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-disabled" title="flatpak_remote_set_disabled ()">flatpak_remote_set_disabled</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-gpg-key" title="flatpak_remote_set_gpg_key ()">flatpak_remote_set_gpg_key</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-gpg-verify" title="flatpak_remote_set_gpg_verify ()">flatpak_remote_set_gpg_verify</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-noenumerate" title="flatpak_remote_set_noenumerate ()">flatpak_remote_set_noenumerate</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-prio" title="flatpak_remote_set_prio ()">flatpak_remote_set_prio</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-title" title="flatpak_remote_set_title ()">flatpak_remote_set_title</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="FlatpakRemote.html#flatpak-remote-set-url" title="flatpak_remote_set_url ()">flatpak_remote_set_url</a>, function in <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</dt>
+<dd></dd>
+<a name="idxS"></a><h3 class="title">S</h3>
+<dt>
+<a class="link" href="FlatpakInstallation.html#FlatpakStorageType" title="enum FlatpakStorageType">FlatpakStorageType</a>, enum in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+<a name="idxU"></a><h3 class="title">U</h3>
+<dt>
+<a class="link" href="FlatpakInstallation.html#FlatpakUpdateFlags" title="enum FlatpakUpdateFlags">FlatpakUpdateFlags</a>, enum in <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+</dt>
+<dd></dd>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/home.png b/doc/reference/html/home.png
new file mode 100644 (file)
index 0000000..9346b33
Binary files /dev/null and b/doc/reference/html/home.png differ
diff --git a/doc/reference/html/index.html b/doc/reference/html/index.html
new file mode 100644 (file)
index 0000000..c13580f
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Flatpak Library Reference Manual: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="next" href="ch01.html" title="Flatpak">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="book">
+<div class="titlepage">
+<div>
+<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Flatpak Library Reference Manual</p></th></tr></table></div>
+<div><p class="releaseinfo">
+      For flatpak 0.10.2
+
+    </p></div>
+</div>
+<hr>
+</div>
+<div class="toc"><dl class="toc">
+<dt><span class="chapter"><a href="ch01.html">Flatpak</a></span></dt>
+<dd><dl>
+<dt>
+<span class="refentrytitle"><a href="FlatpakInstallation.html">FlatpakInstallation</a></span><span class="refpurpose"> — Installation information</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRef.html">FlatpakRef</a></span><span class="refpurpose"> — Application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakInstalledRef.html">FlatpakInstalledRef</a></span><span class="refpurpose"> — Installed application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRemoteRef.html">FlatpakRemoteRef</a></span><span class="refpurpose"> — Remote application reference</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="FlatpakRemote.html">FlatpakRemote</a></span><span class="refpurpose"> — Remote repository</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-flatpak-bundle-ref.html">flatpak-bundle-ref</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-Error-codes.html">Error codes</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="flatpak-Version-information.html">Version information</a></span><span class="refpurpose"></span>
+</dt>
+</dl></dd>
+<dt><span class="chapter"><a href="object-tree.html">Object Hierarchy</a></span></dt>
+<dt><span class="index"><a href="full-api-index.html">API Index</a></span></dt>
+<dt><span class="glossary"><a href="annotation-glossary.html">Annotation Glossary</a></span></dt>
+</dl></div>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/left-insensitive.png b/doc/reference/html/left-insensitive.png
new file mode 100644 (file)
index 0000000..3269393
Binary files /dev/null and b/doc/reference/html/left-insensitive.png differ
diff --git a/doc/reference/html/left.png b/doc/reference/html/left.png
new file mode 100644 (file)
index 0000000..2abde03
Binary files /dev/null and b/doc/reference/html/left.png differ
diff --git a/doc/reference/html/object-tree.html b/doc/reference/html/object-tree.html
new file mode 100644 (file)
index 0000000..b15d427
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Object Hierarchy: Flatpak Library Reference Manual</title>
+<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<link rel="home" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="up" href="index.html" title="Flatpak Library Reference Manual">
+<link rel="prev" href="flatpak-Version-information.html" title="Version information">
+<link rel="next" href="full-api-index.html" title="API Index">
+<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
+<td><a accesskey="p" href="flatpak-Version-information.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="full-api-index.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="chapter">
+<div class="titlepage"><div><div><h1 class="title">
+<a name="object-tree"></a>Object Hierarchy</h1></div></div></div>
+<pre class="screen">
+    GObject
+    <span class="lineart">├──</span> <a class="link" href="FlatpakRef.html" title="FlatpakRef">FlatpakRef</a>
+    <span class="lineart">│</span>   <span class="lineart">├──</span> <a class="link" href="flatpak-flatpak-bundle-ref.html#FlatpakBundleRef">FlatpakBundleRef</a>
+    <span class="lineart">│</span>   <span class="lineart">├──</span> <a class="link" href="FlatpakInstalledRef.html" title="FlatpakInstalledRef">FlatpakInstalledRef</a>
+    <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="FlatpakRemoteRef.html" title="FlatpakRemoteRef">FlatpakRemoteRef</a>
+    <span class="lineart">├──</span> <a class="link" href="FlatpakInstallation.html" title="FlatpakInstallation">FlatpakInstallation</a>
+    <span class="lineart">╰──</span> <a class="link" href="FlatpakRemote.html" title="FlatpakRemote">FlatpakRemote</a>
+</pre>
+</div>
+<div class="footer">
+<hr>Generated by GTK-Doc V1.26.1</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/doc/reference/html/right-insensitive.png b/doc/reference/html/right-insensitive.png
new file mode 100644 (file)
index 0000000..4c95785
Binary files /dev/null and b/doc/reference/html/right-insensitive.png differ
diff --git a/doc/reference/html/right.png b/doc/reference/html/right.png
new file mode 100644 (file)
index 0000000..76260ec
Binary files /dev/null and b/doc/reference/html/right.png differ
diff --git a/doc/reference/html/style.css b/doc/reference/html/style.css
new file mode 100644 (file)
index 0000000..3675420
--- /dev/null
@@ -0,0 +1,479 @@
+body
+{
+  font-family: cantarell, sans-serif;
+}
+.synopsis, .classsynopsis
+{
+  /* tango:aluminium 1/2 */
+  background: #eeeeec;
+  background: rgba(238, 238, 236, 0.5);
+  border: solid 1px rgb(238, 238, 236);
+  padding: 0.5em;
+}
+.programlisting
+{
+  /* tango:sky blue 0/1 */
+  /* fallback for no rgba support */
+  background: #e6f3ff;
+  border: solid 1px #729fcf;
+  background: rgba(114, 159, 207, 0.1);
+  border: solid 1px rgba(114, 159, 207, 0.2);
+  padding: 0.5em;
+}
+.variablelist
+{
+  padding: 4px;
+  margin-left: 3em;
+}
+.variablelist td:first-child
+{
+  vertical-align: top;
+}
+
+div.gallery-float
+{
+  float: left;
+  padding: 10px;
+}
+div.gallery-float img
+{
+  border-style: none;
+}
+div.gallery-spacer
+{
+  clear: both;
+}
+
+a, a:visited
+{
+  text-decoration: none;
+  /* tango:sky blue 2 */
+  color: #3465a4;
+}
+a:hover
+{
+  text-decoration: underline;
+  /* tango:sky blue 1 */
+  color: #729fcf;
+}
+
+div.informaltable table
+{
+  border-collapse: separate;
+  border-spacing: 1em 0.3em;
+  border: none;
+}
+
+div.informaltable table td, div.informaltable table th
+{
+  vertical-align: top;
+}
+
+.function_type,
+.variable_type,
+.property_type,
+.signal_type,
+.parameter_name,
+.struct_member_name,
+.union_member_name,
+.define_keyword,
+.datatype_keyword,
+.typedef_keyword
+{
+  text-align: right;
+}
+
+/* dim non-primary columns */
+.c_punctuation,
+.function_type,
+.variable_type,
+.property_type,
+.signal_type,
+.define_keyword,
+.datatype_keyword,
+.typedef_keyword,
+.property_flags,
+.signal_flags,
+.parameter_annotations,
+.enum_member_annotations,
+.struct_member_annotations,
+.union_member_annotations
+{
+  color: #888a85;
+}
+
+.function_type a,
+.function_type a:visited,
+.function_type a:hover,
+.property_type a,
+.property_type a:visited,
+.property_type a:hover,
+.signal_type a,
+.signal_type a:visited,
+.signal_type a:hover,
+.signal_flags a,
+.signal_flags a:visited,
+.signal_flags a:hover
+{
+ color: #729fcf;
+}
+
+td p
+{
+  margin: 0.25em;
+}
+
+div.table table
+{
+  border-collapse: collapse;
+  border-spacing: 0px;
+  /* tango:aluminium 3 */
+  border: solid 1px #babdb6;
+}
+
+div.table table td, div.table table th
+{
+  /* tango:aluminium 3 */
+  border: solid 1px #babdb6;
+  padding: 3px;
+  vertical-align: top;
+}
+
+div.table table th
+{
+  /* tango:aluminium 2 */
+  background-color: #d3d7cf;
+}
+
+h4
+{
+  color: #555753;
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+hr
+{
+  /* tango:aluminium 1 */
+  color: #d3d7cf;
+  background: #d3d7cf;
+  border: none 0px;
+  height: 1px;
+  clear: both;
+  margin: 2.0em 0em 2.0em 0em;
+}
+
+dl.toc dt
+{
+  padding-bottom: 0.25em;
+}
+
+dl.toc > dt
+{
+  padding-top: 0.25em;
+  padding-bottom: 0.25em;
+  font-weight: bold;
+}
+
+dl.toc > dl
+{
+  padding-bottom: 0.5em;
+}
+
+.parameter
+{
+  font-style: normal;
+}
+
+.footer
+{
+  padding-top: 3.5em;
+  /* tango:aluminium 3 */
+  color: #babdb6;
+  text-align: center;
+  font-size: 80%;
+}
+
+.informalfigure,
+.figure
+{
+  margin: 1em;
+}
+
+.informalexample,
+.example
+{
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+.warning
+{
+  /* tango:orange 0/1 */
+  background: #ffeed9;
+  background: rgba(252, 175, 62, 0.1);
+  border-color: #ffb04f;
+  border-color: rgba(252, 175, 62, 0.2);
+}
+.note
+{
+  /* tango:chameleon 0/0.5 */
+  background: #d8ffb2;
+  background: rgba(138, 226, 52, 0.1);
+  border-color: #abf562;
+  border-color: rgba(138, 226, 52, 0.2);
+}
+div.blockquote
+{
+  border-color: #eeeeec;
+}
+.note, .warning, div.blockquote
+{
+  padding: 0.5em;
+  border-width: 1px;
+  border-style: solid;
+  margin: 2em;
+}
+.note p, .warning p
+{
+  margin: 0;
+}
+
+div.warning h3.title,
+div.note h3.title
+{
+  display: none;
+}
+
+p + div.section
+{
+  margin-top: 1em;
+}
+
+div.refnamediv,
+div.refsynopsisdiv,
+div.refsect1,
+div.refsect2,
+div.toc,
+div.section
+{
+  margin-bottom: 1em;
+}
+
+/* blob links */
+h2 .extralinks, h3 .extralinks
+{
+  float: right;
+  /* tango:aluminium 3 */
+  color: #babdb6;
+  font-size: 80%;
+  font-weight: normal;
+}
+
+.lineart
+{
+  color: #d3d7cf;
+  font-weight: normal;
+}
+
+.annotation
+{
+  /* tango:aluminium 5 */
+  color: #555753;
+  font-weight: normal;
+}
+
+.structfield
+{
+  font-style: normal;
+  font-weight: normal;
+}
+
+acronym,abbr 
+{
+  border-bottom: 1px dotted gray;
+}
+
+/* code listings */
+
+.listing_code .programlisting .normal,
+.listing_code .programlisting .normal a,
+.listing_code .programlisting .number,
+.listing_code .programlisting .cbracket,
+.listing_code .programlisting .symbol     { color: #555753; }
+.listing_code .programlisting .comment,
+.listing_code .programlisting .linenum    { color: #babdb6; } /* tango: aluminium 3 */
+.listing_code .programlisting .function,
+.listing_code .programlisting .function a,
+.listing_code .programlisting .preproc    { color: #204a87; } /* tango: sky blue 3  */
+.listing_code .programlisting .string     { color: #ad7fa8; } /* tango: plum */
+.listing_code .programlisting .keyword,
+.listing_code .programlisting .usertype,
+.listing_code .programlisting .type,
+.listing_code .programlisting .type a     { color: #4e9a06; } /* tango: chameleon 3  */
+
+.listing_frame {
+  /* tango:sky blue 1 */
+  border: solid 1px #729fcf;
+  border: solid 1px rgba(114, 159, 207, 0.2);
+  padding: 0px;
+}
+
+.listing_lines, .listing_code {
+  margin-top: 0px;
+  margin-bottom: 0px;
+  padding: 0.5em;
+}
+.listing_lines {
+  /* tango:sky blue 0.5 */
+  background: #a6c5e3;
+  background: rgba(114, 159, 207, 0.2);
+  /* tango:aluminium 6 */
+  color: #2e3436;
+}
+.listing_code {
+  /* tango:sky blue 0 */
+  background: #e6f3ff;
+  background: rgba(114, 159, 207, 0.1);
+}
+.listing_code .programlisting {
+  /* override from previous */
+  border: none 0px;
+  padding: 0px;
+  background: none;
+}
+.listing_lines pre, .listing_code pre {
+  margin: 0px;
+}
+
+@media screen {
+  /* these have a <sup> as a first child, but since there are no parent selectors
+   * we can't use that. */
+  a.footnote
+  {
+    position: relative;
+    top: 0em ! important;
+  }
+  /* this is needed so that the local anchors are displayed below the naviagtion */
+  div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name]
+  {
+    display: inline-block;
+    position: relative;
+    top:-5em;
+  }
+  /* this seems to be a bug in the xsl style sheets when generating indexes */
+  div.index div.index
+  {
+    top: 0em;
+  }
+  /* make space for the fixed navigation bar and add space at the bottom so that
+   * link targets appear somewhat close to top
+   */
+  body
+  {
+    padding-top: 2.5em;
+    padding-bottom: 500px;
+    max-width: 60em;
+  }
+  p
+  {
+    max-width: 60em;
+  }
+  /* style and size the navigation bar */
+  table.navigation#top
+  {
+    position: fixed;
+    background: #e2e2e2;
+    border-bottom: solid 1px #babdb6;
+    border-spacing: 5px;
+    margin-top: 0;
+    margin-bottom: 0;
+    top: 0;
+    left: 0;
+    z-index: 10;
+  }
+  table.navigation#top td
+  {
+    padding-left: 6px;
+    padding-right: 6px;
+  }
+  .navigation a, .navigation a:visited
+  {
+    /* tango:sky blue 3 */
+    color: #204a87;
+  }
+  .navigation a:hover
+  {
+    /* tango:sky blue 2 */
+    color: #3465a4;
+  }
+  td.shortcuts
+  {
+    /* tango:sky blue 2 */
+    color: #3465a4;
+    font-size: 80%;
+    white-space: nowrap;
+  }
+  td.shortcuts .dim
+  {
+    color: #babdb6;
+  }
+  .navigation .title
+  {
+    font-size: 80%;
+    max-width: none;
+    margin: 0px;
+    font-weight: normal;
+  }
+}
+@media screen and (min-width: 60em) {
+  /* screen larger than 60em */
+  body { margin: auto; }
+}
+@media screen and (max-width: 60em) {
+  /* screen less than 60em */
+  #nav_hierarchy { display: none; }
+  #nav_interfaces { display: none; }
+  #nav_prerequisites { display: none; }
+  #nav_derived_interfaces { display: none; }
+  #nav_implementations { display: none; }
+  #nav_child_properties { display: none; }
+  #nav_style_properties { display: none; }
+  #nav_index { display: none; }
+  #nav_glossary { display: none; }
+  .gallery_image { display: none; }
+  .property_flags { display: none; }
+  .signal_flags { display: none; }
+  .parameter_annotations { display: none; }
+  .enum_member_annotations { display: none; }
+  .struct_member_annotations { display: none; }
+  .union_member_annotations { display: none; }
+  /* now that a column is hidden, optimize space */
+  col.parameters_name { width: auto; }
+  col.parameters_description { width: auto; }
+  col.struct_members_name { width: auto; }
+  col.struct_members_description { width: auto; }
+  col.enum_members_name { width: auto; }
+  col.enum_members_description { width: auto; }
+  col.union_members_name { width: auto; }
+  col.union_members_description { width: auto; }
+  .listing_lines { display: none; }
+}
+@media print {
+  table.navigation {
+    visibility: collapse;
+    display: none;
+  }
+  div.titlepage table.navigation {
+    visibility: visible;
+    display: table;
+    background: #e2e2e2;
+    border: solid 1px #babdb6;
+    margin-top: 0;
+    margin-bottom: 0;
+    top: 0;
+    left: 0;
+    height: 3em;
+  }
+}
+
diff --git a/doc/reference/html/up-insensitive.png b/doc/reference/html/up-insensitive.png
new file mode 100644 (file)
index 0000000..f404986
Binary files /dev/null and b/doc/reference/html/up-insensitive.png differ
diff --git a/doc/reference/html/up.png b/doc/reference/html/up.png
new file mode 100644 (file)
index 0000000..80b4b37
Binary files /dev/null and b/doc/reference/html/up.png differ
diff --git a/doc/reference/version.xml.in b/doc/reference/version.xml.in
new file mode 100644 (file)
index 0000000..a1116ea
--- /dev/null
@@ -0,0 +1 @@
+@FLATPAK_MAJOR_VERSION@.@FLATPAK_MINOR_VERSION@.@FLATPAK_MICRO_VERSION@
diff --git a/doc/xmlto-config.xsl b/doc/xmlto-config.xsl
new file mode 100644 (file)
index 0000000..187925b
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version="1.0">
+  <xsl:param name="html.stylesheet" select="'docbook.css'"/>
+  <xsl:param name="citerefentry.link" select="1"/>
+  <xsl:template name="generate.citerefentry.link"><xsl:text>#</xsl:text><xsl:value-of select="refentrytitle"/></xsl:template>
+  <xsl:param name="chapter.autolabel" select="0"></xsl:param>
+</xsl:stylesheet>
diff --git a/document-portal/Makefile.am.inc b/document-portal/Makefile.am.inc
new file mode 100644 (file)
index 0000000..f011ccd
--- /dev/null
@@ -0,0 +1,43 @@
+libexec_PROGRAMS += \
+       xdg-document-portal \
+       $(NULL)
+
+xdp_dbus_built_sources = document-portal/xdp-dbus.c document-portal/xdp-dbus.h
+BUILT_SOURCES += $(xdp_dbus_built_sources)
+
+document-portal/xdp-dbus.c: data/org.freedesktop.portal.Documents.xml Makefile
+       mkdir -p $(builddir)/document-portal
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.portal.      \
+               --c-namespace XdpDbus                           \
+               --generate-c-code $(builddir)/document-portal/xdp-dbus  \
+                --annotate "org.freedesktop.portal.Documents.Add()" org.gtk.GDBus.C.UnixFD "yes" \
+                --annotate "org.freedesktop.portal.Documents.AddFull()" org.gtk.GDBus.C.UnixFD "yes" \
+               $(srcdir)/data/org.freedesktop.portal.Documents.xml     \
+               $(NULL)
+
+document-portal/%-dbus.h: document-portal/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+service_in_files += document-portal/xdg-document-portal.service.in
+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             \
+       document-portal/xdp-util.h              \
+       document-portal/xdp-util.c              \
+       document-portal/xdp-fuse.h              \
+       document-portal/xdp-fuse.c              \
+       $(NULL)
+
+xdg_document_portal_LDADD = $(AM_LDADD) $(BASE_LIBS) $(FUSE_LIBS) libflatpak-common.la
+xdg_document_portal_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(FUSE_CFLAGS) -I$(srcdir)/document-portal -I$(builddir)/document-portal -I$(srcdir)/permission-store -I$(builddir)/permission-store -DFLATPAK_COMPILATION
diff --git a/document-portal/org.freedesktop.portal.Documents.service.in b/document-portal/org.freedesktop.portal.Documents.service.in
new file mode 100644 (file)
index 0000000..cf0c1ef
--- /dev/null
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.portal.Documents
+Exec=@libexecdir@/xdg-document-portal
+SystemdService=xdg-document-portal.service
diff --git a/document-portal/xdg-document-portal.service.in b/document-portal/xdg-document-portal.service.in
new file mode 100644 (file)
index 0000000..66f9cbd
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=flatpak document portal service
+
+[Service]
+BusName=org.freedesktop.portal.Documents
+ExecStart=@libexecdir@/xdg-document-portal
+Type=dbus
diff --git a/document-portal/xdp-enums.h b/document-portal/xdp-enums.h
new file mode 100644 (file)
index 0000000..f9cd223
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef XDP_ENUMS_H
+#define XDP_ENUMS_H
+
+G_BEGIN_DECLS
+
+typedef enum {
+  XDP_PERMISSION_FLAGS_READ               = (1 << 0),
+  XDP_PERMISSION_FLAGS_WRITE              = (1 << 1),
+  XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS  = (1 << 2),
+  XDP_PERMISSION_FLAGS_DELETE             = (1 << 3),
+
+  XDP_PERMISSION_FLAGS_ALL               = ((1 << 4) - 1)
+} XdpPermissionFlags;
+
+typedef enum {
+  XDP_ADD_FLAGS_REUSE_EXISTING             = (1 << 0),
+  XDP_ADD_FLAGS_PERSISTENT                 = (1 << 1),
+  XDP_ADD_FLAGS_AS_NEEDED_BY_APP           = (1 << 2),
+
+  XDP_ADD_FLAGS_FLAGS_ALL                  = ((1 << 3) - 1)
+} XdpAddFullFlags;
+
+G_END_DECLS
+
+#endif /* XDP_ENUMS_H */
diff --git a/document-portal/xdp-fuse.c b/document-portal/xdp-fuse.c
new file mode 100644 (file)
index 0000000..0d2f413
--- /dev/null
@@ -0,0 +1,2369 @@
+#include "config.h"
+
+#define FUSE_USE_VERSION 26
+
+#include <glib-unix.h>
+
+#include <fuse_lowlevel.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <glib/gprintf.h>
+#include <gio/gio.h>
+#include <pthread.h>
+#include <sys/statfs.h>
+
+#include "flatpak-portal-error.h"
+#include "xdp-fuse.h"
+#include "xdp-util.h"
+#include "flatpak-utils.h"
+
+#define NON_DOC_DIR_PERMS 0500
+#define DOC_DIR_PERMS 0700
+
+/* TODO: What do we put here */
+#define ATTR_CACHE_TIME 60.0
+#define ENTRY_CACHE_TIME 60.0
+
+/* We pretend that the file is hardlinked. This causes most apps to do
+   a truncating overwrite, which suits us better, as we do the atomic
+   rename ourselves anyway. */
+#define DOC_FILE_NLINK 2
+
+typedef enum {
+  XDP_INODE_ROOT,
+  XDP_INODE_BY_APP,
+  XDP_INODE_APP_DIR, /* app id */
+  XDP_INODE_APP_DOC_DIR, /* app_id + doc id */
+  XDP_INODE_DOC_DIR, /* doc id */
+  XDP_INODE_DOC_FILE, /* doc id (NULL if tmp), name (== basename) */
+} XdpInodeType;
+
+typedef struct _XdpInode XdpInode;
+
+struct _XdpInode
+{
+  gint ref_count; /* atomic */
+
+  /* These are all immutable */
+  fuse_ino_t   ino;
+  XdpInodeType type;
+  XdpInode    *parent;
+  char        *app_id;
+  char        *doc_id;
+
+  /* For doc dirs */
+  char *basename;
+  char *dirname;
+  dev_t dir_dev;
+  ino_t dir_ino;
+
+  /* mutable data */
+
+  GList   *children; /* lazily filled, protected by inodes lock */
+  char    *filename; /* variable (for non-dirs), null if deleted,
+                        protected by inodes lock *and* mutex */
+  gboolean is_doc; /* True if this is the document file for this dir */
+
+  /* Used when the file is open, protected by mutex */
+  GMutex   mutex; /* Always lock inodes lock (if needed) before mutex */
+  GList   *open_files;
+  int      dir_fd;
+  int      fd; /* RW fd for tempfiles, RO fd for doc files */
+  char    *backing_filename;
+  char    *trunc_filename;
+  int      trunc_fd;
+  gboolean truncated;
+};
+
+typedef struct _XdpFile XdpFile;
+
+struct _XdpFile
+{
+  XdpInode *inode;
+  int       open_mode;
+};
+
+#define ROOT_INODE 1
+#define BY_APP_INODE 2
+#define BY_APP_NAME "by-app"
+
+static GHashTable *dir_to_inode_nr;
+
+static GHashTable *inodes; /* The in memory XdpInode:s, protected by inodes lock */
+static XdpInode *root_inode;
+static XdpInode *by_app_inode;
+static fuse_ino_t next_inode_nr = 3;
+
+G_LOCK_DEFINE (inodes);
+
+static GThread *fuse_thread = NULL;
+static struct fuse_session *session = NULL;
+static struct fuse_chan *main_ch = NULL;
+static char *mount_path = NULL;
+static pthread_t fuse_pthread = 0;
+
+static int
+reopen_fd (int fd, int flags)
+{
+  g_autofree char *path = g_strdup_printf ("/proc/self/fd/%d", fd);
+
+  return open (path, flags | O_CLOEXEC);
+}
+
+/* Call with inodes lock held */
+static fuse_ino_t
+allocate_inode_unlocked (void)
+{
+  fuse_ino_t next = next_inode_nr++;
+
+  /* Bail out on overflow, to avoid reuse */
+  if (next <= 0)
+    g_assert_not_reached ();
+
+  return next;
+}
+
+static fuse_ino_t
+get_dir_inode_nr_unlocked (const char *app_id, const char *doc_id)
+{
+  gpointer res;
+  fuse_ino_t allocated;
+  g_autofree char *dir = NULL;
+
+  if (app_id == NULL)
+    {
+      dir = g_strdup (doc_id);
+    }
+  else
+    {
+      if (doc_id == NULL)
+        dir = g_strconcat (app_id, "/", NULL);
+      else
+        dir = g_build_filename (app_id, doc_id, NULL);
+    }
+
+  res = g_hash_table_lookup (dir_to_inode_nr, dir);
+  if (res != NULL)
+    return (fuse_ino_t) (gsize) res;
+
+  allocated = allocate_inode_unlocked ();
+  g_hash_table_insert (dir_to_inode_nr, g_strdup (dir), (gpointer) allocated);
+  return allocated;
+}
+
+static fuse_ino_t
+get_dir_inode_nr (const char *app_id, const char *doc_id)
+{
+  AUTOLOCK (inodes);
+  return get_dir_inode_nr_unlocked (app_id, doc_id);
+}
+
+static void
+allocate_app_dir_inode_nr (char **app_ids)
+{
+  int i;
+
+  AUTOLOCK (inodes);
+  for (i = 0; app_ids[i] != NULL; i++)
+    get_dir_inode_nr_unlocked (app_ids[i], NULL);
+}
+
+static char **
+get_allocated_app_dirs (void)
+{
+  GHashTableIter iter;
+  gpointer key, value;
+  GPtrArray *array = g_ptr_array_new ();
+
+  AUTOLOCK (inodes);
+  g_hash_table_iter_init (&iter, dir_to_inode_nr);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *name = key;
+
+      if (g_str_has_suffix (name, "/"))
+        {
+          char *app = strndup (name, strlen (name) - 1);
+          g_ptr_array_add (array, app);
+        }
+    }
+  g_ptr_array_add (array, NULL);
+  return (char **) g_ptr_array_free (array, FALSE);
+}
+
+static void xdp_inode_unref_internal (XdpInode *inode,
+                                      gboolean  locked);
+static void xdp_inode_unref (XdpInode *inode);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdpInode, xdp_inode_unref)
+
+static void
+xdp_inode_destroy (XdpInode *inode, gboolean locked)
+{
+  g_assert (inode->dir_fd == -1);
+  g_assert (inode->fd == -1);
+  g_assert (inode->trunc_fd == -1);
+  g_assert (inode->trunc_filename == NULL);
+  g_assert (inode->children == NULL);
+  xdp_inode_unref_internal (inode->parent, locked);
+  g_free (inode->backing_filename);
+  g_free (inode->filename);
+  g_free (inode->dirname);
+  g_free (inode->app_id);
+  g_free (inode->doc_id);
+  g_free (inode);
+}
+
+static XdpInode *
+xdp_inode_ref (XdpInode *inode)
+{
+  if (inode)
+    g_atomic_int_inc (&inode->ref_count);
+  return inode;
+}
+
+static void
+xdp_inode_unref_internal (XdpInode *inode, gboolean locked)
+{
+  gint old_ref;
+
+  if (inode == NULL)
+    return;
+
+  /* here we want to atomically do: if (ref_count>1) { ref_count--; return; } */
+retry_atomic_decrement1:
+  old_ref = g_atomic_int_get (&inode->ref_count);
+  if (old_ref > 1)
+    {
+      if (!g_atomic_int_compare_and_exchange ((int *) &inode->ref_count, old_ref, old_ref - 1))
+        goto retry_atomic_decrement1;
+    }
+  else
+    {
+      if (old_ref <= 0)
+        {
+          g_warning ("Can't unref dead inode");
+          return;
+        }
+      /* Protect against revival from xdp_inode_lookup() */
+      if (!locked)
+        G_LOCK (inodes);
+      if (!g_atomic_int_compare_and_exchange ((int *) &inode->ref_count, old_ref, old_ref - 1))
+        {
+          if (!locked)
+            G_UNLOCK (inodes);
+          goto retry_atomic_decrement1;
+        }
+
+      g_hash_table_remove (inodes, (gpointer) inode->ino);
+      if (inode->parent)
+        inode->parent->children = g_list_remove (inode->parent->children, inode);
+
+      if (!locked)
+        G_UNLOCK (inodes);
+
+      xdp_inode_destroy (inode, locked);
+    }
+}
+
+static void
+xdp_inode_unref (XdpInode *inode)
+{
+  return xdp_inode_unref_internal (inode, FALSE);
+}
+
+static XdpInode *
+xdp_inode_new_unlocked (fuse_ino_t   ino,
+                        XdpInodeType type,
+                        XdpInode    *parent,
+                        const char  *filename,
+                        const char  *app_id,
+                        const char  *doc_id)
+{
+  XdpInode *inode;
+
+  inode = g_new0 (XdpInode, 1);
+  inode->ino = ino;
+  inode->type = type;
+  inode->parent = xdp_inode_ref (parent);
+  inode->filename = g_strdup (filename);
+  inode->app_id = g_strdup (app_id);
+  inode->doc_id = g_strdup (doc_id);
+  inode->ref_count = 1;
+  inode->dir_fd = -1;
+  inode->fd = -1;
+  inode->trunc_fd = -1;
+
+  if (parent)
+    parent->children = g_list_prepend (parent->children, inode);
+  g_hash_table_insert (inodes, (gpointer) ino, inode);
+
+  return inode;
+}
+
+static XdpInode *
+xdp_inode_new (fuse_ino_t   ino,
+               XdpInodeType type,
+               XdpInode    *parent,
+               const char  *filename,
+               const char  *app_id,
+               const char  *doc_id)
+{
+  AUTOLOCK (inodes);
+  return xdp_inode_new_unlocked (ino, type, parent, filename, app_id, doc_id);
+}
+
+static XdpInode *
+xdp_inode_lookup_unlocked (fuse_ino_t inode_nr)
+{
+  XdpInode *inode;
+
+  inode = g_hash_table_lookup (inodes, (gpointer) inode_nr);
+  if (inode != NULL)
+    return xdp_inode_ref (inode);
+  return NULL;
+}
+
+static GList *
+xdp_inode_list_children (XdpInode *inode)
+{
+  GList *list = NULL, *l;
+
+  AUTOLOCK (inodes);
+  for (l = inode->children; l != NULL; l = l->next)
+    {
+      XdpInode *child = l->data;
+
+      list = g_list_prepend (list, xdp_inode_ref (child));
+    }
+
+  return g_list_reverse (list);
+}
+
+static XdpInode *
+xdp_inode_lookup_child_unlocked (XdpInode *inode, const char *filename)
+{
+  GList *l;
+
+  for (l = inode->children; l != NULL; l = l->next)
+    {
+      XdpInode *child = l->data;
+      if (child->filename != NULL && strcmp (child->filename, filename) == 0)
+        return xdp_inode_ref (child);
+    }
+
+  return NULL;
+}
+
+static XdpInode *
+xdp_inode_lookup_child (XdpInode *inode, const char *filename)
+{
+  AUTOLOCK (inodes);
+  return xdp_inode_lookup_child_unlocked (inode, filename);
+}
+
+static int
+xdp_inode_open_dir_fd (XdpInode *dir)
+{
+  struct stat st_buf;
+  glnx_autofd int fd = -1;
+
+  g_assert (dir->dirname != NULL);
+
+  fd = open (dir->dirname, O_CLOEXEC | O_PATH | O_DIRECTORY);
+  if (fd == -1)
+    return -1;
+
+  if (fstat (fd, &st_buf) < 0)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  if (st_buf.st_ino != dir->dir_ino ||
+      st_buf.st_dev != dir->dir_dev)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  return glnx_steal_fd (&fd);
+}
+
+static void
+xdp_inode_unlink_backing_files (XdpInode *child_inode, int dir_fd)
+{
+  if (dir_fd == -1)
+    {
+      g_debug ("Can't unlink child inode due to no dir_fd");
+      return;
+    }
+
+  if (child_inode->is_doc)
+    {
+      g_debug ("unlinking doc file %s", child_inode->filename);
+      unlinkat (dir_fd, child_inode->filename, 0);
+      if (child_inode->trunc_filename != NULL)
+        {
+          g_debug ("unlinking doc trunc_file %s", child_inode->trunc_filename);
+          unlinkat (dir_fd, child_inode->trunc_filename, 0);
+        }
+    }
+  else
+    {
+      g_debug ("unlinking tmp_file %s", child_inode->backing_filename);
+      unlinkat (dir_fd, child_inode->backing_filename, 0);
+    }
+}
+
+static void
+xdp_inode_do_unlink (XdpInode *child_inode, int dir_fd, gboolean unlink_backing)
+{
+  if (unlink_backing)
+    xdp_inode_unlink_backing_files (child_inode, dir_fd);
+
+  /* Zero out filename to mark it deleted */
+  g_free (child_inode->filename);
+  child_inode->filename = NULL;
+
+  /* Drop keep-alive-until-unlink ref */
+  if (!child_inode->is_doc)
+    xdp_inode_unref (child_inode);
+}
+
+static XdpInode *
+xdp_inode_unlink_child (XdpInode *dir, const char *filename)
+{
+  XdpInode *child_inode;
+  glnx_autofd int dir_fd = -1;
+
+  AUTOLOCK (inodes);
+  child_inode = xdp_inode_lookup_child_unlocked (dir, filename);
+  if (child_inode == NULL)
+    return NULL;
+
+  g_assert (child_inode->type == XDP_INODE_DOC_FILE);
+  g_assert (child_inode->filename != NULL);
+
+  /* Here we take *both* the inodes lock and the mutex.
+     The inodes lock is to make this safe against concurrent lookups,
+     but the mutex is to make it safe to access inode->filename inside
+     a mutex-only lock */
+  g_mutex_lock (&child_inode->mutex);
+
+  dir_fd = xdp_inode_open_dir_fd (dir);
+
+  xdp_inode_do_unlink (child_inode, dir_fd, TRUE);
+
+  g_mutex_unlock (&child_inode->mutex);
+
+  return child_inode;
+}
+
+/* Sets errno */
+static int
+xdp_inode_rename_child (XdpInode   *dir,
+                        const char *src_filename,
+                        const char *dst_filename)
+{
+  g_autoptr(XdpInode) src_inode = NULL;
+  g_autoptr(XdpInode) dst_inode = NULL;
+  glnx_autofd int dir_fd = -1;
+  int res;
+
+  AUTOLOCK (inodes);
+  src_inode = xdp_inode_lookup_child_unlocked (dir, src_filename);
+  if (src_inode == NULL)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  g_assert (src_inode->type == XDP_INODE_DOC_FILE);
+  g_assert (src_inode->filename != NULL);
+
+  dst_inode = xdp_inode_lookup_child_unlocked (dir, dst_filename);
+  if (dst_inode)
+    {
+      g_assert (dst_inode->type == XDP_INODE_DOC_FILE);
+      g_assert (dst_inode->filename != NULL);
+    }
+
+  /* Here we take *both* the inodes lock and the mutex.
+     The inodes lock is to make this safe against concurrent lookups,
+     but the mutex is to make it safe to access inode->filename inside
+     a mutex-only lock */
+  g_mutex_lock (&src_inode->mutex);
+  if (dst_inode)
+    g_mutex_lock (&dst_inode->mutex);
+
+  dir_fd = xdp_inode_open_dir_fd (dir);
+  res = 0;
+
+  if (src_inode->is_doc)
+    {
+      /* doc -> tmp */
+
+      /* We don't want to allow renaming an exiting doc file, because
+         doing so would make a tmpfile of the real doc-file which some
+         host-side app may have open. You have to make a copy and
+         remove instead. */
+      errno = EACCES;
+      res = -1;
+    }
+  else if (strcmp (dst_filename, dir->basename) != 0)
+    {
+      /* tmp -> tmp */
+
+      if (dst_inode)
+        xdp_inode_do_unlink (dst_inode, dir_fd, TRUE);
+
+      g_free (src_inode->filename);
+      src_inode->filename = g_strdup (dst_filename);
+    }
+  else
+    {
+      /* tmp -> doc */
+
+      g_debug ("atomic renaming %s to %s", src_inode->backing_filename, dst_filename);
+      res = renameat (dir_fd, src_inode->backing_filename,
+                      dir_fd, dst_filename);
+      if (res == 0)
+        {
+          if (dst_inode != NULL)
+            {
+              /* Unlink, but don't remove backing files, which are now the new one */
+              xdp_inode_do_unlink (dst_inode, dir_fd, FALSE);
+
+              /* However, unlink trunc_file if its there */
+              if (dst_inode->trunc_filename)
+                unlinkat (dir_fd, dst_inode->trunc_filename, 0);
+            }
+
+          src_inode->is_doc = TRUE;
+          g_free (src_inode->filename);
+          src_inode->filename = g_strdup (dst_filename);
+          g_free (src_inode->backing_filename);
+          src_inode->backing_filename = g_strdup (dst_filename);
+
+          /* Convert ->fd to read-only */
+          if (src_inode->fd != -1)
+            {
+              int new_fd = reopen_fd (src_inode->fd, O_RDONLY);
+              close (src_inode->fd);
+              src_inode->fd = new_fd;
+            }
+
+          /* This neuters any outstanding write files, since we have no trunc_fd at this point.
+             However, that is not really a problem, we would not support them well anyway as
+             a newly opened trunc file would have to have a truncate operation initially for
+             it to work anyway */
+        }
+    }
+
+  g_mutex_unlock (&src_inode->mutex);
+  if (dst_inode)
+    g_mutex_unlock (&dst_inode->mutex);
+
+  return res;
+}
+
+/* NULL if removed */
+static char *
+xdp_inode_get_filename (XdpInode *inode)
+{
+  AUTOLOCK (inodes);
+  return g_strdup (inode->filename);
+}
+
+static XdpInode *
+xdp_inode_ensure_document_file (XdpInode *dir)
+{
+  XdpInode *inode;
+
+  g_assert (dir->type == XDP_INODE_APP_DOC_DIR || dir->type == XDP_INODE_DOC_DIR);
+
+  AUTOLOCK (inodes);
+
+  inode = xdp_inode_lookup_child_unlocked (dir, dir->basename);
+  if (inode == NULL)
+    {
+      inode = xdp_inode_new_unlocked (allocate_inode_unlocked (),
+                                      XDP_INODE_DOC_FILE,
+                                      dir,
+                                      dir->basename,
+                                      dir->app_id,
+                                      dir->doc_id);
+      inode->backing_filename = g_strdup (dir->basename);
+      inode->is_doc = TRUE;
+    }
+
+  return inode;
+}
+
+static char *
+create_tmp_for_doc (XdpInode *dir, int dir_fd, int flags, mode_t mode, int *fd_out)
+{
+  g_autofree char *template = g_strconcat (".xdp_", dir->basename, ".XXXXXX", NULL);
+  int fd;
+
+  fd = flatpak_mkstempat (dir_fd, template, flags | O_CLOEXEC, mode);
+  if (fd == -1)
+    return NULL;
+
+  g_debug ("Created temp file %s", template);
+  *fd_out = fd;
+  return g_steal_pointer (&template);
+}
+
+/* sets errno */
+static XdpInode *
+xdp_inode_create_file (XdpInode   *dir,
+                       const char *filename,
+                       mode_t      mode,
+                       gboolean    truncate,
+                       gboolean    exclusive)
+{
+  XdpInode *inode;
+  g_autofree char *backing_filename = NULL;
+  g_autofree char *trunc_filename = NULL;
+  gboolean is_doc;
+  glnx_autofd int dir_fd = -1;
+  glnx_autofd int fd = -1;
+  glnx_autofd int trunc_fd = -1;
+
+  g_assert (dir->type == XDP_INODE_APP_DOC_DIR || dir->type == XDP_INODE_DOC_DIR);
+
+  AUTOLOCK (inodes);
+
+  inode = xdp_inode_lookup_child_unlocked (dir, filename);
+  if (inode != NULL)
+    {
+      if (exclusive)
+        {
+          xdp_inode_unref (inode);
+          errno = EEXIST;
+          return NULL;
+        }
+
+      if (truncate)
+        {
+          /* TODO: Handle extra truncate for existing file */
+          errno = ENOSYS;
+          return NULL;
+        }
+
+      return inode;
+    }
+
+  dir_fd = xdp_inode_open_dir_fd (dir);
+  if (dir_fd == -1)
+    return NULL;
+
+  is_doc = strcmp (dir->basename, filename) == 0;
+
+  if (is_doc)
+    {
+      backing_filename = g_strdup (filename);
+      int flags = O_CREAT | O_RDONLY | O_NOFOLLOW | O_CLOEXEC;
+
+      if (exclusive)
+        flags |= O_EXCL;
+
+      g_debug ("Creating doc file %s", dir->basename);
+      fd = openat (dir_fd, dir->basename, flags, mode & 0777);
+      if (fd < 0)
+        return NULL;
+
+      trunc_filename = create_tmp_for_doc (dir, dir_fd, O_RDWR, mode & 0777, &trunc_fd);
+      if (trunc_filename == NULL)
+        return NULL;
+    }
+  else
+    {
+      backing_filename = create_tmp_for_doc (dir, dir_fd, O_RDWR, mode & 0777, &fd);
+      if (backing_filename == NULL)
+        return NULL;
+    }
+
+  inode = xdp_inode_new_unlocked (allocate_inode_unlocked (),
+                                  XDP_INODE_DOC_FILE,
+                                  dir,
+                                  filename,
+                                  dir->app_id,
+                                  dir->doc_id);
+  inode->backing_filename = g_steal_pointer (&backing_filename);
+  inode->trunc_filename = g_steal_pointer (&trunc_filename);
+  inode->is_doc = is_doc;
+  inode->dir_fd = glnx_steal_fd (&dir_fd);
+  inode->fd = glnx_steal_fd (&fd);
+  inode->trunc_fd = glnx_steal_fd (&trunc_fd);
+  if (inode->trunc_fd != -1 && (truncate || exclusive))
+    {
+      inode->truncated = TRUE;
+      g_free (inode->backing_filename);
+      inode->backing_filename = g_strdup (inode->trunc_filename);
+    }
+
+  /* We add an extra ref for tmp files to keep them alive until unlink */
+  if (!is_doc)
+    xdp_inode_ref (inode);
+
+  return inode;
+}
+
+static XdpInode *
+xdp_inode_lookup (fuse_ino_t inode_nr)
+{
+  AUTOLOCK (inodes);
+  return xdp_inode_lookup_unlocked (inode_nr);
+}
+
+static XdpInode *
+xdp_inode_get_dir_unlocked (const char *app_id, const char *doc_id, FlatpakDbEntry *entry)
+{
+  fuse_ino_t ino;
+  XdpInode *inode;
+  XdpInode *parent = NULL;
+  XdpInodeType type;
+  const char *filename;
+
+  ino = get_dir_inode_nr_unlocked (app_id, doc_id);
+
+  inode = xdp_inode_lookup_unlocked (ino);
+  if (inode)
+    return inode;
+
+  if (app_id == NULL)
+    {
+      g_assert (doc_id != NULL);
+      parent = xdp_inode_ref (root_inode);
+      type = XDP_INODE_DOC_DIR;
+      filename = doc_id;
+    }
+  else
+    {
+      if  (doc_id == NULL)
+        {
+          parent = xdp_inode_ref (by_app_inode);
+          filename = app_id;
+          type = XDP_INODE_APP_DIR;
+        }
+      else
+        {
+          parent = xdp_inode_get_dir_unlocked (app_id, NULL, NULL);
+          filename = doc_id;
+          type = XDP_INODE_APP_DOC_DIR;
+        }
+    }
+
+  inode = xdp_inode_new_unlocked (ino, type, parent, filename, app_id, doc_id);
+  xdp_inode_unref_internal (parent, TRUE);
+
+  if (entry)
+    {
+      inode->basename = xdp_entry_dup_basename (entry);
+      inode->dirname = xdp_entry_dup_dirname (entry);
+      inode->dir_ino = xdp_entry_get_inode (entry);
+      inode->dir_dev = xdp_entry_get_device (entry);
+    }
+
+  return inode;
+}
+
+static XdpInode *
+xdp_inode_get_dir (const char *app_id, const char *doc_id, FlatpakDbEntry *entry)
+{
+  AUTOLOCK (inodes);
+  return xdp_inode_get_dir_unlocked (app_id, doc_id, entry);
+}
+
+/********************************************************************** \
+* FUSE Implementation
+\***********************************************************************/
+
+static int
+get_user_perms (const struct stat *stbuf)
+{
+  /* Strip out exec and setuid bits */
+  return stbuf->st_mode & 0666;
+}
+
+static gboolean
+app_can_write_doc (FlatpakDbEntry *entry, const char *app_id)
+{
+  if (app_id == NULL)
+    return TRUE;
+
+  if (xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_WRITE))
+    return TRUE;
+
+  return FALSE;
+}
+
+static gboolean
+app_can_see_doc (FlatpakDbEntry *entry, const char *app_id)
+{
+  if (app_id == NULL)
+    return TRUE;
+
+  if (xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_READ))
+    return TRUE;
+
+  return FALSE;
+}
+
+/* Call with mutex held! */
+static int
+xdp_inode_locked_get_fd (XdpInode *inode)
+{
+  if (inode->truncated)
+    return inode->trunc_fd;
+
+  return inode->fd;
+}
+
+/* Call with mutex held! */
+static int
+xdp_inode_locked_get_write_fd (XdpInode *inode)
+{
+  if (inode->is_doc)
+    {
+      if (!inode->truncated)
+        {
+          errno = ENOSYS;
+          return -1;
+        }
+      return inode->trunc_fd;
+    }
+
+  return inode->fd;
+}
+
+static int
+xdp_inode_stat (XdpInode    *inode,
+                struct stat *stbuf)
+{
+  stbuf->st_ino = inode->ino;
+  stbuf->st_uid = getuid ();
+  stbuf->st_gid = getgid ();
+
+  switch (inode->type)
+    {
+    case XDP_INODE_ROOT:
+    case XDP_INODE_BY_APP:
+    case XDP_INODE_APP_DIR:
+      stbuf->st_mode = S_IFDIR | NON_DOC_DIR_PERMS;
+      stbuf->st_nlink = 2;
+      break;
+
+    case XDP_INODE_DOC_DIR:
+    case XDP_INODE_APP_DOC_DIR:
+      stbuf->st_mode = S_IFDIR | DOC_DIR_PERMS;
+      stbuf->st_nlink = 2;
+      break;
+
+    case XDP_INODE_DOC_FILE:
+      {
+        g_autoptr(FlatpakDbEntry) entry = NULL;
+        struct stat tmp_stbuf;
+        gboolean can_see, can_write;
+        int fd, res, errsv;
+
+        entry = xdp_lookup_doc (inode->doc_id);
+        if (entry == NULL)
+          {
+            errno = ENOENT;
+            return -1;
+          }
+
+        can_see = app_can_see_doc (entry, inode->app_id);
+        can_write = app_can_write_doc (entry, inode->app_id);
+
+        if (!can_see)
+          {
+            errno = ENOENT;
+            return -1;
+          }
+
+        g_mutex_lock (&inode->mutex);
+
+        fd = xdp_inode_locked_get_fd (inode);
+        if (fd != -1)
+          {
+            res = fstat (fd, &tmp_stbuf);
+          }
+        else
+          {
+            glnx_autofd int dir_fd = xdp_inode_open_dir_fd (inode->parent);
+
+            if (dir_fd == -1)
+              res = -1;
+            else
+              res = fstatat (dir_fd, inode->backing_filename,
+                             &tmp_stbuf, AT_SYMLINK_NOFOLLOW);
+          }
+        errsv = errno;
+
+        g_mutex_unlock (&inode->mutex);
+
+        if (res != 0)
+          {
+            errno = errsv;
+            return -1;
+          }
+
+        stbuf->st_mode = S_IFREG | get_user_perms (&tmp_stbuf);
+        if (!can_write)
+          stbuf->st_mode &= ~(0222);
+        stbuf->st_size = tmp_stbuf.st_size;
+        stbuf->st_uid = tmp_stbuf.st_uid;
+        stbuf->st_gid = tmp_stbuf.st_gid;
+        stbuf->st_blksize = tmp_stbuf.st_blksize;
+        stbuf->st_blocks = tmp_stbuf.st_blocks;
+        stbuf->st_atim = tmp_stbuf.st_atim;
+        stbuf->st_mtim = tmp_stbuf.st_mtim;
+        stbuf->st_ctim = tmp_stbuf.st_ctim;
+      }
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+
+  return 0;
+}
+
+static void
+xdp_fuse_lookup (fuse_req_t  req,
+                 fuse_ino_t  parent,
+                 const char *name)
+{
+  g_autoptr(XdpInode) parent_inode = NULL;
+  struct fuse_entry_param e = {0};
+  g_autoptr(XdpInode) child_inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  g_debug ("xdp_fuse_lookup %lx/%s -> ", parent, name);
+
+  parent_inode = xdp_inode_lookup (parent);
+  if (parent_inode == NULL)
+    {
+      g_debug ("xdp_fuse_lookup <- error parent ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  /* Default */
+  e.attr_timeout = ATTR_CACHE_TIME;
+  e.entry_timeout = ENTRY_CACHE_TIME;
+
+  switch (parent_inode->type)
+    {
+    case XDP_INODE_ROOT:
+      if (strcmp (name, BY_APP_NAME) == 0)
+        {
+          child_inode = xdp_inode_ref (by_app_inode);
+        }
+      else
+        {
+          entry = xdp_lookup_doc (name);
+          if (entry != NULL)
+            child_inode = xdp_inode_get_dir (NULL, name, entry);
+        }
+      break;
+
+    case XDP_INODE_BY_APP:
+      /* This lazily creates the app dir */
+      if (flatpak_is_valid_name (name, NULL))
+        child_inode = xdp_inode_get_dir (name, NULL, NULL);
+      break;
+
+    case XDP_INODE_APP_DIR:
+      entry = xdp_lookup_doc (name);
+      if (entry != NULL &&
+          app_can_see_doc (entry, parent_inode->app_id))
+        child_inode = xdp_inode_get_dir (parent_inode->app_id, name, entry);
+      break;
+
+    case XDP_INODE_APP_DOC_DIR:
+    case XDP_INODE_DOC_DIR:
+      {
+        g_autoptr(XdpInode) doc_inode = NULL;
+        entry = xdp_lookup_doc (parent_inode->doc_id);
+        if (entry == NULL)
+          {
+            g_debug ("xdp_fuse_lookup <- error no parent entry ENOENT");
+            fuse_reply_err (req, ENOENT);
+            return;
+          }
+
+        /* Ensure it is alive at least during lookup_child () */
+        doc_inode = xdp_inode_ensure_document_file (parent_inode);
+
+        child_inode = xdp_inode_lookup_child (parent_inode, name);
+
+        /* We verify in the stat below if the backing file exists */
+
+        /* Files can be changed from outside the fuse fs, so don't cache any data */
+        e.attr_timeout = 0;
+        e.entry_timeout = 0;
+      }
+      break;
+
+    case XDP_INODE_DOC_FILE:
+      fuse_reply_err (req, ENOTDIR);
+      return;
+
+    default:
+      break;
+    }
+
+  if (child_inode == NULL)
+    {
+      g_debug ("xdp_fuse_lookup <- error child ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (xdp_inode_stat (child_inode, &e.attr) != 0)
+    {
+      fuse_reply_err (req, errno);
+      return;
+    }
+
+  e.ino = child_inode->ino;
+
+  g_debug ("xdp_fuse_lookup <- inode %lx", (long) e.ino);
+  xdp_inode_ref (child_inode); /* Ref given to the kernel, returned in xdp_fuse_forget() */
+  fuse_reply_entry (req, &e);
+}
+
+static void
+xdp_fuse_forget (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  g_debug ("xdp_fuse_forget %lx %ld -> ", ino, nlookup);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_warning ("xdp_fuse_forget, unknown inode");
+    }
+  else
+    {
+      while (nlookup > 0)
+        {
+          xdp_inode_unref (inode);
+          nlookup--;
+        }
+    }
+
+  fuse_reply_none (req);
+}
+
+struct dirbuf
+{
+  char  *p;
+  size_t size;
+};
+
+static void
+dirbuf_add (fuse_req_t     req,
+            struct dirbuf *b,
+            const char    *name,
+            fuse_ino_t     ino,
+            mode_t         mode)
+{
+  struct stat stbuf;
+
+  size_t oldsize = b->size;
+
+  b->size += fuse_add_direntry (req, NULL, 0, name, NULL, 0);
+  b->p = (char *) g_realloc (b->p, b->size);
+  memset (&stbuf, 0, sizeof (stbuf));
+  stbuf.st_ino = ino;
+  stbuf.st_mode = mode;
+  fuse_add_direntry (req, b->p + oldsize,
+                     b->size - oldsize,
+                     name, &stbuf,
+                     b->size);
+}
+
+static void
+dirbuf_add_docs (fuse_req_t     req,
+                 struct dirbuf *b,
+                 const char    *app_id)
+{
+  g_auto(GStrv) docs = NULL;
+  fuse_ino_t ino;
+  int i;
+
+  docs = xdp_list_docs ();
+  for (i = 0; docs[i] != NULL; i++)
+    {
+      if (app_id)
+        {
+          g_autoptr(FlatpakDbEntry) entry = xdp_lookup_doc (docs[i]);
+          if (entry == NULL ||
+              !app_can_see_doc (entry, app_id))
+            continue;
+        }
+      ino = get_dir_inode_nr (app_id, docs[i]);
+      dirbuf_add (req, b, docs[i], ino, S_IFDIR);
+    }
+}
+
+static int
+reply_buf_limited (fuse_req_t  req,
+                   const char *buf,
+                   size_t      bufsize,
+                   off_t       off,
+                   size_t      maxsize)
+{
+  if (off < bufsize)
+    return fuse_reply_buf (req, buf + off,
+                           MIN (bufsize - off, maxsize));
+  else
+    return fuse_reply_buf (req, NULL, 0);
+}
+
+static void
+xdp_fuse_readdir (fuse_req_t req, fuse_ino_t ino, size_t size,
+                  off_t off, struct fuse_file_info *fi)
+{
+  struct dirbuf *b = (struct dirbuf *) (gsize) (fi->fh);
+
+  reply_buf_limited (req, b->p, b->size, off, size);
+}
+
+static void
+xdp_fuse_opendir (fuse_req_t             req,
+                  fuse_ino_t             ino,
+                  struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  struct dirbuf b = {0};
+
+  g_debug ("xdp_fuse_opendir %lx", ino);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_opendir <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  switch (inode->type)
+    {
+    case XDP_INODE_ROOT:
+      dirbuf_add (req, &b, ".", ROOT_INODE, S_IFDIR);
+      dirbuf_add (req, &b, "..", ROOT_INODE, S_IFDIR);
+      dirbuf_add (req, &b, BY_APP_NAME, BY_APP_INODE, S_IFDIR);
+      dirbuf_add_docs (req, &b, NULL);
+      break;
+
+    case XDP_INODE_BY_APP:
+      {
+        g_auto(GStrv) db_app_ids = NULL;
+        g_auto(GStrv) app_ids = NULL;
+        int i;
+
+        dirbuf_add (req, &b, ".", BY_APP_INODE, S_IFDIR);
+        dirbuf_add (req, &b, "..", ROOT_INODE, S_IFDIR);
+
+        /* Ensure that all apps from db are allocated */
+        db_app_ids = xdp_list_apps ();
+        allocate_app_dir_inode_nr (db_app_ids);
+
+        /* But return all allocated dirs. We might have app dirs
+           that have no permissions, and are thus not in the db */
+        app_ids = get_allocated_app_dirs ();
+        for (i = 0; app_ids[i] != NULL; i++)
+          dirbuf_add (req, &b, app_ids[i],
+                      get_dir_inode_nr (app_ids[i], NULL), S_IFDIR);
+      }
+      break;
+
+    case XDP_INODE_APP_DIR:
+      dirbuf_add (req, &b, ".", inode->ino, S_IFDIR);
+      dirbuf_add (req, &b, "..", BY_APP_INODE, S_IFDIR);
+      dirbuf_add_docs (req, &b, inode->app_id);
+      break;
+
+    case XDP_INODE_DOC_FILE:
+      fuse_reply_err (req, ENOTDIR);
+      break;
+
+    case XDP_INODE_APP_DOC_DIR:
+    case XDP_INODE_DOC_DIR:
+      {
+        GList *children, *l;
+        g_autoptr(XdpInode) doc_inode = NULL;
+        g_autoptr(FlatpakDbEntry) entry = NULL;
+
+        entry = xdp_lookup_doc (inode->doc_id);
+        if (entry == NULL)
+          {
+            fuse_reply_err (req, ENOENT);
+            break;
+          }
+
+        dirbuf_add (req, &b, ".", inode->ino, S_IFDIR);
+        dirbuf_add (req, &b, "..", inode->parent->ino, S_IFDIR);
+
+        /* Ensure it is alive at least during list_children () */
+        doc_inode = xdp_inode_ensure_document_file (inode);
+
+        children = xdp_inode_list_children (inode);
+
+        for (l = children; l != NULL; l = l->next)
+          {
+            struct stat stbuf;
+            XdpInode *child = l->data;
+            g_autofree char *filename = xdp_inode_get_filename (child);
+            if (filename != NULL && xdp_inode_stat (child, &stbuf) == 0)
+              dirbuf_add (req, &b, filename, child->ino, stbuf.st_mode);
+            xdp_inode_unref (child);
+          }
+        g_list_free (children);
+      }
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+
+  if (b.p != NULL)
+    {
+      fi->fh = (gsize) g_memdup (&b, sizeof (b));
+      if (fuse_reply_open (req, fi) == -ENOENT)
+        {
+          g_free (b.p);
+          g_free ((gpointer) (gsize) (fi->fh));
+        }
+    }
+}
+
+static void
+xdp_fuse_releasedir (fuse_req_t             req,
+                     fuse_ino_t             ino,
+                     struct fuse_file_info *fi)
+{
+  struct dirbuf *b = (struct dirbuf *) (gsize) (fi->fh);
+
+  g_free (b->p);
+  g_free (b);
+  fuse_reply_err (req, 0);
+}
+
+
+
+static void
+xdp_fuse_getattr (fuse_req_t             req,
+                  fuse_ino_t             ino,
+                  struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  struct stat stbuf = { 0 };
+
+  g_debug ("xdp_fuse_getattr %lx (fi=%p)", ino, fi);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_getattr <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (xdp_inode_stat (inode,  &stbuf) != 0)
+    {
+      fuse_reply_err (req, errno);
+      return;
+    }
+
+  fuse_reply_attr (req, &stbuf, ATTR_CACHE_TIME);
+}
+
+static void
+xdp_fuse_fsyncdir (fuse_req_t             req,
+                   fuse_ino_t             ino,
+                   int                    datasync,
+                   struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+
+  g_debug ("xdp_fuse_fsyncdir %lx %p", ino, fi);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_fsyncdir <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (inode->type == XDP_INODE_APP_DOC_DIR ||
+      inode->type == XDP_INODE_DOC_DIR)
+    {
+      g_autoptr(FlatpakDbEntry) entry =  xdp_lookup_doc (inode->doc_id);
+      if (entry != NULL)
+        {
+          g_autofree char *dirname = xdp_entry_dup_dirname (entry);
+          int fd = open (dirname, O_DIRECTORY | O_RDONLY);
+          if (fd >= 0)
+            {
+              if (datasync)
+                fdatasync (fd);
+              else
+                fsync (fd);
+              close (fd);
+            }
+        }
+    }
+
+  fuse_reply_err (req, 0);
+}
+
+static XdpFile *
+xdp_file_new (XdpInode *inode,
+              int       open_mode)
+{
+  XdpFile *file = g_new (XdpFile, 1);
+
+  file->inode = xdp_inode_ref (inode);
+  file->open_mode = open_mode;
+
+  return file;
+}
+
+/* Call with mutex held */
+static void
+xdp_inode_locked_close_unneeded_fds (XdpInode *inode)
+{
+  gboolean has_open_for_write = FALSE;
+  GList *l;
+
+  for (l = inode->open_files; l != NULL; l = l->next)
+    {
+      XdpFile *file = l->data;
+
+      if (file->open_mode != O_RDONLY)
+        {
+          has_open_for_write = TRUE;
+          break;
+        }
+    }
+
+  if (!has_open_for_write)
+    {
+      if (inode->truncated)
+        {
+          if (inode->open_files != NULL && inode->fd != -1)
+            {
+              /* We're not going to close the ->fd, so we repoint it to the trunc_fd, but reopened O_RDONLY */
+              close (inode->fd);
+              inode->fd = reopen_fd (inode->trunc_fd, O_RDONLY);
+            }
+
+          if (inode->filename != NULL)
+            {
+              /* not removed, replace original */
+              fsync (inode->trunc_fd);
+              g_free (inode->backing_filename);
+              inode->backing_filename = g_strdup (inode->filename);
+              g_debug ("moving %s to %s", inode->trunc_filename, inode->backing_filename);
+              if (renameat (inode->dir_fd, inode->trunc_filename,
+                            inode->dir_fd, inode->backing_filename) != 0)
+                g_warning ("Unable to replace truncated document: %s", g_strerror (errno));
+            }
+
+          inode->truncated = FALSE;
+        }
+      else if (inode->trunc_filename != NULL)
+        {
+          unlinkat (inode->dir_fd, inode->trunc_filename, 0);
+          g_debug ("unlinked truc_filename %s", inode->trunc_filename);
+        }
+
+      if (inode->trunc_fd != -1)
+        {
+          close (inode->trunc_fd);
+          inode->trunc_fd = -1;
+          g_free (inode->trunc_filename);
+          inode->trunc_filename = NULL;
+        }
+    }
+
+  if (inode->open_files == NULL)
+    {
+      if (inode->fd != -1)
+        {
+          close (inode->fd);
+          inode->fd = -1;
+        }
+
+      if (inode->dir_fd != -1)
+        {
+          close (inode->dir_fd);
+          inode->dir_fd = -1;
+        }
+    }
+}
+
+static void
+xdp_file_free (XdpFile *file)
+{
+  XdpInode *inode = file->inode;
+
+  g_mutex_lock (&inode->mutex);
+  inode->open_files = g_list_remove (inode->open_files, file);
+
+  xdp_inode_locked_close_unneeded_fds (inode);
+
+  g_mutex_unlock (&inode->mutex);
+  xdp_inode_unref (inode);
+  g_free (file);
+}
+
+/* sets errno */
+static int
+xdp_inode_locked_ensure_fd_open (XdpInode       *inode,
+                                 FlatpakDbEntry *entry,
+                                 gboolean        for_write)
+{
+  /* Ensure all fds are open */
+  if (inode->dir_fd == -1)
+    {
+      inode->dir_fd = xdp_inode_open_dir_fd (inode->parent);
+      if (inode->dir_fd == -1)
+        return -1;
+    }
+
+  if (for_write)
+    {
+      if (faccessat (inode->dir_fd, inode->backing_filename, W_OK, 0) != 0)
+        return -1;
+    }
+
+  if (inode->fd == -1)
+    {
+      int mode = O_NOFOLLOW | O_CLOEXEC;
+
+      if (inode->is_doc)
+        mode |= O_RDONLY;
+      else
+        mode |= O_RDWR;
+
+      inode->fd = openat (inode->dir_fd, inode->backing_filename, mode);
+      if (inode->fd < 0)
+        return -1;
+    }
+
+  if (inode->is_doc && for_write && inode->trunc_fd == -1)
+    {
+      struct stat st_buf;
+      mode_t mode = 0600;
+
+      if (fstat (inode->fd, &st_buf) == 0)
+        mode = get_user_perms (&st_buf);
+
+      g_assert (inode->trunc_filename == NULL);
+      inode->trunc_filename = create_tmp_for_doc (inode->parent, inode->dir_fd, O_RDWR, mode,
+                                                  &inode->trunc_fd);
+      if (inode->trunc_filename == NULL)
+        return -1;
+    }
+
+  return 0;
+}
+
+static void
+xdp_fuse_open (fuse_req_t             req,
+               fuse_ino_t             ino,
+               struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  gboolean can_write;
+  int open_mode;
+  XdpFile *file = NULL;
+  int errsv;
+
+  g_debug ("xdp_fuse_open %lx flags %o", ino, fi->flags);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_open <- no inode error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (inode->type != XDP_INODE_DOC_FILE)
+    {
+      g_debug ("xdp_fuse_open <- error EISDIR");
+      fuse_reply_err (req, EISDIR);
+      return;
+    }
+
+  entry = xdp_lookup_doc (inode->doc_id);
+  if (entry == NULL ||
+      !app_can_see_doc (entry, inode->app_id))
+    {
+      g_debug ("xdp_fuse_open <- no entry error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  can_write = app_can_write_doc (entry, inode->app_id);
+
+  open_mode = fi->flags & 3;
+
+  if (open_mode != O_RDONLY && !can_write)
+    {
+      g_debug ("xdp_fuse_open <- no write EACCES");
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  g_mutex_lock (&inode->mutex);
+
+  if (xdp_inode_locked_ensure_fd_open (inode, entry,
+                                       open_mode != O_RDONLY) == 0)
+    {
+      file = xdp_file_new (inode, open_mode);
+      inode->open_files = g_list_prepend (inode->open_files, file);
+      errsv = 0;
+    }
+  else
+    {
+      errsv = errno;
+      xdp_inode_locked_close_unneeded_fds (inode);
+    }
+
+  g_mutex_unlock (&inode->mutex);
+
+  if (file != NULL)
+    {
+      fi->fh = (gsize) file;
+      if (fuse_reply_open (req, fi))
+        xdp_file_free (file);
+    }
+  else
+    {
+      fuse_reply_err (req, errsv);
+    }
+}
+
+
+static void
+xdp_fuse_create (fuse_req_t             req,
+                 fuse_ino_t             parent,
+                 const char            *filename,
+                 mode_t                 mode,
+                 struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) parent_inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  struct fuse_entry_param e = {0};
+  gboolean can_see, can_write;
+  int open_mode;
+  XdpFile *file = NULL;
+  XdpInode *inode;
+  int errsv;
+
+  g_debug ("xdp_fuse_create %lx/%s, flags %o", parent, filename, fi->flags);
+
+  parent_inode = xdp_inode_lookup (parent);
+  if (parent_inode == NULL)
+    {
+      g_debug ("xdp_fuse_create <- error parent ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (parent_inode->type == XDP_INODE_DOC_FILE)
+    {
+      g_debug ("xdp_fuse_create <- error parent ENOTDIR");
+      fuse_reply_err (req, ENOTDIR);
+      return;
+    }
+
+  if (parent_inode->type != XDP_INODE_APP_DOC_DIR &&
+      parent_inode->type != XDP_INODE_DOC_DIR)
+    {
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  entry = xdp_lookup_doc (parent_inode->doc_id);
+  if (entry == NULL)
+    {
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  can_see = app_can_see_doc (entry, parent_inode->app_id);
+  if (!can_see)
+    {
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  can_write = app_can_write_doc (entry, parent_inode->app_id);
+  if (!can_write)
+    {
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  inode = xdp_inode_create_file (parent_inode, filename,
+                                 mode,
+                                 (fi->flags & O_TRUNC) != 0,
+                                 (fi->flags & O_EXCL) != 0);
+  if (inode == NULL)
+    {
+      fuse_reply_err (req, errno);
+      return;
+    }
+
+  g_mutex_lock (&inode->mutex);
+
+  open_mode = fi->flags & 3;
+
+  if (xdp_inode_locked_ensure_fd_open (inode, entry,
+                                       open_mode != O_RDONLY) == 0)
+    {
+      file = xdp_file_new (inode, open_mode);
+      inode->open_files = g_list_prepend (inode->open_files, file);
+      errsv = 0;
+    }
+  else
+    {
+      errsv = errno;
+      xdp_inode_locked_close_unneeded_fds (inode);
+    }
+
+  g_mutex_unlock (&inode->mutex);
+
+  if (file != NULL)
+    {
+      if (xdp_inode_stat (inode, &e.attr) != 0)
+        {
+          xdp_file_free (file);
+          fuse_reply_err (req, errno);
+          return;
+        }
+
+      e.ino = inode->ino;
+      if (inode->is_doc)
+        {
+          e.attr_timeout = 0;
+          e.entry_timeout = 0;
+        }
+      else
+        {
+          e.attr_timeout = ATTR_CACHE_TIME;
+          e.entry_timeout = ENTRY_CACHE_TIME;
+        }
+
+      xdp_inode_ref (inode); /* Ref given to the kernel, returned in xdp_fuse_forget() */
+
+      fi->fh = (gsize) file;
+      if (fuse_reply_create (req, &e, fi))
+        {
+          xdp_file_free (file);
+          xdp_inode_unref (inode);
+        }
+    }
+  else
+    {
+      fuse_reply_err (req, errsv);
+    }
+}
+
+static void
+xdp_fuse_read (fuse_req_t             req,
+               fuse_ino_t             ino,
+               size_t                 size,
+               off_t                  off,
+               struct fuse_file_info *fi)
+{
+  XdpFile *file = (gpointer) (gsize) fi->fh;
+  XdpInode *inode = file->inode;
+  struct fuse_bufvec bufv = FUSE_BUFVEC_INIT (size);
+  int fd;
+
+  g_debug ("xdp_fuse_real %lx %ld %ld", ino, (long) size, (long) off);
+
+  g_mutex_lock (&inode->mutex);
+
+  fd = xdp_inode_locked_get_fd (inode);
+  if (fd == -1)
+    {
+      static char c = 'x';
+      bufv.buf[0].flags = 0;
+      bufv.buf[0].mem = &c;
+      bufv.buf[0].size = 0;
+
+      fuse_reply_data (req, &bufv, FUSE_BUF_NO_SPLICE);
+    }
+  else
+    {
+      bufv.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK;
+      bufv.buf[0].fd = fd;
+      bufv.buf[0].pos = off;
+
+      fuse_reply_data (req, &bufv, FUSE_BUF_SPLICE_MOVE);
+    }
+
+  g_mutex_unlock (&inode->mutex);
+}
+
+static void
+xdp_fuse_release (fuse_req_t             req,
+                  fuse_ino_t             ino,
+                  struct fuse_file_info *fi)
+{
+  XdpFile *file = (gpointer) (gsize) fi->fh;
+
+  g_debug ("xdp_fuse_release %lx (fi=%p)", ino, fi);
+
+  xdp_file_free (file);
+  fuse_reply_err (req, 0);
+}
+
+static int
+truncateat (int dir_fd, const char *filename, int size)
+{
+  int fd;
+  int errsv, res;
+
+  fd = openat (dir_fd, filename, O_RDWR);
+  if (fd == -1)
+    return -1;
+
+  res = ftruncate (fd, size);
+  errsv = errno;
+
+  close (fd);
+
+  errno = errsv;
+  return res;
+}
+
+static void
+xdp_fuse_setattr (fuse_req_t             req,
+                  fuse_ino_t             ino,
+                  struct stat           *attr,
+                  int                    to_set,
+                  struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  double attr_cache_time = ATTR_CACHE_TIME;
+  struct stat newattr = {0};
+  gboolean can_write;
+  int res = 0;
+
+  g_debug ("xdp_fuse_setattr %lx %x %p", ino, to_set, fi);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_setattr <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (inode->type != XDP_INODE_DOC_FILE)
+    {
+      g_debug ("xdp_fuse_setattr <- not file ENOSYS");
+      fuse_reply_err (req, ENOSYS);
+      return;
+    }
+
+  entry = xdp_lookup_doc (inode->doc_id);
+  if (entry == NULL ||
+      !app_can_see_doc (entry, inode->app_id))
+    {
+      g_debug ("xdp_fuse_setattr <- no entry error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  can_write = app_can_write_doc (entry, inode->app_id);
+
+  if (to_set == FUSE_SET_ATTR_SIZE)
+    {
+      g_mutex_lock (&inode->mutex);
+
+      if (!can_write)
+        {
+          res = EACCES;
+        }
+      else if (inode->is_doc)
+        {
+          /* Only allow ftruncate with the file open for write. We could
+           * allow a truncate, but it would have to be implemented as
+           * an atomic-replace-with-empty-file to not affect other apps
+           * having the file open.
+           * Also, only support truncate-to-zero on first truncation, to
+           * avoid having to copy lots of data from the old file to the
+           * trunc_fd.
+           */
+          if (inode->trunc_fd == -1)
+            {
+              res = EACCES;
+            }
+          else if (!inode->truncated && attr->st_size != 0)
+            {
+              res = ENOSYS;
+            }
+          else
+            {
+              if (ftruncate (inode->trunc_fd, attr->st_size) != 0)
+                {
+                  res = errno;
+                }
+              else if (!inode->truncated)
+                {
+                  inode->truncated = TRUE;
+                  g_free (inode->backing_filename);
+                  inode->backing_filename = g_strdup (inode->trunc_filename);
+                }
+            }
+        }
+      else
+        {
+          if (inode->fd)
+            {
+              if (ftruncate (inode->fd, attr->st_size) != 0)
+                res = errno;
+            }
+          else
+            {
+              glnx_autofd int dir_fd = xdp_inode_open_dir_fd (inode->parent);
+              if (dir_fd == -1 ||
+                  truncateat (dir_fd, inode->backing_filename, attr->st_size) != 0)
+                res = errno;
+            }
+        }
+      g_mutex_unlock (&inode->mutex);
+    }
+  else if (to_set == FUSE_SET_ATTR_MODE)
+    {
+      if (!can_write)
+        {
+          res = EACCES;
+        }
+      else
+        {
+          int fd = xdp_inode_locked_get_write_fd (inode);
+          if (fd == -1 ||
+              fchmod (fd, get_user_perms (attr)) != 0)
+            res = errno;
+        }
+    }
+  else
+    {
+      res = ENOSYS;
+    }
+
+  if (res != 0)
+    {
+      fuse_reply_err (req, res);
+    }
+  else
+    {
+      if (xdp_inode_stat (inode, &newattr) != 0)
+        fuse_reply_err (req, errno);
+      else
+        fuse_reply_attr (req, &newattr, attr_cache_time);
+    }
+}
+
+static void
+xdp_fuse_write (fuse_req_t             req,
+                fuse_ino_t             ino,
+                const char            *buf,
+                size_t                 size,
+                off_t                  off,
+                struct fuse_file_info *fi)
+{
+  XdpFile *file = (gpointer) (gsize) fi->fh;
+  XdpInode *inode = file->inode;
+  int fd;
+  int res;
+
+  g_debug ("xdp_fuse_write %lx %ld %ld", ino, (long) size, (long) off);
+
+  g_mutex_lock (&inode->mutex);
+
+  fd = xdp_inode_locked_get_write_fd (inode);
+  if (fd < 0)
+    {
+      fuse_reply_err (req, errno);
+    }
+  else
+    {
+      res = pwrite (fd, buf, size, off);
+      if (res < 0)
+        fuse_reply_err (req, errno);
+      else
+        fuse_reply_write (req, res);
+    }
+
+  g_mutex_unlock (&inode->mutex);
+}
+
+static void
+xdp_fuse_write_buf (fuse_req_t             req,
+                    fuse_ino_t             ino,
+                    struct fuse_bufvec    *bufv,
+                    off_t                  off,
+                    struct fuse_file_info *fi)
+{
+  XdpFile *file = (gpointer) (gsize) fi->fh;
+  struct fuse_bufvec dst = FUSE_BUFVEC_INIT (fuse_buf_size (bufv));
+  XdpInode *inode = file->inode;
+  int fd;
+  int res;
+
+  g_debug ("xdp_fuse_write_buf %lx %ld", ino, (long) off);
+
+  g_mutex_lock (&inode->mutex);
+
+  fd = xdp_inode_locked_get_write_fd (inode);
+  if (fd == -1)
+    {
+      g_debug ("xdp_fuse_write_buf <- error %s", strerror (errno));
+      fuse_reply_err (req, errno);
+    }
+  else
+    {
+      dst.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK;
+      dst.buf[0].fd = fd;
+      dst.buf[0].pos = off;
+
+      res = fuse_buf_copy (&dst, bufv, FUSE_BUF_SPLICE_NONBLOCK);
+      if (res < 0)
+        fuse_reply_err (req, -res);
+      else
+        fuse_reply_write (req, res);
+    }
+
+  g_mutex_unlock (&inode->mutex);
+}
+
+static void
+xdp_fuse_fsync (fuse_req_t             req,
+                fuse_ino_t             ino,
+                int                    datasync,
+                struct fuse_file_info *fi)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  int fd;
+  int res = 0;
+
+  g_debug ("xdp_fuse_fsync %lx", ino);
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_setattr <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (inode->type == XDP_INODE_DOC_FILE)
+    {
+      g_mutex_lock (&inode->mutex);
+
+      fd = xdp_inode_locked_get_write_fd (inode);
+      if (fd != -1 && fsync (fd) != 0)
+        res = errno;
+
+      g_mutex_unlock (&inode->mutex);
+    }
+
+  fuse_reply_err (req, res);
+}
+
+static void
+xdp_fuse_unlink (fuse_req_t  req,
+                 fuse_ino_t  parent,
+                 const char *filename)
+{
+  g_autoptr(XdpInode) parent_inode = NULL;
+  g_autoptr(XdpInode) child_inode = NULL;
+
+  g_debug ("xdp_fuse_unlink %lx/%s", parent, filename);
+
+  parent_inode = xdp_inode_lookup (parent);
+  if (parent_inode == NULL)
+    {
+      g_debug ("xdp_fuse_lookup <- error parent ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (parent_inode->type == XDP_INODE_DOC_FILE)
+    {
+      fuse_reply_err (req, ENOTDIR);
+      return;
+    }
+
+  if (parent_inode->type != XDP_INODE_APP_DOC_DIR &&
+      parent_inode->type != XDP_INODE_DOC_DIR)
+    {
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  child_inode = xdp_inode_unlink_child (parent_inode, filename);
+  if (child_inode == NULL)
+    {
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  fuse_reply_err (req, 0);
+}
+
+static void
+xdp_fuse_rename (fuse_req_t  req,
+                 fuse_ino_t  parent,
+                 const char *name,
+                 fuse_ino_t  newparent,
+                 const char *newname)
+{
+  g_autoptr(XdpInode) parent_inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  gboolean can_see, can_write;
+
+  g_debug ("xdp_fuse_rename %lx/%s -> %lx/%s", parent, name, newparent, newname);
+
+  parent_inode = xdp_inode_lookup (parent);
+  if (parent_inode == NULL)
+    {
+      g_debug ("xdp_fuse_rename <- error parent ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (parent_inode->type == XDP_INODE_DOC_FILE)
+    {
+      fuse_reply_err (req, ENOTDIR);
+      return;
+    }
+
+  if (parent_inode->type != XDP_INODE_APP_DOC_DIR &&
+      parent_inode->type != XDP_INODE_DOC_DIR)
+    {
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  if (newparent != parent)
+    {
+      g_debug ("xdp_fuse_rename <- error different parents EACCES");
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  if (strcmp (name, newname) == 0)
+    {
+      fuse_reply_err (req, 0);
+      return;
+    }
+
+  entry = xdp_lookup_doc (parent_inode->doc_id);
+  if (entry == NULL)
+    {
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  can_see = app_can_see_doc (entry, parent_inode->app_id);
+  can_write = app_can_write_doc (entry, parent_inode->app_id);
+
+  if (!can_see)
+    {
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (!can_write)
+    {
+      fuse_reply_err (req, EACCES);
+      return;
+    }
+
+  if (xdp_inode_rename_child (parent_inode, name, newname) != 0)
+    fuse_reply_err (req, errno);
+  else
+    fuse_reply_err (req, 0);
+}
+
+static void
+xdp_fuse_access (fuse_req_t req, fuse_ino_t ino, int mask)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  g_debug ("xdp_fuse_access %lx %d", ino, mask);
+
+  if (mask != F_OK && (mask & ~(R_OK|W_OK|X_OK)) != 0)
+    {
+      g_debug ("xdp_fuse_access <- error EINVAL");
+      fuse_reply_err (req, EINVAL);
+      return;
+    }
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    {
+      g_debug ("xdp_fuse_access <- error ENOENT");
+      fuse_reply_err (req, ENOENT);
+      return;
+    }
+
+  if (inode->type != XDP_INODE_DOC_FILE)
+    {
+      int dir_mask = 0;
+
+      switch (inode->type)
+        {
+        case XDP_INODE_ROOT:
+        case XDP_INODE_BY_APP:
+        case XDP_INODE_APP_DIR:
+          dir_mask = R_OK | X_OK;
+          break;
+        case XDP_INODE_APP_DOC_DIR:
+        case XDP_INODE_DOC_DIR:
+          dir_mask = R_OK | X_OK | W_OK;
+          break;
+
+        default:
+          g_assert_not_reached ();
+        }
+
+      if (mask != F_OK && ((mask & dir_mask) != mask))
+        {
+          fuse_reply_err (req, EACCES);
+          return;
+        }
+    }
+  else /* A file */
+    {
+      entry = xdp_lookup_doc (inode->doc_id);
+      if (entry == NULL ||
+          !app_can_see_doc (entry, inode->app_id))
+        {
+          g_debug ("xdp_fuse_access <- no entry error ENOENT");
+          fuse_reply_err (req, ENOENT);
+          return;
+        }
+
+      if (mask == F_OK)
+        {
+          if (!app_can_see_doc (entry, inode->app_id))
+            {
+              fuse_reply_err (req, EACCES);
+              return;
+            }
+        }
+      else
+        {
+          if (((mask & R_OK) && !app_can_see_doc (entry, inode->app_id)) ||
+              ((mask & W_OK) && !app_can_write_doc (entry, inode->app_id)) ||
+              (mask & X_OK))
+            {
+              fuse_reply_err (req, EACCES);
+              return;
+            }
+        }
+    }
+
+  fuse_reply_err (req, 0);
+}
+
+static struct fuse_lowlevel_ops xdp_fuse_oper = {
+  .lookup       = xdp_fuse_lookup,
+  .forget       = xdp_fuse_forget,
+  .getattr      = xdp_fuse_getattr,
+  .opendir      = xdp_fuse_opendir,
+  .readdir      = xdp_fuse_readdir,
+  .releasedir   = xdp_fuse_releasedir,
+  .fsyncdir     = xdp_fuse_fsyncdir,
+  .open         = xdp_fuse_open,
+  .read         = xdp_fuse_read,
+  .release      = xdp_fuse_release,
+  .setattr      = xdp_fuse_setattr,
+  .write        = xdp_fuse_write,
+  .write_buf    = xdp_fuse_write_buf,
+  .fsync        = xdp_fuse_fsync,
+  .create       = xdp_fuse_create,
+  .unlink       = xdp_fuse_unlink,
+  .rename       = xdp_fuse_rename,
+  .access       = xdp_fuse_access,
+};
+
+/* Called when a apps permissions to see a document is changed,
+   and with null opt_app_id when the doc is created/removed */
+void
+xdp_fuse_invalidate_doc_app (const char *doc_id,
+                             const char *opt_app_id)
+{
+  g_autoptr(XdpInode) inode = NULL;
+  fuse_ino_t ino;
+  GList *l;
+
+  /* This can happen if fuse is not initialized yet for the very
+     first dbus message that activated the service */
+  if (main_ch == NULL)
+    return;
+
+  g_debug ("invalidate %s/%s", doc_id, opt_app_id ? opt_app_id : "*");
+
+  AUTOLOCK (inodes);
+  ino = get_dir_inode_nr_unlocked (opt_app_id, doc_id);
+  inode = xdp_inode_lookup_unlocked (ino);
+  if (inode != NULL)
+    {
+      fuse_lowlevel_notify_inval_inode (main_ch, inode->ino, 0, 0);
+      fuse_lowlevel_notify_inval_entry (main_ch, inode->parent->ino,
+                                        inode->filename, strlen (inode->filename));
+
+      for (l = inode->children; l != NULL; l = l->next)
+        {
+          XdpInode *child = l->data;
+
+          fuse_lowlevel_notify_inval_inode (main_ch, child->ino, 0, 0);
+          if (child->filename != NULL)
+            fuse_lowlevel_notify_inval_entry (main_ch, inode->ino,
+                                              child->filename, strlen (child->filename));
+        }
+    }
+}
+
+char *
+xdp_fuse_lookup_id_for_inode (ino_t ino)
+{
+  g_autoptr(XdpInode) inode = NULL;
+
+  inode = xdp_inode_lookup (ino);
+  if (inode == NULL)
+    return NULL;
+
+  if (inode->type != XDP_INODE_DOC_FILE ||
+      !inode->is_doc)
+    return NULL;
+
+  return g_strdup (inode->doc_id);
+}
+
+const char *
+xdp_fuse_get_mountpoint (void)
+{
+  if (mount_path == NULL)
+    mount_path = g_build_filename (g_get_user_runtime_dir (), "doc", NULL);
+  return mount_path;
+}
+
+void
+xdp_fuse_exit (void)
+{
+  if (session)
+    fuse_session_exit (session);
+
+  if (fuse_pthread)
+    pthread_kill (fuse_pthread, SIGHUP);
+
+  if (fuse_thread)
+    g_thread_join (fuse_thread);
+}
+
+static gpointer
+xdp_fuse_mainloop (gpointer data)
+{
+  fuse_pthread = pthread_self ();
+
+  fuse_session_loop_mt (session);
+
+  fuse_session_remove_chan (main_ch);
+  fuse_session_destroy (session);
+  fuse_unmount (mount_path, main_ch);
+  return NULL;
+}
+
+gboolean
+xdp_fuse_init (GError **error)
+{
+  char *argv[] = { "xdp-fuse", "-osplice_write,splice_move" };
+  struct fuse_args args = FUSE_ARGS_INIT (G_N_ELEMENTS (argv), argv);
+  struct stat st;
+  struct statfs stfs;
+  const char *path;
+  int statfs_res;
+
+  inodes =
+    g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
+  root_inode = xdp_inode_new (ROOT_INODE, XDP_INODE_ROOT, NULL, "/", NULL, NULL);
+  by_app_inode = xdp_inode_new (BY_APP_INODE, XDP_INODE_BY_APP, root_inode, BY_APP_NAME, NULL, NULL);
+  dir_to_inode_nr =
+    g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+  path = xdp_fuse_get_mountpoint ();
+  if ((stat (path, &st) == -1 && errno == ENOTCONN) ||
+      (((statfs_res = statfs (path, &stfs)) == -1 && errno == ENOTCONN) ||
+       (statfs_res == 0 && stfs.f_type == 0x65735546 /* fuse */)))
+    {
+      int count;
+      char *umount_argv[] = { "fusermount", "-u", "-z", (char *) path, NULL };
+
+      g_spawn_sync (NULL, umount_argv, NULL, G_SPAWN_SEARCH_PATH,
+                    NULL, NULL, NULL, NULL, NULL, NULL);
+
+      g_usleep (10000); /* 10ms */
+      count = 0;
+      while (stat (path, &st) == -1 && count < 10)
+        g_usleep (10000); /* 10ms */
+    }
+
+  if (g_mkdir_with_parents (path, 0700))
+    {
+      g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
+                   "Unable to create dir %s", path);
+      return FALSE;
+    }
+
+  main_ch = fuse_mount (path, &args);
+  if (main_ch == NULL)
+    {
+      g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED, "Can't mount fuse fs");
+      return FALSE;
+    }
+
+  session = fuse_lowlevel_new (&args, &xdp_fuse_oper,
+                               sizeof (xdp_fuse_oper), NULL);
+  if (session == NULL)
+    {
+      g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
+                   "Can't create fuse session");
+      return FALSE;
+    }
+  fuse_session_add_chan (session, main_ch);
+
+  fuse_thread = g_thread_new ("fuse mainloop", xdp_fuse_mainloop, session);
+
+  return TRUE;
+}
diff --git a/document-portal/xdp-fuse.h b/document-portal/xdp-fuse.h
new file mode 100644 (file)
index 0000000..e208b53
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef XDP_FUSE_H
+#define XDP_FUSE_H
+
+#include <glib.h>
+#include "flatpak-db.h"
+
+G_BEGIN_DECLS
+
+char **        xdp_list_apps (void);
+char **        xdp_list_docs (void);
+FlatpakDbEntry *xdp_lookup_doc (const char *doc_id);
+
+gboolean    xdp_fuse_init (GError **error);
+void        xdp_fuse_exit (void);
+const char *xdp_fuse_get_mountpoint (void);
+void        xdp_fuse_invalidate_doc_app (const char *doc_id,
+                                         const char *opt_app_id);
+char      *xdp_fuse_lookup_id_for_inode (ino_t inode);
+
+
+G_END_DECLS
+
+#endif /* XDP_FUSE_H */
diff --git a/document-portal/xdp-main.c b/document-portal/xdp-main.c
new file mode 100644 (file)
index 0000000..03078c9
--- /dev/null
@@ -0,0 +1,1389 @@
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
+#include "xdp-dbus.h"
+#include "xdp-util.h"
+#include "flatpak-db.h"
+#include "flatpak-dbus.h"
+#include "flatpak-utils.h"
+#include "flatpak-dir.h"
+#include "flatpak-run.h"
+#include "flatpak-portal-error.h"
+#include "permission-store/permission-store-dbus.h"
+#include "xdp-fuse.h"
+
+#include <sys/eventfd.h>
+
+#define TABLE_NAME "documents"
+
+typedef struct
+{
+  char                  *doc_id;
+  int                    fd;
+  char                  *owner;
+  guint                  flags;
+
+  GDBusMethodInvocation *finish_invocation;
+} XdpDocUpdate;
+
+
+static GMainLoop *loop = NULL;
+static FlatpakDb *db = NULL;
+static XdgPermissionStore *permission_store;
+static int daemon_event_fd = -1;
+static int final_exit_status = 0;
+static GError *exit_error = NULL;
+static dev_t fuse_dev = 0;
+static GQueue get_mount_point_invocations = G_QUEUE_INIT;
+static XdpDbusDocuments *dbus_api;
+
+G_LOCK_DEFINE (db);
+
+char **
+xdp_list_apps (void)
+{
+  AUTOLOCK (db);
+  return flatpak_db_list_apps (db);
+}
+
+char **
+xdp_list_docs (void)
+{
+  AUTOLOCK (db);
+  return flatpak_db_list_ids (db);
+}
+
+FlatpakDbEntry *
+xdp_lookup_doc (const char *doc_id)
+{
+  AUTOLOCK (db);
+  return flatpak_db_lookup (db, doc_id);
+}
+
+static gboolean
+persist_entry (FlatpakDbEntry *entry)
+{
+  guint32 flags = xdp_entry_get_flags (entry);
+
+  return (flags & XDP_ENTRY_FLAG_TRANSIENT) == 0;
+}
+
+static void
+do_set_permissions (FlatpakDbEntry    *entry,
+                    const char        *doc_id,
+                    const char        *app_id,
+                    XdpPermissionFlags perms)
+{
+  g_autofree const char **perms_s = xdg_unparse_permissions (perms);
+
+  g_autoptr(FlatpakDbEntry) new_entry = NULL;
+
+  g_debug ("set_permissions %s %s %x", doc_id, app_id, perms);
+
+  new_entry = flatpak_db_entry_set_app_permissions (entry, app_id, perms_s);
+  flatpak_db_set_entry (db, doc_id, new_entry);
+
+  if (persist_entry (new_entry))
+    {
+      xdg_permission_store_call_set_permission (permission_store,
+                                                TABLE_NAME,
+                                                FALSE,
+                                                doc_id,
+                                                app_id,
+                                                perms_s,
+                                                NULL,
+                                                NULL, NULL);
+    }
+}
+
+static void
+portal_grant_permissions (GDBusMethodInvocation *invocation,
+                          GVariant              *parameters,
+                          const char            *app_id)
+{
+  g_autoptr(GError) my_error = NULL;
+  const char *target_app_id;
+  const char *id;
+  g_autofree const char **permissions = NULL;
+  XdpPermissionFlags perms;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
+
+  {
+    AUTOLOCK (db);
+
+    entry = flatpak_db_lookup (db, id);
+    if (entry == NULL)
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                               "No such document: %s", id);
+        return;
+      }
+
+    if (!flatpak_is_valid_name (target_app_id, &my_error))
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                               "'%s' is not a valid app name: %s", target_app_id, my_error->message);
+        return;
+      }
+
+    perms = xdp_parse_permissions (permissions);
+
+    /* Must have grant-permissions and all the newly granted permissions */
+    if (!xdp_entry_has_permissions (entry, app_id,
+                                    XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS | perms))
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                               "Not enough permissions");
+        return;
+      }
+
+    do_set_permissions (entry, id, target_app_id,
+                        perms | xdp_entry_get_permissions (entry, target_app_id));
+  }
+
+  /* Invalidate with lock dropped to avoid deadlock */
+  xdp_fuse_invalidate_doc_app (id, target_app_id);
+
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
+}
+
+static void
+portal_revoke_permissions (GDBusMethodInvocation *invocation,
+                           GVariant              *parameters,
+                           const char            *app_id)
+{
+  const char *target_app_id;
+  const char *id;
+  g_autofree const char **permissions = NULL;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  g_autoptr(GError) my_error = NULL;
+  XdpPermissionFlags perms;
+
+  g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
+
+  {
+    AUTOLOCK (db);
+
+    entry = flatpak_db_lookup (db, id);
+    if (entry == NULL)
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                               "No such document: %s", id);
+        return;
+      }
+
+    if (!flatpak_is_valid_name (target_app_id, &my_error))
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                               "'%s' is not a valid app name: %s", target_app_id, my_error->message);
+        return;
+      }
+
+    perms = xdp_parse_permissions (permissions);
+
+    /* Must have grant-permissions, or be itself */
+    if (!xdp_entry_has_permissions (entry, app_id,
+                                    XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS) ||
+        strcmp (app_id, target_app_id) == 0)
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                               "Not enough permissions");
+        return;
+      }
+
+    do_set_permissions (entry, id, target_app_id,
+                        ~perms & xdp_entry_get_permissions (entry, target_app_id));
+  }
+
+  /* Invalidate with lock dropped to avoid deadlock */
+  xdp_fuse_invalidate_doc_app (id, target_app_id);
+
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
+}
+
+static void
+portal_delete (GDBusMethodInvocation *invocation,
+               GVariant              *parameters,
+               const char            *app_id)
+{
+  const char *id;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  g_autofree const char **old_apps = NULL;
+  int i;
+
+  g_variant_get (parameters, "(s)", &id);
+
+  {
+    AUTOLOCK (db);
+
+    entry = flatpak_db_lookup (db, id);
+    if (entry == NULL)
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                               "No such document: %s", id);
+        return;
+      }
+
+    if (!xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_DELETE))
+      {
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                               "Not enough permissions");
+        return;
+      }
+
+    g_debug ("delete %s", id);
+
+    flatpak_db_set_entry (db, id, NULL);
+
+    if (persist_entry (entry))
+      xdg_permission_store_call_delete (permission_store, TABLE_NAME,
+                                        id, NULL, NULL, NULL);
+  }
+
+  /* All i/o is done now, so drop the lock so we can invalidate the fuse caches */
+  old_apps = flatpak_db_entry_list_apps (entry);
+  for (i = 0; old_apps[i] != NULL; i++)
+    xdp_fuse_invalidate_doc_app (id, old_apps[i]);
+  xdp_fuse_invalidate_doc_app (id, NULL);
+
+  /* Now fuse view is up-to-date, so we can return the call */
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
+}
+
+static char *
+do_create_doc (struct stat *parent_st_buf, const char *path, gboolean reuse_existing, gboolean persistent)
+{
+  g_autoptr(GVariant) data = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  g_auto(GStrv) ids = NULL;
+  char *id = NULL;
+  guint32 flags = 0;
+
+  if (!reuse_existing)
+    flags |= XDP_ENTRY_FLAG_UNIQUE;
+  if (!persistent)
+    flags |= XDP_ENTRY_FLAG_TRANSIENT;
+  data =
+    g_variant_ref_sink (g_variant_new ("(^ayttu)",
+                                       path,
+                                       (guint64) parent_st_buf->st_dev,
+                                       (guint64) parent_st_buf->st_ino,
+                                       flags));
+
+  if (reuse_existing)
+    {
+      ids = flatpak_db_list_ids_by_value (db, data);
+
+      if (ids[0] != NULL)
+        return g_strdup (ids[0]);  /* Reuse pre-existing entry with same path */
+    }
+
+  while (TRUE)
+    {
+      g_autoptr(FlatpakDbEntry) existing = NULL;
+
+      g_clear_pointer (&id, g_free);
+      id = xdp_name_from_id ((guint32) g_random_int ());
+      existing = flatpak_db_lookup (db, id);
+      if (existing == NULL)
+        break;
+    }
+
+  g_debug ("create_doc %s", id);
+
+  entry = flatpak_db_entry_new (data);
+  flatpak_db_set_entry (db, id, entry);
+
+  if (persistent)
+    {
+      xdg_permission_store_call_set (permission_store,
+                                     TABLE_NAME,
+                                     TRUE,
+                                     id,
+                                     g_variant_new_array (G_VARIANT_TYPE ("{sas}"), NULL, 0),
+                                     g_variant_new_variant (data),
+                                     NULL, NULL, NULL);
+    }
+
+  return id;
+}
+
+static gboolean
+validate_fd_common (int fd,
+                    struct stat *st_buf,
+                    mode_t st_mode,
+                    char *path_buffer,
+                    GError **error)
+{
+  g_autofree char *proc_path = NULL;
+  ssize_t symlink_size;
+  int fd_flags;
+
+  proc_path = g_strdup_printf ("/proc/self/fd/%d", fd);
+
+  if (fd == -1 ||
+      /* Must be able to get fd flags */
+      (fd_flags = fcntl (fd, F_GETFL)) == -1 ||
+      /* Must be O_PATH */
+      ((fd_flags & O_PATH) != O_PATH) ||
+      /* Must not be O_NOFOLLOW (because we want the target file) */
+      ((fd_flags & O_NOFOLLOW) == O_NOFOLLOW) ||
+      /* Must be able to fstat */
+      fstat (fd, st_buf) < 0 ||
+      /* Must be a regular file or directory (depending on use) */
+      (st_buf->st_mode & S_IFMT) != st_mode ||
+      /* Must be able to read path from /proc/self/fd */
+      /* This is an absolute and (at least at open time) symlink-expanded path */
+      (symlink_size = readlink (proc_path, path_buffer, PATH_MAX)) < 0)
+    {
+      g_set_error (error,
+                   FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                   "Invalid fd passed");
+      return FALSE;
+    }
+
+  path_buffer[symlink_size] = 0;
+  return TRUE;
+}
+
+static gboolean
+validate_parent_dir (const char *path,
+                     struct stat *st_buf,
+                     struct stat *real_parent_st_buf,
+                     GError **error)
+{
+  g_autofree char *dirname = NULL;
+  g_autofree char *name = NULL;
+  glnx_autofd int dir_fd = -1;
+  struct stat real_st_buf;
+
+  /* We open the parent directory and do the stat in that, so that we have
+   * trustworthy parent dev/ino for later verification. Otherwise the caller
+   * could later replace a parent with a symlink and make us read some other file
+   */
+  dirname = g_path_get_dirname (path);
+  name = g_path_get_basename (path);
+  dir_fd = open (dirname, O_CLOEXEC | O_PATH);
+
+  if (dir_fd < 0 ||
+      fstat (dir_fd, real_parent_st_buf) < 0 ||
+      fstatat (dir_fd, name, &real_st_buf, AT_SYMLINK_NOFOLLOW) < 0 ||
+      st_buf->st_dev != real_st_buf.st_dev ||
+      st_buf->st_ino != real_st_buf.st_ino)
+    {
+      /* Don't leak any info about real file path existence, etc */
+      g_set_error (error,
+                   FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                   "Invalid fd passed");
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+validate_fd (int fd,
+             GKeyFile *app_info,
+             struct stat *st_buf,
+             struct stat *real_parent_st_buf,
+             char *path_buffer,
+             GError **error)
+{
+  g_autofree char *app_path = NULL;
+  g_autofree char *runtime_path = NULL;
+
+  if (!validate_fd_common (fd, st_buf, S_IFREG, path_buffer, error))
+    return FALSE;
+
+  /* For apps we translate /app and /usr to the installed locations.
+     Also, we need to rewrite to drop the /newroot prefix added by
+     bubblewrap for other files to work.  See
+     https://github.com/projectatomic/bubblewrap/pull/172
+     for a bit more information on the /newroot issue.
+  */
+  app_path = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE,
+                                    FLATPAK_METADATA_KEY_APP_PATH, NULL);
+  runtime_path = g_key_file_get_string (app_info,
+                                        FLATPAK_METADATA_GROUP_INSTANCE,
+                                        FLATPAK_METADATA_KEY_RUNTIME_PATH,
+                                        NULL);
+  if (app_path != NULL || runtime_path != NULL)
+    {
+      gboolean had_newroot_prefix = g_str_has_prefix (path_buffer, "/newroot/");
+      const char *tmp_path_buf;
+      if (had_newroot_prefix)
+        tmp_path_buf = path_buffer + strlen ("/newroot");
+      else
+        tmp_path_buf = path_buffer;
+      if (app_path != NULL &&
+          g_str_has_prefix (tmp_path_buf, "/app/"))
+        {
+          const char *rel_path = tmp_path_buf + strlen ("/app/");
+          g_autofree char *real_path = g_build_filename (app_path, rel_path, NULL);
+          strncpy (path_buffer, real_path, PATH_MAX);
+        }
+      else if (runtime_path != NULL &&
+               g_str_has_prefix (tmp_path_buf, "/usr/"))
+        {
+          const char *rel_path = tmp_path_buf + strlen ("/usr/");
+          g_autofree char *real_path = g_build_filename (runtime_path, rel_path, NULL);
+          strncpy (path_buffer, real_path, PATH_MAX);
+        }
+      else if (g_str_has_prefix (tmp_path_buf, "/run/host/usr/"))
+        {
+          const char *rel_path = tmp_path_buf + strlen ("/run/host/usr/");
+          g_autofree char *real_path = g_build_filename ("/usr", rel_path, NULL);
+          strncpy (path_buffer, real_path, PATH_MAX);
+        }
+      else if (g_str_has_prefix (tmp_path_buf, "/run/host/etc/"))
+        {
+          const char *rel_path = tmp_path_buf + strlen ("/run/host/etc/");
+          g_autofree char *real_path = g_build_filename ("/etc", rel_path, NULL);
+          strncpy (path_buffer, real_path, PATH_MAX);
+        }
+      else if (had_newroot_prefix)
+        {
+          /* Create a separate copy to avoid memcpy-type issues where
+           * source and destination overlap.
+           */
+          const char *rel_path = strdupa (tmp_path_buf);
+          g_strlcpy (path_buffer, rel_path, PATH_MAX);
+        }
+    }
+
+  if (!validate_parent_dir (path_buffer, st_buf, real_parent_st_buf, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+static char *
+verify_existing_document (struct stat *st_buf, gboolean reuse_existing)
+{
+  g_autoptr(FlatpakDbEntry) old_entry = NULL;
+  g_autofree char *id = NULL;
+
+  g_assert (st_buf->st_dev == fuse_dev);
+
+  /* The passed in fd is on the fuse filesystem itself */
+  id = xdp_fuse_lookup_id_for_inode (st_buf->st_ino);
+  g_debug ("path on fuse, id %s", id);
+  if (id == NULL)
+    return NULL;
+
+  /* Don't lock the db before doing the fuse call above, because it takes takes a lock
+     that can block something calling back, causing a deadlock on the db lock */
+  AUTOLOCK (db);
+
+  /* If the entry doesn't exist anymore, fail.  Also fail if not
+   * reuse_existing, because otherwise the user could use this to
+   * get a copy with permissions and thus escape later permission
+   * revocations
+   */
+  old_entry = flatpak_db_lookup (db, id);
+  if (old_entry == NULL || !reuse_existing)
+    return NULL;
+
+  return g_steal_pointer (&id);
+}
+
+static void
+portal_add (GDBusMethodInvocation *invocation,
+            GVariant              *parameters,
+            const char            *app_id)
+{
+  GDBusMessage *message;
+  GUnixFDList *fd_list;
+  g_autofree char *id = NULL;
+  int fd_id, fd, fds_len;
+  char path_buffer[PATH_MAX + 1];
+  const int *fds;
+  struct stat st_buf, real_parent_st_buf;
+  gboolean reuse_existing, persistent;
+  GError *error = NULL;
+  GKeyFile *app_info = g_object_get_data (G_OBJECT (invocation), "app-info");
+
+  g_variant_get (parameters, "(hbb)", &fd_id, &reuse_existing, &persistent);
+
+  message = g_dbus_method_invocation_get_message (invocation);
+  fd_list = g_dbus_message_get_unix_fd_list (message);
+
+  fd = -1;
+  if (fd_list != NULL)
+    {
+      fds = g_unix_fd_list_peek_fds (fd_list, &fds_len);
+      if (fd_id < fds_len)
+        fd = fds[fd_id];
+    }
+
+  if (!validate_fd (fd, app_info, &st_buf, &real_parent_st_buf, path_buffer, &error))
+    {
+      g_dbus_method_invocation_take_error (invocation, error);
+      return;
+    }
+
+  if (st_buf.st_dev == fuse_dev)
+    {
+      /* The passed in fd is on the fuse filesystem itself */
+      id = verify_existing_document (&st_buf, reuse_existing);
+      if (id == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation,
+                                                 FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                                 "Invalid fd passed");
+          return;
+        }
+    }
+  else
+    {
+      {
+        AUTOLOCK (db);
+
+        id = do_create_doc (&real_parent_st_buf, path_buffer, reuse_existing, persistent);
+
+        if (app_id[0] != '\0')
+          {
+            g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (db, id);
+            XdpPermissionFlags perms =
+              XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS |
+              XDP_PERMISSION_FLAGS_READ |
+              XDP_PERMISSION_FLAGS_WRITE;
+
+            /* If its a unique one its safe for the creator to
+               delete it at will */
+            if (!reuse_existing)
+              perms |= XDP_PERMISSION_FLAGS_DELETE;
+
+            do_set_permissions (entry, id, app_id, perms);
+          }
+      }
+
+      /* Invalidate with lock dropped to avoid deadlock */
+      xdp_fuse_invalidate_doc_app (id, NULL);
+      if (app_id[0] != '\0')
+        xdp_fuse_invalidate_doc_app (id, app_id);
+    }
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(s)", id));
+}
+
+static void
+portal_add_full (GDBusMethodInvocation *invocation,
+                 GVariant              *parameters,
+                 const char            *app_id)
+{
+  GDBusMessage *message;
+  GUnixFDList *fd_list;
+  char *id;
+  int fd_id, fd, fds_len;
+  char path_buffer[PATH_MAX + 1];
+  const int *fds = NULL;
+  struct stat st_buf;
+  gboolean reuse_existing, persistent, as_needed_by_app;
+  GError *error = NULL;
+  guint32 flags = 0;
+  GKeyFile *app_info = g_object_get_data (G_OBJECT (invocation), "app-info");
+  g_autoptr(GVariant) array = NULL;
+  const char *target_app_id;
+  g_autofree const char **permissions = NULL;
+  g_autoptr(GPtrArray) ids = g_ptr_array_new_with_free_func (g_free);
+  g_autoptr(GPtrArray) paths = g_ptr_array_new_with_free_func (g_free);
+  g_autofree struct stat *real_parent_st_bufs = NULL;
+  int i;
+  gsize n_args;
+  XdpPermissionFlags target_perms;
+  GVariantBuilder builder;
+  g_autoptr(FlatpakExports) app_exports = NULL;
+
+  g_variant_get (parameters, "(@ahus^a&s)",
+                 &array, &flags, &target_app_id, &permissions);
+
+  if ((flags & ~XDP_ADD_FLAGS_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                             "Invalid flags");
+      return;
+    }
+
+  reuse_existing = (flags & XDP_ADD_FLAGS_REUSE_EXISTING) != 0;
+  persistent = (flags & XDP_ADD_FLAGS_PERSISTENT) != 0;
+  as_needed_by_app = (flags & XDP_ADD_FLAGS_AS_NEEDED_BY_APP) != 0;
+
+  if (as_needed_by_app && target_app_id[0] != '\0')
+    {
+      g_autoptr(FlatpakContext) app_context = flatpak_context_load_for_app (target_app_id, NULL);
+      if (app_context)
+        app_exports = flatpak_exports_from_context (app_context, target_app_id);
+    }
+
+  target_perms = xdp_parse_permissions (permissions);
+
+  n_args = g_variant_n_children (array);
+  g_ptr_array_set_size (ids, n_args + 1);
+  g_ptr_array_set_size (paths, n_args + 1);
+  real_parent_st_bufs = g_new0 (struct stat, n_args);
+
+  message = g_dbus_method_invocation_get_message (invocation);
+  fd_list = g_dbus_message_get_unix_fd_list (message);
+  if (fd_list != NULL)
+    fds = g_unix_fd_list_peek_fds (fd_list, &fds_len);
+
+  for (i = 0; i < n_args; i++)
+    {
+      g_variant_get_child (array, i, "h", &fd_id);
+
+      fd = -1;
+      if (fds != NULL && fd_id < fds_len)
+        fd = fds[fd_id];
+
+      if (!validate_fd (fd, app_info, &st_buf, &real_parent_st_bufs[i], path_buffer, &error))
+        {
+          g_dbus_method_invocation_take_error (invocation, error);
+          return;
+        }
+
+      g_ptr_array_index(paths,i) = g_strdup (path_buffer);
+
+      if (st_buf.st_dev == fuse_dev)
+        {
+          /* The passed in fd is on the fuse filesystem itself */
+          id = verify_existing_document (&st_buf, reuse_existing);
+          if (id == NULL)
+            {
+              g_dbus_method_invocation_return_error (invocation,
+                                                     FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                                     "Invalid fd passed");
+              return;
+            }
+          g_ptr_array_index(ids,i) = id;
+        }
+    }
+
+  {
+    XdpPermissionFlags caller_perms =
+      XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS |
+      XDP_PERMISSION_FLAGS_READ |
+      XDP_PERMISSION_FLAGS_WRITE;
+
+    /* If its a unique one its safe for the creator to
+       delete it at will */
+    if (!reuse_existing)
+      caller_perms |= XDP_PERMISSION_FLAGS_DELETE;
+
+    AUTOLOCK (db); /* Lock once for all ops */
+
+    for (i = 0; i < n_args; i++)
+      {
+        const char *path = g_ptr_array_index(paths,i);
+        g_assert (path != NULL);
+
+        if (app_exports &&
+            flatpak_exports_path_is_visible (app_exports, path))
+          {
+            g_free (g_ptr_array_index(ids,i));
+            g_ptr_array_index(ids,i) = g_strdup ("");
+            continue;
+          }
+
+        if (g_ptr_array_index(ids,i) == NULL)
+          {
+            id = do_create_doc (&real_parent_st_bufs[i], path, reuse_existing, persistent);
+            g_ptr_array_index(ids,i) = id;
+
+            if (app_id[0] != '\0' && strcmp (app_id, target_app_id) != 0)
+              {
+                g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (db, id);;
+                do_set_permissions (entry, id, app_id, caller_perms);
+              }
+
+            if (target_app_id[0] != '\0' && target_perms != 0)
+              {
+                g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (db, id);
+                do_set_permissions (entry, id, target_app_id, target_perms);
+              }
+          }
+      }
+  }
+
+  /* Invalidate with lock dropped to avoid deadlock */
+  for (i = 0; i < n_args; i++)
+    {
+      id = g_ptr_array_index (ids,i);
+      g_assert (id != NULL);
+
+      if (*id == 0)
+        continue;
+
+      xdp_fuse_invalidate_doc_app (id, NULL);
+      if (app_id[0] != '\0')
+        xdp_fuse_invalidate_doc_app (id, app_id);
+      if (target_app_id[0] != '\0' && target_perms != 0)
+        xdp_fuse_invalidate_doc_app (id, target_app_id);
+    }
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+  g_variant_builder_add (&builder, "{sv}", "mountpoint",
+                         g_variant_new_bytestring (xdp_fuse_get_mountpoint ()));
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(^as@a{sv})",
+                                                        (char **)ids->pdata,
+                                                        g_variant_builder_end (&builder)));
+}
+
+static void
+portal_add_named (GDBusMethodInvocation *invocation,
+                  GVariant              *parameters,
+                  const char            *app_id)
+{
+  GDBusMessage *message;
+  GUnixFDList *fd_list;
+  g_autofree char *id = NULL;
+  int parent_fd_id, parent_fd, fds_len;
+  const int *fds;
+  char parent_path_buffer[PATH_MAX + 1];
+  g_autofree char *path = NULL;
+  struct stat parent_st_buf;
+  const char *filename;
+  gboolean reuse_existing, persistent;
+  g_autoptr(GError) error = NULL;
+
+  g_autoptr(GVariant) filename_v = NULL;
+
+  g_variant_get (parameters, "(h@aybb)", &parent_fd_id, &filename_v, &reuse_existing, &persistent);
+  filename = g_variant_get_bytestring (filename_v);
+
+  /* This is only allowed from the host, or else we could leak existence of files */
+  if (*app_id != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                             "Not enough permissions");
+      return;
+    }
+
+  message = g_dbus_method_invocation_get_message (invocation);
+  fd_list = g_dbus_message_get_unix_fd_list (message);
+
+  parent_fd = -1;
+  if (fd_list != NULL)
+    {
+      fds = g_unix_fd_list_peek_fds (fd_list, &fds_len);
+      if (parent_fd_id < fds_len)
+        parent_fd = fds[parent_fd_id];
+    }
+
+  if (strchr (filename, '/') != NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                             "Invalid filename passed");
+      return;
+    }
+
+  if (!validate_fd_common (parent_fd, &parent_st_buf, S_IFDIR, parent_path_buffer, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return;
+    }
+
+  if (parent_st_buf.st_dev == fuse_dev)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                             "Invalid fd passed");
+      return;
+    }
+
+  path = g_build_filename (parent_path_buffer, filename, NULL);
+
+  g_debug ("portal_add_named %s", path);
+
+  AUTOLOCK (db);
+
+  id = do_create_doc (&parent_st_buf, path, reuse_existing, persistent);
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(s)", id));
+}
+
+
+typedef void (*PortalMethod) (GDBusMethodInvocation *invocation,
+                              GVariant              *parameters,
+                              const char            *app_id);
+
+static void
+got_app_id_cb (GObject      *source_object,
+               GAsyncResult *res,
+               gpointer      user_data)
+{
+  GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (source_object);
+
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GKeyFile) app_info = NULL;
+  g_autofree char *app_id = NULL;
+  PortalMethod portal_method = user_data;
+
+  app_info = flatpak_invocation_lookup_app_info_finish (invocation, res, &error);
+  if (app_info != NULL)
+    app_id = g_key_file_get_string (app_info,
+                                    FLATPAK_METADATA_GROUP_APPLICATION,
+                                    FLATPAK_METADATA_KEY_NAME, &error);
+
+  if (app_id == NULL)
+    g_dbus_method_invocation_return_gerror (invocation, error);
+  else
+    {
+      g_object_set_data_full (G_OBJECT (invocation), "app-info", g_steal_pointer (&app_info), (GDestroyNotify)g_key_file_unref);
+      portal_method (invocation, g_dbus_method_invocation_get_parameters (invocation), app_id);
+    }
+}
+
+static gboolean
+handle_method (GCallback              method_callback,
+               GDBusMethodInvocation *invocation)
+{
+  flatpak_invocation_lookup_app_info (invocation, NULL, got_app_id_cb, method_callback);
+
+  return TRUE;
+}
+
+static gboolean
+handle_get_mount_point (XdpDbusDocuments *object, GDBusMethodInvocation *invocation)
+{
+  if (fuse_dev == 0)
+    {
+      /* We mustn't reply to this until the FUSE mount point is open for
+       * business. */
+      g_queue_push_tail (&get_mount_point_invocations, g_object_ref (invocation));
+      return TRUE;
+    }
+
+  xdp_dbus_documents_complete_get_mount_point (object, invocation, xdp_fuse_get_mountpoint ());
+  return TRUE;
+}
+
+static gboolean
+portal_lookup (GDBusMethodInvocation *invocation,
+               GVariant *parameters,
+               const char *app_id)
+{
+  const char *filename;
+  char path_buffer[PATH_MAX + 1];
+  glnx_autofd int fd = -1;
+  struct stat st_buf, real_parent_st_buf;
+  g_auto(GStrv) ids = NULL;
+  g_autofree char *id = NULL;
+  GError *error = NULL;
+  GKeyFile *app_info = g_object_get_data (G_OBJECT (invocation), "app-info");
+
+  if (strcmp (app_id, "") != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                             "Not allowed in sandbox");
+      return TRUE;
+    }
+
+  g_variant_get (parameters, "(^&ay)", &filename);
+
+  fd = open (filename, O_PATH | O_CLOEXEC);
+  if (fd == -1)
+    {
+      glnx_set_error_from_errno (&error);
+      g_dbus_method_invocation_take_error (invocation, error);
+      return TRUE;
+    }
+
+  if (!validate_fd (fd, app_info, &st_buf, &real_parent_st_buf, path_buffer, &error))
+    {
+      g_dbus_method_invocation_take_error (invocation, error);
+      return TRUE;
+    }
+
+  if (st_buf.st_dev == fuse_dev)
+    {
+      /* The passed in fd is on the fuse filesystem itself */
+      id = xdp_fuse_lookup_id_for_inode (st_buf.st_ino);
+      g_debug ("path on fuse, id %s", id);
+    }
+  else
+    {
+      g_autoptr(GVariant) data = NULL;
+
+      data = g_variant_ref_sink (g_variant_new ("(^ayttu)",
+                                                path_buffer,
+                                                (guint64)real_parent_st_buf.st_dev,
+                                                (guint64)real_parent_st_buf.st_ino,
+                                                0));
+      ids = flatpak_db_list_ids_by_value (db, data);
+      if (ids[0] != NULL)
+        id = g_strdup (ids[0]);
+    }
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(s)", id ? id : ""));
+
+  return TRUE;
+}
+
+static GVariant *
+get_app_permissions (FlatpakDbEntry *entry)
+{
+  g_autofree const char **apps = NULL;
+  GVariantBuilder builder;
+  int i;
+
+  apps = flatpak_db_entry_list_apps (entry);
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sas}"));
+
+  for (i = 0; apps[i] != NULL; i++)
+    {
+      g_autofree const char **permissions = flatpak_db_entry_list_permissions (entry, apps[i]);
+      g_variant_builder_add_value (&builder,
+                                   g_variant_new ("{s^as}", apps[i], permissions));
+    }
+
+  return g_variant_builder_end (&builder);
+}
+
+static GVariant *
+get_path (FlatpakDbEntry *entry)
+{
+  g_autoptr (GVariant) data = flatpak_db_entry_get_data (entry);
+  const char *path;
+
+  g_variant_get (data, "(^ayttu)", &path, NULL, NULL, NULL);
+  return g_variant_new_bytestring (path);
+}
+
+static gboolean
+portal_info (GDBusMethodInvocation *invocation,
+             GVariant *parameters,
+             const char *app_id)
+{
+  const char *id = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  if (strcmp (app_id, "") != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                             "Not allowed in sandbox");
+      return TRUE;
+    }
+
+  g_variant_get (parameters, "(&s)", &id);
+
+  AUTOLOCK (db);
+
+  entry = flatpak_db_lookup (db, id);
+
+  if (!entry)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
+                                             "Invalid ID passed");
+      return TRUE;
+    }
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(@ay@a{sas})",
+                                                        get_path (entry),
+                                                        get_app_permissions (entry)));
+
+  return TRUE;
+}
+
+static gboolean
+portal_list (GDBusMethodInvocation *invocation,
+             GVariant *parameters,
+             const char *app_id)
+{
+  g_auto(GStrv) ids = NULL;
+  GVariantBuilder builder;
+  int i;
+
+  if (strcmp (app_id, "") != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
+                                             "Not allowed in sandbox");
+      return TRUE;
+    }
+
+  g_variant_get (parameters, "(&s)", &app_id);
+
+  AUTOLOCK (db);
+
+  if (strcmp (app_id, "") == 0)
+    ids = flatpak_db_list_ids (db);
+  else
+    ids = flatpak_db_list_ids_by_app (db, app_id);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{say}"));
+  for (i = 0; ids[i]; i++)
+    {
+      g_autoptr(FlatpakDbEntry) entry = NULL;
+
+      entry = flatpak_db_lookup (db, ids[i]);
+
+      g_variant_builder_add (&builder, "{s@ay}", ids[i], get_path (entry));
+    }
+
+  g_dbus_method_invocation_return_value (invocation,
+                                         g_variant_new ("(@a{say})",
+                                                        g_variant_builder_end (&builder)));
+
+  return TRUE;
+}
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
+{
+  GError *error = NULL;
+
+  dbus_api = xdp_dbus_documents_skeleton_new ();
+
+  xdp_dbus_documents_set_version (XDP_DBUS_DOCUMENTS (dbus_api), 2);
+
+  g_signal_connect_swapped (dbus_api, "handle-get-mount-point", G_CALLBACK (handle_get_mount_point), NULL);
+  g_signal_connect_swapped (dbus_api, "handle-add", G_CALLBACK (handle_method), portal_add);
+  g_signal_connect_swapped (dbus_api, "handle-add-named", G_CALLBACK (handle_method), portal_add_named);
+  g_signal_connect_swapped (dbus_api, "handle-add-full", G_CALLBACK (handle_method), portal_add_full);
+  g_signal_connect_swapped (dbus_api, "handle-grant-permissions", G_CALLBACK (handle_method), portal_grant_permissions);
+  g_signal_connect_swapped (dbus_api, "handle-revoke-permissions", G_CALLBACK (handle_method), portal_revoke_permissions);
+  g_signal_connect_swapped (dbus_api, "handle-delete", G_CALLBACK (handle_method), portal_delete);
+  g_signal_connect_swapped (dbus_api, "handle-lookup", G_CALLBACK (handle_method), portal_lookup);
+  g_signal_connect_swapped (dbus_api, "handle-info", G_CALLBACK (handle_method), portal_info);
+  g_signal_connect_swapped (dbus_api, "handle-list", G_CALLBACK (handle_method), portal_list);
+
+  flatpak_connection_track_name_owners (connection);
+
+  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (dbus_api),
+                                         connection,
+                                         "/org/freedesktop/portal/documents",
+                                         &error))
+    {
+      g_warning ("error: %s", error->message);
+      g_error_free (error);
+    }
+}
+
+static void
+daemon_report_done (int status)
+{
+  if (daemon_event_fd != -1)
+    {
+      guint64 counter;
+
+      counter = status + 1;
+      if (write (daemon_event_fd, &counter, sizeof (counter)) < 0)
+          g_critical ("Unable to report exit status: %s", g_strerror (errno));
+
+      daemon_event_fd = -1;
+    }
+}
+
+static void
+do_exit (int status)
+{
+  daemon_report_done (status);
+  exit (status);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+                  const gchar     *name,
+                  gpointer         user_data)
+{
+  struct stat stbuf;
+  gpointer invocation;
+
+  g_debug ("%s acquired", name);
+
+  if (!xdp_fuse_init (&exit_error))
+    {
+      final_exit_status = 6;
+      g_printerr ("fuse init failed: %s", exit_error->message);
+      g_main_loop_quit (loop);
+      return;
+    }
+
+  if (stat (xdp_fuse_get_mountpoint (), &stbuf) != 0)
+    {
+      g_set_error (&exit_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "fuse stat failed: %s", g_strerror (errno));
+      final_exit_status = 7;
+      g_printerr ("fuse stat failed: %s", g_strerror (errno));
+      g_main_loop_quit (loop);
+      return;
+    }
+
+  fuse_dev = stbuf.st_dev;
+
+  while ((invocation = g_queue_pop_head (&get_mount_point_invocations)) != NULL)
+    {
+      xdp_dbus_documents_complete_get_mount_point (dbus_api, invocation, xdp_fuse_get_mountpoint ());
+      g_object_unref (invocation);
+    }
+
+  daemon_report_done (0);
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+              const gchar     *name,
+              gpointer         user_data)
+{
+  g_debug ("%s lost", name);
+
+  if (final_exit_status == 0)
+    final_exit_status = 20;
+
+  if (exit_error == NULL)
+    g_set_error (&exit_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "D-Bus name \"%s\" lost", name);
+
+  g_main_loop_quit (loop);
+}
+
+static void
+exit_handler (int sig)
+{
+  /* We cannot set exit_error here, because malloc() in a signal handler
+   * is undefined behaviour. Rely on main() coping gracefully with
+   * that. */
+  g_main_loop_quit (loop);
+}
+
+static void
+session_bus_closed (GDBusConnection *connection,
+                    gboolean         remote_peer_vanished,
+                    GError          *bus_error)
+{
+  if (exit_error == NULL)
+    g_set_error (&exit_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE, "Disconnected from session bus");
+
+  g_main_loop_quit (loop);
+}
+
+static int
+set_one_signal_handler (int    sig,
+                        void (*handler)(int),
+                        int    remove)
+{
+  struct sigaction sa;
+  struct sigaction old_sa;
+
+  memset (&sa, 0, sizeof (struct sigaction));
+  sa.sa_handler = remove ? SIG_DFL : handler;
+  sigemptyset (&(sa.sa_mask));
+  sa.sa_flags = 0;
+
+  if (sigaction (sig, NULL, &old_sa) == -1)
+    {
+      g_warning ("cannot get old signal handler");
+      return -1;
+    }
+
+  if (old_sa.sa_handler == (remove ? handler : SIG_DFL) &&
+      sigaction (sig, &sa, NULL) == -1)
+    {
+      g_warning ("cannot set signal handler");
+      return -1;
+    }
+
+  return 0;
+}
+
+static gboolean opt_verbose;
+static gboolean opt_daemon;
+static gboolean opt_replace;
+static gboolean opt_version;
+
+static GOptionEntry entries[] = {
+  { "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Print debug information", NULL },
+  { "daemon", 'd', 0, G_OPTION_ARG_NONE, &opt_daemon, "Run in background", NULL },
+  { "replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace", NULL },
+  { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version and exit", NULL },
+  { NULL }
+};
+
+static void
+message_handler (const gchar   *log_domain,
+                 GLogLevelFlags log_level,
+                 const gchar   *message,
+                 gpointer       user_data)
+{
+  /* Make this look like normal console output */
+  if (log_level & G_LOG_LEVEL_DEBUG)
+    printf ("XDP: %s\n", message);
+  else
+    printf ("%s: %s\n", g_get_prgname (), message);
+}
+
+static void
+printerr_handler (const gchar *string)
+{
+  const char *prefix = "";
+  const char *suffix = "";
+  if (flatpak_fancy_output ())
+    {
+      prefix = FLATPAK_ANSI_RED FLATPAK_ANSI_BOLD_ON;
+      suffix = FLATPAK_ANSI_BOLD_OFF FLATPAK_ANSI_COLOR_RESET;
+    }
+  fprintf (stderr, "%serror: %s%s\n", prefix, suffix, string);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  guint owner_id;
+
+  g_autoptr(GError) error = NULL;
+  g_autofree char *path = NULL;
+  GDBusConnection *session_bus;
+  GOptionContext *context;
+  GDBusMethodInvocation *invocation;
+
+  setlocale (LC_ALL, "");
+
+  /* Avoid even loading gvfs to avoid accidental confusion */
+  g_setenv ("GIO_USE_VFS", "local", TRUE);
+
+  flatpak_migrate_from_xdg_app ();
+
+  g_set_printerr_handler (printerr_handler);
+
+  context = g_option_context_new ("- document portal");
+  g_option_context_add_main_entries (context, entries, NULL);
+  if (!g_option_context_parse (context, &argc, &argv, &error))
+    {
+      g_printerr ("Option parsing failed: %s", error->message);
+      return 1;
+    }
+
+  if (opt_version)
+    {
+      g_print ("%s\n", PACKAGE_STRING);
+      exit (EXIT_SUCCESS);
+    }
+
+  if (opt_daemon)
+    {
+      pid_t pid;
+      ssize_t read_res;
+
+      daemon_event_fd = eventfd (0, EFD_CLOEXEC);
+      pid = fork ();
+      if (pid != 0)
+        {
+          guint64 counter;
+
+          read_res = read (daemon_event_fd, &counter, sizeof (counter));
+          if (read_res != 8)
+            exit (1);
+          exit (counter - 1);
+        }
+    }
+
+  if (opt_verbose)
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+
+  g_set_prgname (argv[0]);
+
+  loop = g_main_loop_new (NULL, FALSE);
+
+  path = g_build_filename (g_get_user_data_dir (), "flatpak/db", TABLE_NAME, NULL);
+  db = flatpak_db_new (path, FALSE, &error);
+  if (db == NULL)
+    {
+      g_printerr ("Failed to load db: %s", error->message);
+      do_exit (2);
+    }
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+  if (session_bus == NULL)
+    {
+      g_printerr ("No session bus: %s", error->message);
+      do_exit (3);
+    }
+
+  permission_store = xdg_permission_store_proxy_new_sync (session_bus, G_DBUS_PROXY_FLAGS_NONE,
+                                                          "org.freedesktop.impl.portal.PermissionStore",
+                                                          "/org/freedesktop/impl/portal/PermissionStore",
+                                                          NULL, &error);
+  if (permission_store == NULL)
+    {
+      g_print ("No permission store: %s", error->message);
+      do_exit (4);
+    }
+
+  /* We want do do our custom post-mainloop exit */
+  g_dbus_connection_set_exit_on_close (session_bus, FALSE);
+
+  g_signal_connect (session_bus, "closed", G_CALLBACK (session_bus_closed), NULL);
+
+  if (set_one_signal_handler (SIGHUP, exit_handler, 0) == -1 ||
+      set_one_signal_handler (SIGINT, exit_handler, 0) == -1 ||
+      set_one_signal_handler (SIGTERM, exit_handler, 0) == -1 ||
+      set_one_signal_handler (SIGPIPE, SIG_IGN, 0) == -1)
+    do_exit (5);
+
+  owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+                             "org.freedesktop.portal.Documents",
+                             G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
+                             on_bus_acquired,
+                             on_name_acquired,
+                             on_name_lost,
+                             NULL,
+                             NULL);
+
+  g_main_loop_run (loop);
+
+  while ((invocation = g_queue_pop_head (&get_mount_point_invocations)) != NULL)
+    {
+      if (exit_error != NULL)
+        g_dbus_method_invocation_return_gerror (invocation, exit_error);
+      else
+        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Terminated");
+
+      g_object_unref (invocation);
+    }
+
+  xdp_fuse_exit ();
+
+  g_bus_unown_name (owner_id);
+
+  do_exit (final_exit_status);
+
+  return 0;
+}
diff --git a/document-portal/xdp-util.c b/document-portal/xdp-util.c
new file mode 100644 (file)
index 0000000..0f5f085
--- /dev/null
@@ -0,0 +1,129 @@
+#include "config.h"
+#include <string.h>
+#include <errno.h>
+#include <gio/gio.h>
+#include "flatpak-portal-error.h"
+#include "xdp-util.h"
+
+const char **
+xdg_unparse_permissions (XdpPermissionFlags permissions)
+{
+  GPtrArray *array;
+
+  array = g_ptr_array_new ();
+
+  if (permissions & XDP_PERMISSION_FLAGS_READ)
+    g_ptr_array_add (array, "read");
+  if (permissions & XDP_PERMISSION_FLAGS_WRITE)
+    g_ptr_array_add (array, "write");
+  if (permissions & XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS)
+    g_ptr_array_add (array, "grant-permissions");
+  if (permissions & XDP_PERMISSION_FLAGS_DELETE)
+    g_ptr_array_add (array, "delete");
+
+  g_ptr_array_add (array, NULL);
+  return (const char **) g_ptr_array_free (array, FALSE);
+}
+
+XdpPermissionFlags
+xdp_parse_permissions (const char **permissions)
+{
+  XdpPermissionFlags perms;
+  int i;
+
+  perms = 0;
+  for (i = 0; permissions[i]; i++)
+    {
+      if (strcmp (permissions[i], "read") == 0)
+        perms |= XDP_PERMISSION_FLAGS_READ;
+      else if (strcmp (permissions[i], "write") == 0)
+        perms |= XDP_PERMISSION_FLAGS_WRITE;
+      else if (strcmp (permissions[i], "grant-permissions") == 0)
+        perms |= XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS;
+      else if (strcmp (permissions[i], "delete") == 0)
+        perms |= XDP_PERMISSION_FLAGS_DELETE;
+      else
+        g_warning ("No such permission: %s", permissions[i]);
+    }
+
+  return perms;
+}
+
+XdpPermissionFlags
+xdp_entry_get_permissions (FlatpakDbEntry *entry,
+                           const char     *app_id)
+{
+  g_autofree const char **permissions = NULL;
+
+  if (strcmp (app_id, "") == 0)
+    return XDP_PERMISSION_FLAGS_ALL;
+
+  permissions = flatpak_db_entry_list_permissions (entry, app_id);
+  return xdp_parse_permissions (permissions);
+}
+
+gboolean
+xdp_entry_has_permissions (FlatpakDbEntry    *entry,
+                           const char        *app_id,
+                           XdpPermissionFlags perms)
+{
+  XdpPermissionFlags current_perms;
+
+  current_perms = xdp_entry_get_permissions (entry, app_id);
+
+  return (current_perms & perms) == perms;
+}
+
+char *
+xdp_name_from_id (guint32 doc_id)
+{
+  return g_strdup_printf ("%x", doc_id);
+}
+
+const char *
+xdp_entry_get_path (FlatpakDbEntry *entry)
+{
+  g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
+  g_autoptr(GVariant) c = g_variant_get_child_value (v, 0);
+  return g_variant_get_bytestring (c);
+}
+
+char *
+xdp_entry_dup_basename (FlatpakDbEntry *entry)
+{
+  const char *path = xdp_entry_get_path (entry);
+
+  return g_path_get_basename (path);
+}
+
+char *
+xdp_entry_dup_dirname (FlatpakDbEntry *entry)
+{
+  const char *path = xdp_entry_get_path (entry);
+
+  return g_path_get_dirname (path);
+}
+
+guint64
+xdp_entry_get_device (FlatpakDbEntry *entry)
+{
+  g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
+  g_autoptr(GVariant) c = g_variant_get_child_value (v, 1);
+  return g_variant_get_uint64 (c);
+}
+
+guint64
+xdp_entry_get_inode (FlatpakDbEntry *entry)
+{
+  g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
+  g_autoptr(GVariant) c = g_variant_get_child_value (v, 2);
+  return g_variant_get_uint64 (c);
+}
+
+guint32
+xdp_entry_get_flags (FlatpakDbEntry *entry)
+{
+  g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
+  g_autoptr(GVariant) c = g_variant_get_child_value (v, 3);
+  return g_variant_get_uint32 (c);
+}
diff --git a/document-portal/xdp-util.h b/document-portal/xdp-util.h
new file mode 100644 (file)
index 0000000..007a243
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef XDP_UTIL_H
+#define XDP_UTIL_H
+
+#include <gio/gio.h>
+#include "flatpak-db.h"
+#include "xdp-enums.h"
+
+G_BEGIN_DECLS
+
+#define XDP_ENTRY_FLAG_UNIQUE (1 << 0)
+#define XDP_ENTRY_FLAG_TRANSIENT (1 << 1)
+
+const char **      xdg_unparse_permissions (XdpPermissionFlags permissions);
+XdpPermissionFlags xdp_parse_permissions (const char **permissions);
+
+XdpPermissionFlags xdp_entry_get_permissions (FlatpakDbEntry *entry,
+                                              const char     *app_id);
+gboolean           xdp_entry_has_permissions (FlatpakDbEntry    *entry,
+                                              const char        *app_id,
+                                              XdpPermissionFlags perms);
+const char *       xdp_entry_get_path (FlatpakDbEntry *entry);
+char *             xdp_entry_dup_basename (FlatpakDbEntry *entry);
+char *             xdp_entry_dup_dirname (FlatpakDbEntry *entry);
+guint64            xdp_entry_get_device (FlatpakDbEntry *entry);
+guint64            xdp_entry_get_inode (FlatpakDbEntry *entry);
+guint32            xdp_entry_get_flags (FlatpakDbEntry *entry);
+
+char *  xdp_name_from_id (guint32 doc_id);
+
+
+G_END_DECLS
+
+#endif /* XDP_UTIL_H */
diff --git a/env.d/flatpak.env.in b/env.d/flatpak.env.in
new file mode 100644 (file)
index 0000000..478770b
--- /dev/null
@@ -0,0 +1 @@
+XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share/:@localstatedir@/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
diff --git a/flatpak.pc.in b/flatpak.pc.in
new file mode 100644 (file)
index 0000000..2ba1068
--- /dev/null
@@ -0,0 +1,16 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+datarootdir=@datarootdir@
+includedir=@includedir@
+datadir=@datadir@
+
+interfaces_dir=${datadir}/dbus-1/interfaces/
+
+Name: flatpak
+Description: Application sandboxing framework
+Version: @VERSION@
+Requires: glib-2.0 gio-2.0
+Requires.private: gio-unix-2.0 ostree-1
+Libs: -L${libdir} -lflatpak
+Cflags: -I${includedir}/flatpak
diff --git a/gtk-doc.make b/gtk-doc.make
new file mode 100644 (file)
index 0000000..d2a8b33
--- /dev/null
@@ -0,0 +1,302 @@
+# -*- mode: makefile -*-
+
+####################################
+# Everything below here is generic #
+####################################
+
+if GTK_DOC_USE_LIBTOOL
+GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+GTKDOC_RUN = $(LIBTOOL) --mode=execute
+else
+GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+GTKDOC_RUN =
+endif
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+SETUP_FILES = \
+       $(content_files)                \
+       $(expand_content_files)         \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt
+
+EXTRA_DIST =                           \
+       $(HTML_IMAGES)                  \
+       $(SETUP_FILES)
+
+DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
+       html-build.stamp pdf-build.stamp \
+       sgml.stamp html.stamp pdf.stamp
+
+SCANOBJ_FILES =                 \
+       $(DOC_MODULE).args       \
+       $(DOC_MODULE).hierarchy  \
+       $(DOC_MODULE).interfaces \
+       $(DOC_MODULE).prerequisites \
+       $(DOC_MODULE).signals
+
+REPORT_FILES = \
+       $(DOC_MODULE)-undocumented.txt \
+       $(DOC_MODULE)-undeclared.txt \
+       $(DOC_MODULE)-unused.txt
+
+gtkdoc-check.test: Makefile
+       $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
+               echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
+               chmod +x $@
+
+CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
+
+if GTK_DOC_BUILD_HTML
+HTML_BUILD_STAMP=html-build.stamp
+else
+HTML_BUILD_STAMP=
+endif
+if GTK_DOC_BUILD_PDF
+PDF_BUILD_STAMP=pdf-build.stamp
+else
+PDF_BUILD_STAMP=
+endif
+
+all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+.PHONY: all-gtk-doc
+
+if ENABLE_GTK_DOC
+all-local: all-gtk-doc
+endif
+
+docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
+
+$(REPORT_FILES): sgml-build.stamp
+
+#### setup ####
+
+GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_@AM_V@)
+GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_@AM_DEFAULT_V@)
+GTK_DOC_V_SETUP_0=@echo "  DOC   Preparing build";
+
+setup-build.stamp:
+       -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+         files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
+         if test "x$$files" != "x" ; then \
+           for file in $$files ; do \
+             destdir=`dirname $(abs_builddir)/$$file`; \
+             test -d "$$destdir" || mkdir -p "$$destdir"; \
+             test -f $(abs_srcdir)/$$file && \
+               cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
+           done; \
+         fi; \
+       fi
+       $(AM_V_at)touch setup-build.stamp
+
+#### scan ####
+
+GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_@AM_V@)
+GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_@AM_DEFAULT_V@)
+GTK_DOC_V_SCAN_0=@echo "  DOC   Scanning header files";
+
+GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_@AM_V@)
+GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_@AM_DEFAULT_V@)
+GTK_DOC_V_INTROSPECT_0=@echo "  DOC   Introspecting gobjects";
+
+scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
+       $(GTK_DOC_V_SCAN)_source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+         _source_dir="$${_source_dir} --source-dir=$$i" ; \
+       done ; \
+       gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
+       $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
+         scanobj_options=""; \
+         gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+         if test "$$?" = "0"; then \
+           if test "x$(V)" = "x1"; then \
+             scanobj_options="--verbose"; \
+           fi; \
+         fi; \
+         CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
+         gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
+       else \
+         for i in $(SCANOBJ_FILES) ; do \
+           test -f $$i || touch $$i ; \
+         done \
+       fi
+       $(AM_V_at)touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
+       @true
+
+#### xml ####
+
+GTK_DOC_V_XML=$(GTK_DOC_V_XML_@AM_V@)
+GTK_DOC_V_XML_=$(GTK_DOC_V_XML_@AM_DEFAULT_V@)
+GTK_DOC_V_XML_0=@echo "  DOC   Building XML";
+
+sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) xml/gtkdocentities.ent
+       $(GTK_DOC_V_XML)_source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+         _source_dir="$${_source_dir} --source-dir=$$i" ; \
+       done ; \
+       gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
+       $(AM_V_at)touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+$(DOC_MAIN_SGML_FILE): sgml-build.stamp
+       @true
+
+xml/gtkdocentities.ent: Makefile
+       $(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \
+               echo "<!ENTITY package \"$(PACKAGE)\">"; \
+               echo "<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
+               echo "<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
+               echo "<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
+               echo "<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
+               echo "<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
+               echo "<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
+       ) > $@
+
+#### html ####
+
+GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_@AM_V@)
+GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_@AM_DEFAULT_V@)
+GTK_DOC_V_HTML_0=@echo "  DOC   Building HTML";
+
+GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_@AM_V@)
+GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_@AM_DEFAULT_V@)
+GTK_DOC_V_XREF_0=@echo "  DOC   Fixing cross-references";
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
+       $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
+       mkhtml_options=""; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+       if test "$$?" = "0"; then \
+         if test "x$(V)" = "x1"; then \
+           mkhtml_options="$$mkhtml_options --verbose"; \
+         fi; \
+       fi; \
+       gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
+       if test "$$?" = "0"; then \
+         mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
+       fi; \
+       cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+       -@test "x$(HTML_IMAGES)" = "x" || \
+       for file in $(HTML_IMAGES) ; do \
+         test -f $(abs_srcdir)/$$file && cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
+         test -f $(abs_builddir)/$$file && cp $(abs_builddir)/$$file $(abs_builddir)/html; \
+       done;
+       $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       $(AM_V_at)touch html-build.stamp
+
+#### pdf ####
+
+GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_@AM_V@)
+GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_@AM_DEFAULT_V@)
+GTK_DOC_V_PDF_0=@echo "  DOC   Building PDF";
+
+pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
+       $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
+       mkpdf_options=""; \
+       gtkdoc-mkpdf 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
+       if test "$$?" = "0"; then \
+         if test "x$(V)" = "x1"; then \
+           mkpdf_options="$$mkpdf_options --verbose"; \
+         fi; \
+       fi; \
+       if test "x$(HTML_IMAGES)" != "x"; then \
+         for img in $(HTML_IMAGES); do \
+           part=`dirname $$img`; \
+           echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
+           if test $$? != 0; then \
+             mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
+           fi; \
+         done; \
+       fi; \
+       gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
+       $(AM_V_at)touch pdf-build.stamp
+
+##############
+
+clean-local:
+       @rm -f *~ *.bak
+       @rm -rf .libs
+       @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
+         rm -f $(DOC_MODULE).types; \
+       fi
+       @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
+         rm -f $(DOC_MODULE)-sections.txt; \
+       fi
+
+distclean-local:
+       @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
+           $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+       @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+           rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
+       fi
+
+maintainer-clean-local:
+       @rm -rf xml html
+
+install-data-local:
+       @installfiles=`echo $(builddir)/html/*`; \
+       if test "$$installfiles" = '$(builddir)/html/*'; \
+       then echo 1>&2 'Nothing to install' ; \
+       else \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+         else \
+           installdir="$(DESTDIR)$(TARGET_DIR)"; \
+         fi; \
+         $(mkinstalldirs) $${installdir} ; \
+         for i in $$installfiles; do \
+           echo ' $(INSTALL_DATA) '$$i ; \
+           $(INSTALL_DATA) $$i $${installdir}; \
+         done; \
+         if test -n "$(DOC_MODULE_VERSION)"; then \
+           mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
+             $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
+         fi; \
+         $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
+       fi
+
+uninstall-local:
+       @if test -n "$(DOC_MODULE_VERSION)"; then \
+         installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
+       else \
+         installdir="$(DESTDIR)$(TARGET_DIR)"; \
+       fi; \
+       rm -rf $${installdir}
+
+#
+# Require gtk-doc when making dist
+#
+if HAVE_GTK_DOC
+dist-check-gtkdoc: docs
+else
+dist-check-gtkdoc:
+       @echo "*** gtk-doc is needed to run 'make dist'.         ***"
+       @echo "*** gtk-doc was not found when 'configure' ran.   ***"
+       @echo "*** please install gtk-doc and rerun 'configure'. ***"
+       @false
+endif
+
+dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
+       @mkdir $(distdir)/html
+       @cp ./html/* $(distdir)/html
+       @-cp ./$(DOC_MODULE).pdf $(distdir)/
+       @-cp ./$(DOC_MODULE).types $(distdir)/
+       @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
+       @cd $(distdir) && rm -f $(DISTCLEANFILES)
+       @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
+
+.PHONY : dist-hook-local docs
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..0b0fdcb
--- /dev/null
@@ -0,0 +1,501 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2013-12-25.23; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab='  '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
+
+    -o) chowncmd="$chownprog $2"
+        shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
+
+    -T) is_target_a_directory=never;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --) shift
+        break;;
+
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call 'install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for 'test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      dstdir=`dirname "$dst"`
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+        # Create intermediate dirs using mode 755 as modified by the umask.
+        # This is like FreeBSD 'install' as of 1997-10-28.
+        umask=`umask`
+        case $stripcmd.$umask in
+          # Optimize common cases.
+          *[2367][2367]) mkdir_umask=$umask;;
+          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+          *[0-7])
+            mkdir_umask=`expr $umask + 22 \
+              - $umask % 100 % 40 + $umask % 20 \
+              - $umask % 10 % 4 + $umask % 2
+            `;;
+          *) mkdir_umask=$umask,go-w;;
+        esac
+
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+        case $umask in
+          *[123567][0-7][0-7])
+            # POSIX mkdir -p sets u+wx bits regardless of umask, which
+            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+            ;;
+          *)
+            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+            if (umask $mkdir_umask &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+            then
+              if test -z "$dir_arg" || {
+                   # Check for POSIX incompatibilities with -m.
+                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                   # other-writable bit of parent directory when it shouldn't.
+                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                   case $ls_ld_tmpdir in
+                     d????-?r-*) different_mode=700;;
+                     d????-?--*) different_mode=755;;
+                     *) false;;
+                   esac &&
+                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                   }
+                 }
+              then posix_mkdir=:
+              fi
+              rmdir "$tmpdir/d" "$tmpdir"
+            else
+              # Remove any dirs left behind by ancient mkdir implementations.
+              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+            fi
+            trap '' 0;;
+        esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      set -f
+      set fnord $dstdir
+      shift
+      set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask=$mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       set +f &&
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/lib/Makefile.am.inc b/lib/Makefile.am.inc
new file mode 100644 (file)
index 0000000..06751b8
--- /dev/null
@@ -0,0 +1,149 @@
+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/lib/flatpak-bundle-ref.c b/lib/flatpak-bundle-ref.c
new file mode 100644 (file)
index 0000000..5d0c108
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "flatpak-utils.h"
+#include "flatpak-bundle-ref.h"
+#include "flatpak-enum-types.h"
+
+typedef struct _FlatpakBundleRefPrivate FlatpakBundleRefPrivate;
+
+struct _FlatpakBundleRefPrivate
+{
+  GFile  *file;
+  char   *origin;
+  char   *runtime_repo;
+  GBytes *metadata;
+  GBytes *appstream;
+  GBytes *icon_64;
+  GBytes *icon_128;
+  guint64 installed_size;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakBundleRef, flatpak_bundle_ref, FLATPAK_TYPE_REF)
+
+enum {
+  PROP_0,
+
+  PROP_FILE,
+};
+
+static void
+flatpak_bundle_ref_finalize (GObject *object)
+{
+  FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  g_clear_object (&priv->file);
+
+  g_bytes_unref (priv->metadata);
+  g_bytes_unref (priv->appstream);
+  g_bytes_unref (priv->icon_64);
+  g_bytes_unref (priv->icon_128);
+  g_free (priv->origin);
+  g_free (priv->runtime_repo);
+
+  G_OBJECT_CLASS (flatpak_bundle_ref_parent_class)->finalize (object);
+}
+
+static void
+flatpak_bundle_ref_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+  FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_FILE:
+      g_set_object (&priv->file, g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_bundle_ref_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_FILE:
+      g_value_set_object (value, priv->file);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_bundle_ref_class_init (FlatpakBundleRefClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_bundle_ref_get_property;
+  object_class->set_property = flatpak_bundle_ref_set_property;
+  object_class->finalize = flatpak_bundle_ref_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_FILE,
+                                   g_param_spec_object ("file",
+                                                        "",
+                                                        "",
+                                                        G_TYPE_FILE,
+                                                        G_PARAM_READWRITE));
+}
+
+static void
+flatpak_bundle_ref_init (FlatpakBundleRef *self)
+{
+}
+
+/**
+ * flatpak_bundle_ref_get_file:
+ * @self: a #FlatpakBundleRef
+ *
+ * Get the file this bundle is stored in.
+ *
+ * Returns: (transfer full) : an #GFile
+ */
+GFile *
+flatpak_bundle_ref_get_file (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  return g_object_ref (priv->file);
+}
+
+/**
+ * flatpak_bundle_ref_get_metadata:
+ * @self: a #FlatpakBundleRef
+ *
+ * Get the metadata for the app/runtime
+ *
+ * Returns: (transfer full) : an #GBytes with the metadata contents, or %NULL
+ */
+GBytes *
+flatpak_bundle_ref_get_metadata (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  if (priv->metadata)
+    return g_bytes_ref (priv->metadata);
+  return NULL;
+}
+
+/**
+ * flatpak_bundle_ref_get_appstream:
+ * @self: a #FlatpakBundleRef
+ *
+ * Get the compressed appstream for the app/runtime
+ *
+ * Returns: (transfer full) : an #GBytes with the appstream contents, or %NULL
+ */
+GBytes *
+flatpak_bundle_ref_get_appstream (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  if (priv->appstream)
+    return g_bytes_ref (priv->appstream);
+  return NULL;
+}
+
+/**
+ * flatpak_bundle_ref_get_icon:
+ * @self: a #FlatpakBundleRef
+ * @size: 64 or 128
+ *
+ * Get the icon png data for the app/runtime
+ *
+ * Returns: (transfer full) : an #GBytes with png contents
+ */
+GBytes *
+flatpak_bundle_ref_get_icon (FlatpakBundleRef *self,
+                             int               size)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  if (size == 64 && priv->icon_64)
+    return g_bytes_ref (priv->icon_64);
+
+  if (size == 128 && priv->icon_128)
+    return g_bytes_ref (priv->icon_128);
+
+  return NULL;
+}
+
+/**
+ * flatpak_bundle_ref_get_origin:
+ * @self: a #FlatpakBundleRef
+ *
+ * Get the origin url stored in the bundle
+ *
+ * Returns: (transfer full) : an url string, or %NULL
+ */
+char *
+flatpak_bundle_ref_get_origin (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  return g_strdup (priv->origin);
+}
+
+
+/**
+ * flatpak_bundle_ref_get_runtime_repo:
+ * @self: a #FlatpakBundleRef
+ *
+ * Get the runtime flatpakrepo url stored in the bundle (if any)
+ *
+ * Returns: (transfer full) : an url string, or %NULL
+ *
+ * Since: 0.8.0
+ */
+char *
+flatpak_bundle_ref_get_runtime_repo_url (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  return g_strdup (priv->runtime_repo);
+}
+
+/**
+ * flatpak_bundle_ref_get_installed_size:
+ * @self: a FlatpakBundleRef
+ *
+ * Returns the installed size for the bundle.
+ *
+ * Returns: the installed size
+ */
+guint64
+flatpak_bundle_ref_get_installed_size (FlatpakBundleRef *self)
+{
+  FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
+
+  return priv->installed_size;
+}
+
+/**
+ * flatpak_bundle_ref_new:
+ * @file: a #GFile
+ * @error: (allow-none): return location for an error
+ *
+ * Creates a new bundle ref for the given file.
+ *
+ * Returns: a new bundle ref.
+ */
+FlatpakBundleRef *
+flatpak_bundle_ref_new (GFile   *file,
+                        GError **error)
+{
+  FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
+  FlatpakBundleRefPrivate *priv;
+
+  g_auto(GStrv) parts = NULL;
+  FlatpakBundleRef *ref;
+  g_autoptr(GVariant) metadata = NULL;
+  g_autofree char *commit = NULL;
+  g_autofree char *full_ref = NULL;
+  g_autofree char *origin = NULL;
+  g_autofree char *runtime_repo = NULL;
+  g_autofree char *metadata_contents = NULL;
+  g_autoptr(GVariant) appstream = NULL;
+  g_autoptr(GVariant) icon_64 = NULL;
+  g_autoptr(GVariant) icon_128 = NULL;
+  guint64 installed_size;
+  g_autofree char *collection_id = NULL;
+
+  metadata = flatpak_bundle_load (file, &commit, &full_ref, &origin, &runtime_repo, &metadata_contents, &installed_size,
+                                  NULL, &collection_id, error);
+  if (metadata == NULL)
+    return NULL;
+
+  parts = flatpak_decompose_ref (full_ref, error);
+  if (parts == NULL)
+    return NULL;
+
+  if (strcmp (parts[0], "app") != 0)
+    kind = FLATPAK_REF_KIND_RUNTIME;
+
+  ref = g_object_new (FLATPAK_TYPE_BUNDLE_REF,
+                      "kind", kind,
+                      "name", parts[1],
+                      "arch", parts[2],
+                      "branch", parts[3],
+                      "commit", commit,
+                      "file", file,
+#ifdef FLATPAK_ENABLE_P2P
+                      "collection-id", collection_id,
+#endif  /* FLATPAK_ENABLE_P2P */
+                      NULL);
+  priv = flatpak_bundle_ref_get_instance_private (ref);
+
+  if (metadata_contents)
+    priv->metadata = g_bytes_new_take (metadata_contents,
+                                       strlen (metadata_contents));
+  metadata_contents = NULL; /* Stolen */
+
+  appstream = g_variant_lookup_value (metadata, "appdata", G_VARIANT_TYPE_BYTESTRING);
+  if (appstream)
+    priv->appstream = g_variant_get_data_as_bytes (appstream);
+
+  icon_64 = g_variant_lookup_value (metadata, "icon-64", G_VARIANT_TYPE_BYTESTRING);
+  if (icon_64)
+    priv->icon_64 = g_variant_get_data_as_bytes (icon_64);
+
+  icon_128 = g_variant_lookup_value (metadata, "icon-128", G_VARIANT_TYPE_BYTESTRING);
+  if (icon_128)
+    priv->icon_128 = g_variant_get_data_as_bytes (icon_128);
+
+  priv->installed_size = installed_size;
+
+  priv->origin = g_steal_pointer (&origin);
+  priv->runtime_repo = g_steal_pointer (&runtime_repo);
+
+  return ref;
+}
diff --git a/lib/flatpak-bundle-ref.h b/lib/flatpak-bundle-ref.h
new file mode 100644 (file)
index 0000000..20484db
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_BUNDLE_REF_H__
+#define __FLATPAK_BUNDLE_REF_H__
+
+typedef struct _FlatpakBundleRef FlatpakBundleRef;
+
+#include <gio/gio.h>
+#include <flatpak-ref.h>
+
+#define FLATPAK_TYPE_BUNDLE_REF flatpak_bundle_ref_get_type ()
+#define FLATPAK_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_BUNDLE_REF, FlatpakBundleRef))
+#define FLATPAK_IS_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_BUNDLE_REF))
+
+FLATPAK_EXTERN GType flatpak_bundle_ref_get_type (void);
+
+struct _FlatpakBundleRef
+{
+  FlatpakRef parent;
+};
+
+typedef struct
+{
+  FlatpakRefClass parent_class;
+} FlatpakBundleRefClass;
+
+FLATPAK_EXTERN FlatpakBundleRef *flatpak_bundle_ref_new (GFile   *file,
+                                                         GError **error);
+FLATPAK_EXTERN GFile           *flatpak_bundle_ref_get_file (FlatpakBundleRef *self);
+FLATPAK_EXTERN GBytes          *flatpak_bundle_ref_get_metadata (FlatpakBundleRef *self);
+FLATPAK_EXTERN GBytes          *flatpak_bundle_ref_get_appstream (FlatpakBundleRef *self);
+FLATPAK_EXTERN GBytes          *flatpak_bundle_ref_get_icon (FlatpakBundleRef *self,
+                                                             int               size);
+FLATPAK_EXTERN char            *flatpak_bundle_ref_get_origin (FlatpakBundleRef *self);
+FLATPAK_EXTERN guint64          flatpak_bundle_ref_get_installed_size (FlatpakBundleRef *self);
+FLATPAK_EXTERN char            *flatpak_bundle_ref_get_runtime_repo_url (FlatpakBundleRef *self);
+
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakBundleRef, g_object_unref)
+#endif
+
+#endif /* __FLATPAK_BUNDLE_REF_H__ */
diff --git a/lib/flatpak-enum-types.c.template b/lib/flatpak-enum-types.c.template
new file mode 100644 (file)
index 0000000..f811888
--- /dev/null
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+#include "config.h"
+#include <flatpak-utils.h>
+#include <flatpak.h>
+#include <flatpak-enum-types.h>
+#include <gio/gio.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
diff --git a/lib/flatpak-enum-types.h.template b/lib/flatpak-enum-types.h.template
new file mode 100644 (file)
index 0000000..5b67b9c
--- /dev/null
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef __FLATPAK_ENUM_TYPES_H__
+#define __FLATPAK_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+FLATPAK_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __GIO_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/lib/flatpak-error.c b/lib/flatpak-error.c
new file mode 100644 (file)
index 0000000..781a9eb
--- /dev/null
@@ -0,0 +1,34 @@
+/* flatpak-error.c
+ *
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-error.h"
+
+#include <gio/gio.h>
+
+/**
+ * SECTION:flatpak-error
+ * @Title: Error codes
+ *
+ */
+
+/* This is actually defined in common/flatpak-utils.c so the common code can report errors */
diff --git a/lib/flatpak-error.h b/lib/flatpak-error.h
new file mode 100644 (file)
index 0000000..0499aa0
--- /dev/null
@@ -0,0 +1,50 @@
+/* flatpak-error.c
+ *
+ * Copyright (C) 2015 Red Hat, Inc
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef FLATPAK_ERROR_H
+#define FLATPAK_ERROR_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * FlatpakError:
+ * @FLATPAK_ERROR_ALREADY_INSTALLED: App/runtime is already installed
+ * @FLATPAK_ERROR_NOT_INSTALLED: App/runtime is not installed
+ * @FLATPAK_ERROR_ONLY_PULLED: App/runtime was only pulled into the local
+ *                             repository but not installed.
+ *
+ * Error codes for library functions.
+ */
+typedef enum {
+  FLATPAK_ERROR_ALREADY_INSTALLED,
+  FLATPAK_ERROR_NOT_INSTALLED,
+  FLATPAK_ERROR_ONLY_PULLED
+} FlatpakError;
+
+#define FLATPAK_ERROR flatpak_error_quark ()
+
+FLATPAK_EXTERN GQuark  flatpak_error_quark (void);
+
+G_END_DECLS
+
+#endif /* FLATPAK_ERROR_H */
diff --git a/lib/flatpak-installation.c b/lib/flatpak-installation.c
new file mode 100644 (file)
index 0000000..d12f116
--- /dev/null
@@ -0,0 +1,2187 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#ifdef FLATPAK_ENABLE_P2P
+#include <ostree.h>
+#include <ostree-repo-finder-avahi.h>
+#endif  /* FLATPAK_ENABLE_P2P */
+
+#include "flatpak-utils.h"
+#include "flatpak-installation.h"
+#include "flatpak-installed-ref-private.h"
+#include "flatpak-related-ref-private.h"
+#include "flatpak-remote-private.h"
+#include "flatpak-remote-ref-private.h"
+#include "flatpak-enum-types.h"
+#include "flatpak-dir.h"
+#include "flatpak-run.h"
+#include "flatpak-error.h"
+
+/**
+ * SECTION:flatpak-installation
+ * @Title: FlatpakInstallation
+ * @Short_description: Installation information
+ *
+ * FlatpakInstallation is the toplevel object that software installers
+ * should use to operate on an flatpak applications.
+ *
+ * An FlatpakInstallation object provides information about an installation
+ * location for flatpak applications. Typical installation locations are either
+ * system-wide (in $prefix/var/lib/flatpak) or per-user (in ~/.local/share/flatpak).
+ *
+ * FlatpakInstallation can list configured remotes as well as installed application
+ * and runtime references (in short: refs). It can also run, install, update and
+ * uninstall applications and runtimes.
+ */
+
+typedef struct _FlatpakInstallationPrivate FlatpakInstallationPrivate;
+
+G_LOCK_DEFINE_STATIC (dir);
+
+struct _FlatpakInstallationPrivate
+{
+  /* All raw access to this should be protected by the dir lock. The FlatpakDir object is mostly
+     threadsafe (apart from pull transactions being a singleton on it), however we replace it during
+     flatpak_installation_drop_caches(), so every user needs to keep its own reference alive until
+     done. */
+  FlatpakDir *dir_unlocked;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakInstallation, flatpak_installation, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+};
+
+static void
+no_progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
+{
+}
+
+static void
+flatpak_installation_finalize (GObject *object)
+{
+  FlatpakInstallation *self = FLATPAK_INSTALLATION (object);
+  FlatpakInstallationPrivate *priv = flatpak_installation_get_instance_private (self);
+
+  g_object_unref (priv->dir_unlocked);
+
+  G_OBJECT_CLASS (flatpak_installation_parent_class)->finalize (object);
+}
+
+static void
+flatpak_installation_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_installation_get_property (GObject    *object,
+                                   guint       prop_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
+{
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_installation_class_init (FlatpakInstallationClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_installation_get_property;
+  object_class->set_property = flatpak_installation_set_property;
+  object_class->finalize = flatpak_installation_finalize;
+
+}
+
+static void
+flatpak_installation_init (FlatpakInstallation *self)
+{
+}
+
+static FlatpakInstallation *
+flatpak_installation_new_for_dir (FlatpakDir   *dir,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  FlatpakInstallation *self;
+  FlatpakInstallationPrivate *priv;
+
+  if (!flatpak_dir_ensure_repo (dir, NULL, error))
+    {
+      g_object_unref (dir);
+      return NULL;
+    }
+
+  self = g_object_new (FLATPAK_TYPE_INSTALLATION, NULL);
+  priv = flatpak_installation_get_instance_private (self);
+
+  priv->dir_unlocked = dir;
+
+  return self;
+}
+/**
+ * flatpak_get_default_arch:
+ *
+ * Returns the canonical name for the arch of the current machine.
+ *
+ * Returns: an arch string
+ */
+const char  *
+flatpak_get_default_arch (void)
+{
+  return flatpak_get_arch ();
+}
+
+/**
+ * flatpak_get_supported_arches:
+ *
+ * Returns the canonical names for the arches that are supported (i.e. can run)
+ * on the current machine, in order of priority (default is first).
+ *
+ * Returns: a zero terminated array of arch strings
+ */
+const char * const *
+flatpak_get_supported_arches (void)
+{
+  return (const char * const *)flatpak_get_arches ();
+}
+
+/**
+ * flatpak_get_system_installations:
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists the system installations according to the current configuration and current
+ * availability (e.g. doesn't return a configured installation if not reachable).
+ *
+ * Returns: (transfer container) (element-type FlatpakInstallation): an GPtrArray of
+ *   #FlatpakInstallation instances
+ *
+ * Since: 0.8
+ */
+GPtrArray *
+flatpak_get_system_installations (GCancellable *cancellable,
+                                  GError      **error)
+{
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  g_autoptr(GPtrArray) installs = NULL;
+  GPtrArray *ret = NULL;
+  int i;
+
+  system_dirs = flatpak_dir_get_system_list (cancellable, error);
+  if (system_dirs == NULL)
+    goto out;
+
+  installs = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+  for (i = 0; i < system_dirs->len; i++)
+    {
+      g_autoptr(GError) local_error = NULL;
+      FlatpakDir *install_dir = g_ptr_array_index (system_dirs, i);
+      g_autoptr(FlatpakInstallation) installation = NULL;
+
+      installation = flatpak_installation_new_for_dir (g_object_ref (install_dir),
+                                                       cancellable,
+                                                       &local_error);
+      if (installation != NULL)
+        g_ptr_array_add (installs, g_steal_pointer (&installation));
+      else
+        {
+          /* Warn about the problem and continue without listing this installation. */
+          g_warning ("Unable to create FlatpakInstallation for: %s", local_error->message);
+        }
+    }
+
+  if (installs->len == 0)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   "No system installations found");
+    }
+
+  ret = g_steal_pointer (&installs);
+
+ out:
+  return ret;
+}
+
+/**
+ * flatpak_installation_new_system:
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #FlatpakInstallation for the system-wide installation.
+ *
+ * Returns: (transfer full): a new #FlatpakInstallation
+ */
+FlatpakInstallation *
+flatpak_installation_new_system (GCancellable *cancellable,
+                                 GError      **error)
+{
+  return flatpak_installation_new_for_dir (flatpak_dir_get_system_default (), cancellable, error);
+}
+
+/**
+ * flatpak_installation_new_system_with_id:
+ * @id: (nullable): the ID of the system-wide installation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #FlatpakInstallation for the system-wide installation @id.
+ *
+ * Returns: (transfer full): a new #FlatpakInstallation
+ *
+ * Since: 0.8
+ */
+FlatpakInstallation *
+flatpak_installation_new_system_with_id (const char   *id,
+                                         GCancellable *cancellable,
+                                         GError      **error)
+{
+  g_autoptr(FlatpakDir) install_dir = NULL;
+  g_autoptr(FlatpakInstallation) installation = NULL;
+  g_autoptr(GError) local_error = NULL;
+
+  install_dir = flatpak_dir_get_system_by_id (id, cancellable, error);
+  if (install_dir == NULL)
+    return NULL;
+
+  installation = flatpak_installation_new_for_dir (g_object_ref (install_dir),
+                                                   cancellable,
+                                                   &local_error);
+  if (installation == NULL)
+    {
+      g_debug ("Error creating Flatpak installation: %s", local_error->message);
+      g_propagate_error (error, g_steal_pointer (&local_error));
+    }
+
+  g_debug ("Found Flatpak installation for '%s'", id);
+  return g_steal_pointer (&installation);
+}
+
+/**
+ * flatpak_installation_new_user:
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #FlatpakInstallation for the per-user installation.
+ *
+ * Returns: (transfer full): a new #FlatpakInstallation
+ */
+FlatpakInstallation *
+flatpak_installation_new_user (GCancellable *cancellable,
+                               GError      **error)
+{
+  flatpak_migrate_from_xdg_app ();
+
+  return flatpak_installation_new_for_dir (flatpak_dir_get_user (), cancellable, error);
+}
+
+/**
+ * flatpak_installation_new_for_path:
+ * @path: a #GFile
+ * @user: whether this is a user-specific location
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #FlatpakInstallation for the installation at the given @path.
+ *
+ * Returns: (transfer full): a new #FlatpakInstallation
+ */
+FlatpakInstallation *
+flatpak_installation_new_for_path (GFile *path, gboolean user,
+                                   GCancellable *cancellable,
+                                   GError **error)
+{
+  flatpak_migrate_from_xdg_app ();
+
+  return flatpak_installation_new_for_dir (flatpak_dir_new (path, user), cancellable, error);
+}
+
+static FlatpakDir *
+flatpak_installation_get_dir (FlatpakInstallation *self)
+{
+  FlatpakInstallationPrivate *priv = flatpak_installation_get_instance_private (self);
+  FlatpakDir *dir;
+  G_LOCK (dir);
+  dir = g_object_ref (priv->dir_unlocked);
+  G_UNLOCK (dir);
+  return dir;
+}
+
+/**
+ * flatpak_installation_drop_caches:
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Drops all internal (in-memory) caches. For instance, this may be needed to pick up new or changed
+ * remotes configured outside this installation instance.
+ *
+ * Returns: %TRUE on success, %FALSE on error
+ */
+gboolean
+flatpak_installation_drop_caches (FlatpakInstallation *self,
+                                  GCancellable *cancellable,
+                                  GError      **error)
+{
+  FlatpakInstallationPrivate *priv = flatpak_installation_get_instance_private (self);
+  FlatpakDir *clone, *old;
+  gboolean res = FALSE;
+
+  G_LOCK (dir);
+
+  old = priv->dir_unlocked;
+  clone = flatpak_dir_clone (priv->dir_unlocked);
+
+  if (flatpak_dir_ensure_repo (clone, cancellable, error))
+    {
+      priv->dir_unlocked = clone;
+      g_object_unref (old);
+      res = TRUE;
+    }
+
+  G_UNLOCK (dir);
+
+  return res;
+}
+
+/**
+ * flatpak_installation_get_is_user:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns whether the installation is for a user-specific location.
+ *
+ * Returns: %TRUE if @self is a per-user installation
+ */
+gboolean
+flatpak_installation_get_is_user (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_is_user (dir);
+}
+
+/**
+ * flatpak_installation_get_path:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns the installation location for @self.
+ *
+ * Returns: (transfer full): an #GFile
+ */
+GFile *
+flatpak_installation_get_path (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return g_object_ref (flatpak_dir_get_path (dir));
+}
+
+/**
+ * flatpak_installation_get_id:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns the ID of the system installation for @self.
+ *
+ * Returns: (transfer none): a string with the installation's ID
+ *
+ * Since: 0.8
+ */
+const char *
+flatpak_installation_get_id (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_get_id (dir);
+}
+
+/**
+ * flatpak_installation_get_display_name:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns the display name of the system installation for @self.
+ *
+ * Returns: (transfer none): a string with the installation's display name
+ *
+ * Since: 0.8
+ */
+const char *
+flatpak_installation_get_display_name (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_get_display_name (dir);
+}
+
+/**
+ * flatpak_installation_get_priority:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns the numeric priority of the system installation for @self.
+ *
+ * Returns: an integer with the configured priority value
+ *
+ * Since: 0.8
+ */
+gint
+flatpak_installation_get_priority (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_get_priority (dir);
+}
+
+/**
+ * flatpak_installation_get_storage_type:
+ * @self: a #FlatpakInstallation
+ *
+ * Returns the type of storage of the system installation for @self.
+ *
+ * Returns: a #FlatpakStorageType
+ *
+ * Since: 0.8
+ */FlatpakStorageType
+flatpak_installation_get_storage_type (FlatpakInstallation *self)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  switch (flatpak_dir_get_storage_type (dir))
+    {
+    case FLATPAK_DIR_STORAGE_TYPE_HARD_DISK:
+      return FLATPAK_STORAGE_TYPE_HARD_DISK;
+
+    case FLATPAK_DIR_STORAGE_TYPE_SDCARD:
+      return FLATPAK_STORAGE_TYPE_SDCARD;
+
+    case FLATPAK_DIR_STORAGE_TYPE_MMC:
+      return FLATPAK_STORAGE_TYPE_MMC;
+
+    default:
+      return FLATPAK_STORAGE_TYPE_DEFAULT;
+    }
+
+  return FLATPAK_STORAGE_TYPE_DEFAULT;
+}
+
+/**
+ * flatpak_installation_launch:
+ * @self: a #FlatpakInstallation
+ * @name: name of the app to launch
+ * @arch: (nullable): which architecture to launch (default: current architecture)
+ * @branch: (nullable): which branch of the application (default: "master")
+ * @commit: (nullable): the commit of @branch to launch
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Launch an installed application.
+ *
+ * You can use flatpak_installation_get_installed_ref() or
+ * flatpak_installation_get_current_installed_app() to find out what builds
+ * are available, in order to get a value for @commit.
+ *
+ * Returns: %TRUE, unless an error occurred
+ */
+gboolean
+flatpak_installation_launch (FlatpakInstallation *self,
+                             const char          *name,
+                             const char          *arch,
+                             const char          *branch,
+                             const char          *commit,
+                             GCancellable        *cancellable,
+                             GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *app_ref = NULL;
+
+  g_autoptr(FlatpakDeploy) app_deploy = NULL;
+
+  app_ref =
+    flatpak_build_app_ref (name, branch, arch);
+
+  app_deploy =
+    flatpak_dir_load_deployed (dir, app_ref,
+                               commit,
+                               cancellable, error);
+  if (app_deploy == NULL)
+    return FALSE;
+
+  return flatpak_run_app (app_ref,
+                          app_deploy,
+                          NULL, NULL,
+                          NULL,
+                          FLATPAK_RUN_FLAG_BACKGROUND,
+                          NULL,
+                          NULL, 0,
+                          cancellable, error);
+}
+
+
+static FlatpakInstalledRef *
+get_ref (FlatpakDir          *dir,
+         const char          *full_ref,
+         GCancellable        *cancellable,
+         GError **error)
+{
+  g_auto(GStrv) parts = NULL;
+  const char *origin = NULL;
+  const char *commit = NULL;
+  const char *alt_id = NULL;
+  g_autofree char *latest_alt_id = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(GFile) deploy_subdir = NULL;
+  g_autofree char *deploy_path = NULL;
+  g_autofree char *latest_commit = NULL;
+  g_autofree char *deploy_subdirname = NULL;
+  g_autoptr(GVariant) deploy_data = NULL;
+  g_autofree const char **subpaths = NULL;
+  gboolean is_current = FALSE;
+  guint64 installed_size = 0;
+
+  parts = g_strsplit (full_ref, "/", -1);
+
+  deploy_data = flatpak_dir_get_deploy_data (dir, full_ref, cancellable, error);
+  if (deploy_data == NULL)
+    return NULL;
+  origin = flatpak_deploy_data_get_origin (deploy_data);
+  commit = flatpak_deploy_data_get_commit (deploy_data);
+  alt_id = flatpak_deploy_data_get_alt_id (deploy_data);
+  subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
+  installed_size = flatpak_deploy_data_get_installed_size (deploy_data);
+
+  deploy_dir = flatpak_dir_get_deploy_dir (dir, full_ref);
+  deploy_subdirname = flatpak_dir_get_deploy_subdir (dir, commit, subpaths);
+  deploy_subdir = g_file_get_child (deploy_dir, deploy_subdirname);
+  deploy_path = g_file_get_path (deploy_subdir);
+
+  if (strcmp (parts[0], "app") == 0)
+    {
+      g_autofree char *current =
+        flatpak_dir_current_ref (dir, parts[1], cancellable);
+      if (current && strcmp (full_ref, current) == 0)
+        is_current = TRUE;
+    }
+
+  latest_commit = flatpak_dir_read_latest (dir, origin, full_ref, &latest_alt_id, NULL, NULL);
+
+  return flatpak_installed_ref_new (full_ref,
+                                    alt_id ? alt_id : commit,
+                                    latest_alt_id ? latest_alt_id : latest_commit,
+                                    origin, subpaths,
+                                    deploy_path,
+                                    installed_size,
+                                    is_current);
+}
+
+/**
+ * flatpak_installation_get_installed_ref:
+ * @self: a #FlatpakInstallation
+ * @kind: whether this is an app or runtime
+ * @name: name of the app/runtime to fetch
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ * @branch: (nullable): which branch to fetch (default: "master")
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Returns information about an installed ref, such as the available builds,
+ * its size, location, etc.
+ *
+ * Returns: (transfer full): an #FlatpakInstalledRef, or %NULL if an error occurred
+ */
+FlatpakInstalledRef *
+flatpak_installation_get_installed_ref (FlatpakInstallation *self,
+                                        FlatpakRefKind       kind,
+                                        const char          *name,
+                                        const char          *arch,
+                                        const char          *branch,
+                                        GCancellable        *cancellable,
+                                        GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  g_autoptr(GFile) deploy = NULL;
+  g_autofree char *ref = NULL;
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  if (kind == FLATPAK_REF_KIND_APP)
+    ref = flatpak_build_app_ref (name, branch, arch);
+  else
+    ref = flatpak_build_runtime_ref (name, branch, arch);
+
+
+  deploy = flatpak_dir_get_if_deployed (dir,
+                                        ref, NULL, cancellable);
+  if (deploy == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   "Ref %s not installed", ref);
+      return NULL;
+    }
+
+  return get_ref (dir, ref, cancellable, error);
+}
+
+/**
+ * flatpak_installation_get_current_installed_app:
+ * @self: a #FlatpakInstallation
+ * @name: the name of the app
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Get the last build of reference @name that was installed with
+ * flatpak_installation_install(), or %NULL if the reference has
+ * never been installed locally.
+ *
+ * Returns: (transfer full): an #FlatpakInstalledRef
+ */
+FlatpakInstalledRef *
+flatpak_installation_get_current_installed_app (FlatpakInstallation *self,
+                                                const char          *name,
+                                                GCancellable        *cancellable,
+                                                GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  g_autoptr(GFile) deploy = NULL;
+  g_autofree char *current =
+    flatpak_dir_current_ref (dir, name, cancellable);
+
+  if (current)
+    deploy = flatpak_dir_get_if_deployed (dir,
+                                          current, NULL, cancellable);
+
+  if (deploy == NULL)
+    {
+      g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   "App %s not installed", name);
+      return NULL;
+    }
+
+  return get_ref (dir, current, cancellable, error);
+}
+
+/**
+ * flatpak_installation_list_installed_refs:
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists the installed references.
+ *
+ * Returns: (transfer container) (element-type FlatpakInstalledRef): an GPtrArray of
+ *   #FlatpakInstalledRef instances
+ */
+GPtrArray *
+flatpak_installation_list_installed_refs (FlatpakInstallation *self,
+                                          GCancellable        *cancellable,
+                                          GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_auto(GStrv) raw_refs_app = NULL;
+  g_auto(GStrv) raw_refs_runtime = NULL;
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_object_unref);
+  int i;
+
+  if (!flatpak_dir_list_refs (dir,
+                              "app",
+                              &raw_refs_app,
+                              cancellable, error))
+    return NULL;
+
+  for (i = 0; raw_refs_app[i] != NULL; i++)
+    {
+      g_autoptr(GError) local_error = NULL;
+      FlatpakInstalledRef *ref = get_ref (dir, raw_refs_app[i], cancellable, &local_error);
+      if (ref != NULL)
+        g_ptr_array_add (refs, ref);
+      else
+        g_warning ("Unexpected failure getting ref for %s: %s", raw_refs_app[i], local_error->message);
+    }
+
+  if (!flatpak_dir_list_refs (dir,
+                              "runtime",
+                              &raw_refs_runtime,
+                              cancellable, error))
+    return NULL;
+
+  for (i = 0; raw_refs_runtime[i] != NULL; i++)
+    {
+      g_autoptr(GError) local_error = NULL;
+      FlatpakInstalledRef *ref = get_ref (dir, raw_refs_runtime[i], cancellable, &local_error);
+      if (ref != NULL)
+        g_ptr_array_add (refs, ref);
+      else
+        g_warning ("Unexpected failure getting ref for %s: %s", raw_refs_runtime[i], local_error->message);
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/**
+ * flatpak_installation_list_installed_refs_by_kind:
+ * @self: a #FlatpakInstallation
+ * @kind: the kind of installation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists the installed references of a specific kind.
+ *
+ * Returns: (transfer container) (element-type FlatpakInstalledRef): an GPtrArray of
+ *   #FlatpakInstalledRef instances
+ */
+GPtrArray *
+flatpak_installation_list_installed_refs_by_kind (FlatpakInstallation *self,
+                                                  FlatpakRefKind       kind,
+                                                  GCancellable        *cancellable,
+                                                  GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_auto(GStrv) raw_refs = NULL;
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_object_unref);
+  int i;
+
+  if (!flatpak_dir_list_refs (dir,
+                              kind == FLATPAK_REF_KIND_APP ? "app" : "runtime",
+                              &raw_refs,
+                              cancellable, error))
+    return NULL;
+
+  for (i = 0; raw_refs[i] != NULL; i++)
+    {
+      g_autoptr(GError) local_error = NULL;
+      FlatpakInstalledRef *ref = get_ref (dir, raw_refs[i], cancellable, &local_error);
+      if (ref != NULL)
+        g_ptr_array_add (refs, ref);
+      else
+        g_warning ("Unexpected failure getting ref for %s: %s", raw_refs[i], local_error->message);
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/**
+ * flatpak_installation_list_installed_refs_for_update:
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists the installed references that has a remote update that is not
+ * locally available. However, even though an app is not returned by this
+ * it can have local updates available that has not been deployed. Look
+ * at commit vs latest_commit on installed apps for this.
+ *
+ * Returns: (transfer container) (element-type FlatpakInstalledRef): an GPtrArray of
+ *   #FlatpakInstalledRef instances
+ */
+GPtrArray *
+flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
+                                                     GCancellable        *cancellable,
+                                                     GError             **error)
+{
+  g_autoptr(GPtrArray) updates = NULL;
+  g_autoptr(GPtrArray) installed = NULL;
+  g_autoptr(GPtrArray) remotes = NULL;
+  g_autoptr(GHashTable) ht = NULL;
+  int i, j;
+
+  ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  remotes = flatpak_installation_list_remotes (self, cancellable, error);
+  if (remotes == NULL)
+    return NULL;
+
+  for (i = 0; i < remotes->len; i++)
+    {
+      FlatpakRemote *remote = g_ptr_array_index (remotes, i);
+      g_autoptr(GPtrArray) refs = NULL;
+      g_autoptr(GError) local_error = NULL;
+
+      if (flatpak_remote_get_disabled (remote))
+        continue;
+
+      /* We ignore errors here. we don't want one remote to fail us */
+      refs = flatpak_installation_list_remote_refs_sync (self,
+                                                         flatpak_remote_get_name (remote),
+                                                         cancellable, &local_error);
+      if (refs != NULL)
+        {
+          for (j = 0; j < refs->len; j++)
+            {
+              FlatpakRemoteRef *remote_ref = g_ptr_array_index (refs, j);
+              g_autofree char *full_ref = flatpak_ref_format_ref (FLATPAK_REF (remote_ref));
+              g_autofree char *key = g_strdup_printf ("%s:%s", flatpak_remote_get_name (remote),
+                                                      full_ref);
+
+              g_hash_table_insert (ht, g_steal_pointer (&key),
+                                   g_strdup (flatpak_ref_get_commit (FLATPAK_REF (remote_ref))));
+            }
+        }
+      else
+        {
+          g_debug ("Update: Failed to read remote %s: %s",
+                   flatpak_remote_get_name (remote),
+                   local_error->message);
+        }
+    }
+
+  installed = flatpak_installation_list_installed_refs (self, cancellable, error);
+  if (installed == NULL)
+    return NULL;
+
+  updates = g_ptr_array_new_with_free_func (g_object_unref);
+
+  for (i = 0; i < installed->len; i++)
+    {
+      FlatpakInstalledRef *installed_ref = g_ptr_array_index (installed, i);
+      g_autofree char *full_ref = flatpak_ref_format_ref (FLATPAK_REF (installed_ref));
+      g_autofree char *key = g_strdup_printf ("%s:%s", flatpak_installed_ref_get_origin (installed_ref),
+                                              full_ref);
+      const char *remote_ref = g_hash_table_lookup (ht, key);
+
+      if (remote_ref != NULL &&
+          g_strcmp0 (remote_ref,
+                     flatpak_installed_ref_get_latest_commit (installed_ref)) != 0)
+        g_ptr_array_add (updates, g_object_ref (installed_ref));
+    }
+
+  return g_steal_pointer (&updates);
+}
+
+#ifdef FLATPAK_ENABLE_P2P
+static void
+async_result_cb (GObject      *obj,
+                 GAsyncResult *result,
+                 gpointer      user_data)
+{
+  GAsyncResult **result_out = user_data;
+  *result_out = g_object_ref (result);
+}
+#endif  /* FLATPAK_ENABLE_P2P */
+
+/* Find all USB and LAN repositories which share the same collection ID as
+ * @remote_name, and add a #FlatpakRemote to @remotes for each of them. The caller
+ * must initialise @remotes. Returns %TRUE without modifying @remotes if the
+ * given remote doesn’t have a collection ID configured.
+ *
+ * FIXME: If this were async, the parallelisation could be handled in the caller. */
+static gboolean
+list_remotes_for_configured_remote (FlatpakInstallation  *self,
+                                    const gchar          *remote_name,
+                                    FlatpakDir           *dir,
+                                    GPtrArray            *remotes  /* (element-type FlatpakRemote) */,
+                                    GCancellable         *cancellable,
+                                    GError              **error)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  g_autofree gchar *collection_id = NULL;
+  OstreeCollectionRef ref;
+  const OstreeCollectionRef *refs[2] = { NULL, };
+  g_autofree gchar *appstream_ref = NULL;
+  g_autoptr(GMainContext) context = NULL;
+  g_auto(OstreeRepoFinderResultv) results = NULL;
+  g_autoptr(GAsyncResult) result = NULL;
+  g_autoptr(OstreeRepoFinder) finder_mount = NULL, finder_avahi = NULL;
+  OstreeRepoFinder *finders[3] = { NULL, };
+  gsize i;
+
+  /* Find the collection ID for @remote_name, or bail if there is none. */
+  if (!ostree_repo_get_remote_option (flatpak_dir_get_repo (dir),
+                                      remote_name, "collection-id",
+                                      NULL, &collection_id, error))
+    return FALSE;
+  if (collection_id == NULL || *collection_id == '\0')
+    return TRUE;
+
+  context = g_main_context_new ();
+  g_main_context_push_thread_default (context);
+
+  appstream_ref = g_strdup_printf ("appstream/%s", flatpak_get_arch ());
+  ref.collection_id = collection_id;
+  ref.ref_name = appstream_ref;
+  refs[0] = &ref;
+
+  finder_mount = OSTREE_REPO_FINDER (ostree_repo_finder_mount_new (NULL));
+  finder_avahi = OSTREE_REPO_FINDER (ostree_repo_finder_avahi_new (context));
+  finders[0] = finder_mount;
+  finders[1] = finder_avahi;
+
+  ostree_repo_finder_avahi_start (OSTREE_REPO_FINDER_AVAHI (finder_avahi), NULL);  /* ignore failure */
+  ostree_repo_find_remotes_async (flatpak_dir_get_repo (dir),
+                                  (const OstreeCollectionRef * const *) refs,
+                                  NULL,  /* no options */
+                                  finders,
+                                  NULL,  /* no progress */
+                                  cancellable,
+                                  async_result_cb,
+                                  &result);
+
+  while (result == NULL)
+    g_main_context_iteration (context, TRUE);
+
+  results = ostree_repo_find_remotes_finish (flatpak_dir_get_repo (dir), result, error);
+  ostree_repo_finder_avahi_stop (OSTREE_REPO_FINDER_AVAHI (finder_avahi));
+
+  g_main_context_pop_thread_default (context);
+
+  for (i = 0; results != NULL && results[i] != NULL; i++)
+    {
+      g_ptr_array_add (remotes,
+                       flatpak_remote_new_from_ostree (results[i]->remote,
+                                                       results[i]->finder,
+                                                       dir));
+    }
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_list_remotes:
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists the remotes, in priority (highest first) order. For same priority,
+ * an earlier added remote comes before a later added one.
+ *
+ * Returns: (transfer container) (element-type FlatpakRemote): an GPtrArray of
+ *   #FlatpakRemote instances
+ */
+GPtrArray *
+flatpak_installation_list_remotes (FlatpakInstallation *self,
+                                   GCancellable        *cancellable,
+                                   GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_auto(GStrv) remote_names = NULL;
+  g_autoptr(GPtrArray) remotes = g_ptr_array_new_with_free_func (g_object_unref);
+  gsize i;
+
+  remote_names = flatpak_dir_list_remotes (dir, cancellable, error);
+  if (remote_names == NULL)
+    return NULL;
+
+  /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+     it has local changes */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return NULL;
+
+  for (i = 0; remote_names[i] != NULL; i++)
+    {
+      g_ptr_array_add (remotes,
+                       flatpak_remote_new_with_dir (remote_names[i], dir_clone));
+
+      /* Add the dynamic mirrors of this remote. */
+      if (!list_remotes_for_configured_remote (self, remote_names[i], dir_clone,
+                                               remotes, cancellable, error))
+        return NULL;
+    }
+
+  return g_steal_pointer (&remotes);
+}
+
+/**
+ * flatpak_installation_modify_remote:
+ * @self: a #FlatpakInstallation
+ * @remote: the modified #FlatpakRemote
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Saves changes in the @remote object.
+ *
+ * Returns: %TRUE if the modifications have been committed successfully
+ */
+gboolean
+flatpak_installation_modify_remote (FlatpakInstallation *self,
+                                    FlatpakRemote       *remote,
+                                    GCancellable        *cancellable,
+                                    GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+
+  /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+     it has local changes */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_remote_commit (remote, dir_clone, cancellable, error))
+    return FALSE;
+
+  /* Make sure we pick up the new config */
+  flatpak_installation_drop_caches (self, NULL, NULL);
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_remove_remote:
+ * @self: a #FlatpakInstallation
+ * @name: the name of the remote to remove
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Removes the remote with the given name from the installation.
+ *
+ * Returns: %TRUE if the remote has been removed successfully
+ */
+gboolean
+flatpak_installation_remove_remote (FlatpakInstallation *self,
+                                    const char          *name,
+                                    GCancellable        *cancellable,
+                                    GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+
+  /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+     it has local changes */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_remove_remote (dir, FALSE, name,
+                                  cancellable, error))
+    return FALSE;
+
+  /* Make sure we pick up the new config */
+  flatpak_installation_drop_caches (self, NULL, NULL);
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_set_config_sync:
+ * @self: a #FlatpakInstallation
+ * @key: the name of the key to set
+ * @value: the new value, or %NULL to unset
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Set a global configuration option for the installation, currently
+ * the only supported key is "languages", which is a comman-separated
+ * list of langue codes like "sv;en;pl", or "" to mean all languages.
+ *
+ * Returns: %TRUE if the option was set correctly
+ */
+gboolean
+flatpak_installation_set_config_sync (FlatpakInstallation *self,
+                                     const char          *key,
+                                     const char          *value,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+
+  /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+     it has local changes */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_set_config (dir, key, value, error))
+    return FALSE;
+
+  /* Make sure we pick up the new config */
+  flatpak_installation_drop_caches (self, NULL, NULL);
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_get_config:
+ * @self: a #FlatpakInstallation
+ * @key: the name of the key to get
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Get a global configuration option for the remote, see
+ * flatpak_installation_set_config_sync() for supported keys.
+ *
+ * Returns: The (newly allocated) value, or %NULL on error (%G_KEY_FILE_ERROR_KEY_NOT_FOUND error if key is not set)
+ */
+char *
+flatpak_installation_get_config (FlatpakInstallation *self,
+                                const char          *key,
+                                GCancellable        *cancellable,
+                                GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_get_config (dir, key, error);
+}
+
+/**
+ * flatpak_installation_update_remote_sync:
+ * @self: a #FlatpakInstallation
+ * @name: the name of the remote to update
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Updates the local configuration of a remote repository by fetching
+ * the related information from the summary file in the remote OSTree
+ * repository and committing the changes to the local installation.
+ *
+ * Returns: %TRUE if the remote has been updated successfully
+ *
+ * Since: 0.6.13
+ */
+gboolean
+flatpak_installation_update_remote_sync (FlatpakInstallation *self,
+                                         const char          *name,
+                                         GCancellable        *cancellable,
+                                         GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+
+  /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+     it has local changes */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_update_remote_configuration (dir, name, cancellable, error))
+    return FALSE;
+
+  /* Make sure we pick up the new config */
+  flatpak_installation_drop_caches (self, NULL, NULL);
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_get_remote_by_name:
+ * @self: a #FlatpakInstallation
+ * @name: a remote name
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Looks up a remote by name.
+ *
+ * Returns: (transfer full): a #FlatpakRemote instances, or %NULL error
+ */
+FlatpakRemote *
+flatpak_installation_get_remote_by_name (FlatpakInstallation *self,
+                                         const gchar         *name,
+                                         GCancellable        *cancellable,
+                                         GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_auto(GStrv) remote_names = NULL;
+  int i;
+
+  remote_names = flatpak_dir_list_remotes (dir, cancellable, error);
+  if (remote_names == NULL)
+    return NULL;
+
+  for (i = 0; remote_names[i] != NULL; i++)
+    {
+      if (strcmp (remote_names[i], name) == 0)
+        {
+          /* We clone the dir here to make sure we re-read the latest ostree repo config, in case
+             it has local changes */
+          dir_clone = flatpak_dir_clone (dir);
+          if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+            return NULL;
+          return flatpak_remote_new_with_dir (remote_names[i], dir_clone);
+        }
+    }
+
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+               "No remote named '%s'", name);
+  return NULL;
+}
+
+/**
+ * flatpak_installation_load_app_overrides:
+ * @self: a #FlatpakInstallation
+ * @app_id: an application id
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Loads the metadata overrides file for an application.
+ *
+ * Returns: (transfer full): the contents of the overrides files,
+ *    or %NULL if an error occurred
+ */
+char *
+flatpak_installation_load_app_overrides (FlatpakInstallation *self,
+                                         const char          *app_id,
+                                         GCancellable        *cancellable,
+                                         GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *metadata_contents = NULL;
+  gsize metadata_size;
+
+  metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, error);
+  if (metadata_contents == NULL)
+    return NULL;
+
+  return metadata_contents;
+}
+
+/**
+ * flatpak_installation_install_bundle:
+ * @self: a #FlatpakInstallation
+ * @file: a #GFile that is an flatpak bundle
+ * @progress: (scope call) (nullable): progress callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Install an application or runtime from an flatpak bundle file.
+ * See flatpak-build-bundle(1) for how to create bundles.
+ *
+ * Returns: (transfer full): The ref for the newly installed app or %NULL on failure
+ */
+FlatpakInstalledRef *
+flatpak_installation_install_bundle (FlatpakInstallation    *self,
+                                     GFile                  *file,
+                                     FlatpakProgressCallback progress,
+                                     gpointer                progress_data,
+                                     GCancellable           *cancellable,
+                                     GError                **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_autofree char *ref = NULL;
+  g_autofree char *remote = NULL;
+  FlatpakInstalledRef *result = NULL;
+
+  remote = flatpak_dir_ensure_bundle_remote (dir, file, NULL, &ref, NULL, NULL, cancellable, error);
+  if (remote == NULL)
+    return NULL;
+
+  /* Make sure we pick up the new config */
+  flatpak_installation_drop_caches (self, NULL, NULL);
+
+  /* Pull, prune, etc are not threadsafe, so we work on a copy */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return NULL;
+
+  if (!flatpak_dir_install_bundle (dir_clone, file, remote, NULL,
+                                   cancellable, error))
+    return NULL;
+
+  result = get_ref (dir, ref, cancellable, error);
+  if (result == NULL)
+    return NULL;
+
+  return result;
+}
+
+/**
+ * flatpak_installation_install_ref_file:
+ * @self: a #FlatpakInstallation
+ * @ref_file_data: The ref file contents
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a remote based on the passed in .flatpakref file contents
+ * in @ref_file_data and returns the #FlatpakRemoteRef that can be used
+ * to install it.
+ *
+ * Note, the #FlatpakRemoteRef will not have the commit field set, to
+ * avoid unnecessary roundtrips. If you need that you have to resolve it
+ * explicitly with flatpak_installation_fetch_remote_ref_sync ().
+ *
+ * Returns: (transfer full): a #FlatpakRemoteRef if the remote has been added successfully, %NULL
+ * on error.
+ *
+ * Since: 0.6.10
+ */
+FlatpakRemoteRef *
+flatpak_installation_install_ref_file (FlatpakInstallation *self,
+                                       GBytes              *ref_file_data,
+                                       GCancellable        *cancellable,
+                                       GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *remote = NULL;
+  g_autofree char *ref = NULL;
+
+  if (!flatpak_dir_create_remote_for_ref_file (dir, ref_file_data, NULL, &remote, &ref, error))
+    return NULL;
+
+  if (!flatpak_installation_drop_caches (self, cancellable, error))
+    return NULL;
+
+  return flatpak_remote_ref_new (ref, NULL, remote);
+}
+
+/**
+ * flatpak_installation_install_full:
+ * @self: a #FlatpakInstallation
+ * @flags: set of #FlatpakInstallFlags flag
+ * @remote_name: name of the remote to use
+ * @kind: what this ref contains (an #FlatpakRefKind)
+ * @name: name of the app/runtime to fetch
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ * @branch: (nullable): which branch to fetch (default: 'master')
+ * @subpaths: (nullable): A list of subpaths to fetch, or %NULL for everything
+ * @progress: (scope call) (nullable): progress callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Install a new application or runtime.
+ *
+ * Note that this function was originally written to always return a
+ * #FlatpakInstalledRef. Since 0.9.13, passing
+ * FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak
+ * repository without deploying them, however this function will
+ * be unable to provide information on the installed ref, so
+ * FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond
+ * accordingly.
+ *
+ * Returns: (transfer full): The ref for the newly installed app or %NULL on failure
+ */
+FlatpakInstalledRef *
+flatpak_installation_install_full (FlatpakInstallation    *self,
+                                   FlatpakInstallFlags     flags,
+                                   const char             *remote_name,
+                                   FlatpakRefKind          kind,
+                                   const char             *name,
+                                   const char             *arch,
+                                   const char             *branch,
+                                   const char * const     *subpaths,
+                                   FlatpakProgressCallback progress,
+                                   gpointer                progress_data,
+                                   GCancellable           *cancellable,
+                                   GError                **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *ref = NULL;
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_autoptr(GMainContext) main_context = NULL;
+  g_autoptr(OstreeAsyncProgress) ostree_progress = NULL;
+  FlatpakInstalledRef *result = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+
+  ref = flatpak_compose_ref (kind == FLATPAK_REF_KIND_APP, name, branch, arch, error);
+  if (ref == NULL)
+    return NULL;
+
+  deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable);
+  if (deploy_dir != NULL)
+    {
+      g_set_error (error,
+                   FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                   "%s branch %s already installed", name, branch ? branch : "master");
+      return NULL;
+    }
+
+  /* Pull, prune, etc are not threadsafe, so we work on a copy */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return NULL;
+
+  /* Work around ostree-pull spinning the default main context for the sync calls */
+  main_context = g_main_context_new ();
+  g_main_context_push_thread_default (main_context);
+
+  if (progress)
+    ostree_progress = flatpak_progress_new (progress, progress_data);
+  else
+    ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+
+  if (!flatpak_dir_install (dir_clone,
+                            (flags & FLATPAK_INSTALL_FLAGS_NO_PULL) != 0,
+                            (flags & FLATPAK_INSTALL_FLAGS_NO_DEPLOY) != 0,
+                            (flags & FLATPAK_INSTALL_FLAGS_NO_STATIC_DELTAS) != 0,
+                            FALSE,
+                            ref, remote_name, (const char **)subpaths,
+                            ostree_progress, cancellable, error))
+    goto out;
+
+  /* Note that if the caller sets FLATPAK_INSTALL_FLAGS_NO_DEPLOY we must
+   * always return an error, as explained above. Otherwise get_ref will
+   * always return an error. */
+  if ((flags & FLATPAK_INSTALL_FLAGS_NO_DEPLOY) != 0)
+    {
+      g_set_error (error,
+                   FLATPAK_ERROR, FLATPAK_ERROR_ONLY_PULLED,
+                   "As requested, %s was only pulled, but not installed",
+                   name);
+      goto out;
+    }
+
+  result = get_ref (dir, ref, cancellable, error);
+  if (result == NULL)
+    goto out;
+
+out:
+  if (main_context)
+    g_main_context_pop_thread_default (main_context);
+
+  if (ostree_progress)
+    ostree_async_progress_finish (ostree_progress);
+
+  return result;
+}
+
+/**
+ * flatpak_installation_install:
+ * @self: a #FlatpakInstallation
+ * @remote_name: name of the remote to use
+ * @kind: what this ref contains (an #FlatpakRefKind)
+ * @name: name of the app/runtime to fetch
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ * @branch: (nullable): which branch to fetch (default: 'master')
+ * @progress: (scope call) (nullable): progress callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Install a new application or runtime.
+ *
+ * Note that this function was originally written to always return a
+ * #FlatpakInstalledRef. Since 0.9.13, passing
+ * FLATPAK_INSTALL_FLAGS_NO_DEPLOY will only pull refs into the local flatpak
+ * repository without deploying them, however this function will
+ * be unable to provide information on the installed ref, so
+ * FLATPAK_ERROR_ONLY_PULLED will be set and the caller must respond
+ * accordingly.
+ *
+ * Returns: (transfer full): The ref for the newly installed app or %NULL on failure
+ */
+FlatpakInstalledRef *
+flatpak_installation_install (FlatpakInstallation    *self,
+                              const char             *remote_name,
+                              FlatpakRefKind          kind,
+                              const char             *name,
+                              const char             *arch,
+                              const char             *branch,
+                              FlatpakProgressCallback progress,
+                              gpointer                progress_data,
+                              GCancellable           *cancellable,
+                              GError                **error)
+{
+  return flatpak_installation_install_full (self, FLATPAK_INSTALL_FLAGS_NONE,
+                                            remote_name, kind, name, arch, branch,
+                                            NULL, progress, progress_data,
+                                            cancellable, error);
+}
+
+/**
+ * flatpak_installation_update_full:
+ * @self: a #FlatpakInstallation
+ * @flags: set of #FlatpakUpdateFlags flag
+ * @kind: whether this is an app or runtime
+ * @name: name of the app or runtime to update
+ * @arch: (nullable): architecture of the app or runtime to update (default: current architecture)
+ * @branch: (nullable): name of the branch of the app or runtime to update (default: master)
+ * @subpaths: (nullable): A list of subpaths to fetch, or %NULL for everything
+ * @progress: (scope call) (nullable): the callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Update an application or runtime.
+ *
+ * Returns: (transfer full): The ref for the newly updated app (or the same if no update) or %NULL on failure
+ */
+FlatpakInstalledRef *
+flatpak_installation_update_full (FlatpakInstallation    *self,
+                                  FlatpakUpdateFlags      flags,
+                                  FlatpakRefKind          kind,
+                                  const char             *name,
+                                  const char             *arch,
+                                  const char             *branch,
+                                  const char * const     *subpaths,
+                                  FlatpakProgressCallback progress,
+                                  gpointer                progress_data,
+                                  GCancellable           *cancellable,
+                                  GError                **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *ref = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_autoptr(GMainContext) main_context = NULL;
+  g_autoptr(OstreeAsyncProgress) ostree_progress = NULL;
+  g_autofree char *remote_name = NULL;
+  FlatpakInstalledRef *result = NULL;
+  g_autofree char *target_commit = NULL;
+  g_auto(OstreeRepoFinderResultv) check_results = NULL;
+
+  ref = flatpak_compose_ref (kind == FLATPAK_REF_KIND_APP, name, branch, arch, error);
+  if (ref == NULL)
+    return NULL;
+
+  deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable);
+  if (deploy_dir == NULL)
+    {
+      g_set_error (error,
+                   FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
+                   "%s branch %s is not installed", name, branch ? branch : "master");
+      return NULL;
+    }
+
+  remote_name = flatpak_dir_get_origin (dir, ref, cancellable, error);
+  if (remote_name == NULL)
+    return NULL;
+
+  target_commit = flatpak_dir_check_for_update (dir, ref, remote_name, NULL,
+                                                (const char **)subpaths,
+                                                (flags & FLATPAK_UPDATE_FLAGS_NO_PULL) != 0,
+                                                &check_results,
+                                                cancellable, error);
+  if (target_commit == NULL)
+    return NULL;
+
+  /* Pull, prune, etc are not threadsafe, so we work on a copy */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return NULL;
+
+  /* Work around ostree-pull spinning the default main context for the sync calls */
+  main_context = g_main_context_new ();
+  g_main_context_push_thread_default (main_context);
+
+  if (progress)
+    ostree_progress = flatpak_progress_new (progress, progress_data);
+  else
+    ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+
+  if (!flatpak_dir_update (dir_clone,
+                           (flags & FLATPAK_UPDATE_FLAGS_NO_PULL) != 0,
+                           (flags & FLATPAK_UPDATE_FLAGS_NO_DEPLOY) != 0,
+                           (flags & FLATPAK_UPDATE_FLAGS_NO_STATIC_DELTAS) != 0,
+                           FALSE,
+                           ref, remote_name, target_commit,
+                           (const OstreeRepoFinderResult * const *) check_results,
+                           (const char **)subpaths,
+                           ostree_progress, cancellable, error))
+    goto out;
+
+  result = get_ref (dir, ref, cancellable, error);
+  if (result == NULL)
+    goto out;
+
+out:
+  if (main_context)
+    g_main_context_pop_thread_default (main_context);
+
+  if (ostree_progress)
+    ostree_async_progress_finish (ostree_progress);
+
+  return result;
+}
+
+/**
+ * flatpak_installation_update:
+ * @self: a #FlatpakInstallation
+ * @flags: set of #FlatpakUpdateFlags flag
+ * @kind: whether this is an app or runtime
+ * @name: name of the app or runtime to update
+ * @arch: (nullable): architecture of the app or runtime to update (default: current architecture)
+ * @branch: (nullable): name of the branch of the app or runtime to update (default: master)
+ * @progress: (scope call) (nullable): the callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Update an application or runtime.
+ *
+ * Returns: (transfer full): The ref for the newly updated app (or the same if no update) or %NULL on failure
+ */
+FlatpakInstalledRef *
+flatpak_installation_update (FlatpakInstallation    *self,
+                             FlatpakUpdateFlags      flags,
+                             FlatpakRefKind          kind,
+                             const char             *name,
+                             const char             *arch,
+                             const char             *branch,
+                             FlatpakProgressCallback progress,
+                             gpointer                progress_data,
+                             GCancellable           *cancellable,
+                             GError                **error)
+{
+  return flatpak_installation_update_full (self, flags, kind, name, arch,
+                                           branch, NULL, progress, progress_data,
+                                           cancellable, error);
+}
+
+/**
+ * flatpak_installation_uninstall:
+ * @self: a #FlatpakInstallation
+ * @kind: what this ref contains (an #FlatpakRefKind)
+ * @name: name of the app or runtime to uninstall
+ * @arch: architecture of the app or runtime to uninstall
+ * @branch: name of the branch of the app or runtime to uninstall
+ * @progress: (scope call) (nullable): the callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Uninstall an application or runtime.
+ *
+ * Returns: %TRUE on success
+ */
+FLATPAK_EXTERN gboolean
+flatpak_installation_uninstall (FlatpakInstallation    *self,
+                                FlatpakRefKind          kind,
+                                const char             *name,
+                                const char             *arch,
+                                const char             *branch,
+                                FlatpakProgressCallback progress,
+                                gpointer                progress_data,
+                                GCancellable           *cancellable,
+                                GError                **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *ref = NULL;
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+
+  ref = flatpak_compose_ref (kind == FLATPAK_REF_KIND_APP, name, branch, arch, error);
+  if (ref == NULL)
+    return FALSE;
+
+  /* prune, etc are not threadsafe, so we work on a copy */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  if (!flatpak_dir_uninstall (dir_clone, ref, FLATPAK_HELPER_UNINSTALL_FLAGS_NONE,
+                              cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+/**
+ * flatpak_installation_fetch_remote_size_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @ref: the ref
+ * @download_size: (out): return location for the (maximum) download size
+ * @installed_size: (out): return location for the installed size
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Gets information about the maximum amount of data that needs to be transferred
+ * to pull the ref from a remote repository, and about the amount of
+ * local disk space that is required to check out this commit.
+ *
+ * Note that if there are locally available data that are in the ref, which is common
+ * for instance if you're doing an update then the real download size may be smaller
+ * than what is returned here.
+ *
+ * Returns: %TRUE, unless an error occurred
+ */
+gboolean
+flatpak_installation_fetch_remote_size_sync (FlatpakInstallation *self,
+                                             const char          *remote_name,
+                                             FlatpakRef          *ref,
+                                             guint64             *download_size,
+                                             guint64             *installed_size,
+                                             GCancellable        *cancellable,
+                                             GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *full_ref = flatpak_ref_format_ref (ref);
+
+  return flatpak_dir_fetch_ref_cache (dir, remote_name, full_ref,
+                                      download_size, installed_size,
+                                      NULL,
+                                      cancellable,
+                                      error);
+}
+
+/**
+ * flatpak_installation_fetch_remote_metadata_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @ref: the ref
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Obtains the metadata file from a commit.
+ *
+ * Returns: (transfer full): a #GBytes containing the flatpak metadata file,
+ *   or %NULL if an error occurred
+ */
+GBytes *
+flatpak_installation_fetch_remote_metadata_sync (FlatpakInstallation *self,
+                                                 const char          *remote_name,
+                                                 FlatpakRef          *ref,
+                                                 GCancellable        *cancellable,
+                                                 GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autofree char *full_ref = flatpak_ref_format_ref (ref);
+  char *res = NULL;
+
+  if (!flatpak_dir_fetch_ref_cache (dir, remote_name, full_ref,
+                                    NULL, NULL,
+                                    &res,
+                                    cancellable, error))
+    return NULL;
+
+  return g_bytes_new_take (res, strlen (res));
+}
+
+/**
+ * flatpak_installation_list_remote_refs_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists all the applications and runtimes in a remote.
+ *
+ * Returns: (transfer container) (element-type FlatpakRemoteRef): an GPtrArray of
+ *   #FlatpakRemoteRef instances
+ */
+GPtrArray *
+flatpak_installation_list_remote_refs_sync (FlatpakInstallation *self,
+                                            const char          *remote_name,
+                                            GCancellable        *cancellable,
+                                            GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_object_unref);
+  g_autoptr(GHashTable) ht = NULL;
+  GHashTableIter iter;
+  gpointer key;
+  gpointer value;
+
+  if (!flatpak_dir_list_remote_refs (dir,
+                                     remote_name,
+                                     &ht,
+                                     cancellable,
+                                     error))
+    return NULL;
+
+  g_hash_table_iter_init (&iter, ht);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      const char *refspec = key;
+      const char *checksum = value;
+      FlatpakRemoteRef *ref;
+
+      ref = flatpak_remote_ref_new (refspec, checksum, remote_name);
+
+      if (ref)
+        g_ptr_array_add (refs, ref);
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/**
+ * flatpak_installation_fetch_remote_ref_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @kind: what this ref contains (an #FlatpakRefKind)
+ * @name: name of the app/runtime to fetch
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ * @branch: (nullable): which branch to fetch (default: 'master')
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Gets the current remote branch of a ref in the remote.
+ *
+ * Returns: (transfer full): a #FlatpakRemoteRef instance, or %NULL
+ */
+FlatpakRemoteRef *
+flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
+                                            const char          *remote_name,
+                                            FlatpakRefKind       kind,
+                                            const char          *name,
+                                            const char          *arch,
+                                            const char          *branch,
+                                            GCancellable        *cancellable,
+                                            GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(GHashTable) ht = NULL;
+  g_autofree char *ref = NULL;
+  const char *checksum;
+
+  if (branch == NULL)
+    branch = "master";
+
+  if (!flatpak_dir_list_remote_refs (dir,
+                                     remote_name,
+                                     &ht,
+                                     cancellable,
+                                     error))
+    return NULL;
+
+  if (kind == FLATPAK_REF_KIND_APP)
+    ref = flatpak_build_app_ref (name,
+                                 branch,
+                                 arch);
+  else
+    ref = flatpak_build_runtime_ref (name,
+                                     branch,
+                                     arch);
+
+  checksum = g_hash_table_lookup (ht, ref);
+
+  if (checksum != NULL)
+    return flatpak_remote_ref_new (ref, checksum, remote_name);
+
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+               "Reference %s doesn't exist in remote", ref);
+  return NULL;
+}
+
+/**
+ * flatpak_installation_update_appstream_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @arch: Architecture to update, or %NULL for the local machine arch
+ * @out_changed: (nullable): Set to %TRUE if the contents of the appstream changed, %FALSE if nothing changed
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Updates the local copy of appstream for @remote_name for the specified @arch.
+ * If you need progress feedback, use flatpak_installation_update_appstream_full_sync().
+ *
+ * Returns: %TRUE on success, or %FALSE on error
+ */
+gboolean
+flatpak_installation_update_appstream_sync (FlatpakInstallation *self,
+                                            const char          *remote_name,
+                                            const char          *arch,
+                                            gboolean            *out_changed,
+                                            GCancellable        *cancellable,
+                                            GError             **error)
+{
+  return flatpak_installation_update_appstream_full_sync (self, remote_name, arch,
+                                                          NULL, NULL, out_changed,
+                                                          cancellable, error);
+
+}
+
+/**
+ * flatpak_installation_update_appstream_full_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @arch: Architecture to update, or %NULL for the local machine arch
+ * @progress: (scope call) (nullable): progress callback
+ * @progress_data: (closure progress) (nullable): user data passed to @progress
+ * @out_changed: (nullable): Set to %TRUE if the contents of the appstream changed, %FALSE if nothing changed
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Updates the local copy of appstream for @remote_name for the specified @arch.
+ *
+ * Returns: %TRUE on success, or %FALSE on error
+ */
+gboolean
+flatpak_installation_update_appstream_full_sync (FlatpakInstallation *self,
+                                                 const char          *remote_name,
+                                                 const char          *arch,
+                                                 FlatpakProgressCallback progress,
+                                                 gpointer                progress_data,
+                                                 gboolean            *out_changed,
+                                                 GCancellable        *cancellable,
+                                                 GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(FlatpakDir) dir_clone = NULL;
+  g_autoptr(OstreeAsyncProgress) ostree_progress = NULL;
+  g_autoptr(GMainContext) main_context = NULL;
+  gboolean res;
+
+  /* Pull, prune, etc are not threadsafe, so we work on a copy */
+  dir_clone = flatpak_dir_clone (dir);
+  if (!flatpak_dir_ensure_repo (dir_clone, cancellable, error))
+    return FALSE;
+
+  /* Work around ostree-pull spinning the default main context for the sync calls */
+  main_context = g_main_context_new ();
+  g_main_context_push_thread_default (main_context);
+
+  if (progress)
+    ostree_progress = flatpak_progress_new (progress, progress_data);
+  else
+    ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+
+  res = flatpak_dir_update_appstream (dir_clone,
+                                      remote_name,
+                                      arch,
+                                      out_changed,
+                                      ostree_progress,
+                                      cancellable,
+                                      error);
+
+  g_main_context_pop_thread_default (main_context);
+
+  if (ostree_progress)
+    ostree_async_progress_finish (ostree_progress);
+
+  return res;
+}
+
+
+/**
+ * flatpak_installation_create_monitor:
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Gets monitor object for the installation. The returned file monitor will
+ * emit the #GFileMonitor::changed signal whenever an application or runtime
+ * was installed, uninstalled or updated.
+ *
+ * Returns: (transfer full): a new #GFileMonitor instance, or %NULL on error
+ */
+GFileMonitor *
+flatpak_installation_create_monitor (FlatpakInstallation *self,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(GFile) path = NULL;
+
+  path = flatpak_dir_get_changed_path (dir);
+
+  return g_file_monitor_file (path, G_FILE_MONITOR_NONE,
+                              cancellable, error);
+}
+
+
+/**
+ * flatpak_installation_list_remote_related_refs_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @ref: the ref
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists all the available refs on @remote_name that are related to
+ * @ref, and the subpaths to use. These are things that are
+ * interesting to install, update, or uninstall together with
+ * @ref. For instance, locale data or debug information.
+ *
+ * The returned list contains all available related refs, but not
+ * everyone should always be installed. For example,
+ * flatpak_related_ref_should_download () returns TRUE if the
+ * reference should be installed/updated with the app, and
+ * flatpak_related_ref_should_delete () returns TRUE if it
+ * should be uninstalled with the main ref.
+ *
+ * Returns: (transfer container) (element-type FlatpakRelatedRef): an GPtrArray of
+ *   #FlatpakRelatedRef instances
+ *
+ * Since: 0.6.7
+ */
+GPtrArray *
+flatpak_installation_list_remote_related_refs_sync (FlatpakInstallation *self,
+                                                    const char          *remote_name,
+                                                    const char          *ref,
+                                                    GCancellable        *cancellable,
+                                                    GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(GPtrArray) related = NULL;
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_object_unref);
+  int i;
+
+  related = flatpak_dir_find_remote_related (dir, ref, remote_name,
+                                             cancellable, error);
+  if (related == NULL)
+    return NULL;
+
+  for (i = 0; i < related->len; i++)
+    {
+      FlatpakRelated *rel = g_ptr_array_index (related, i);
+      FlatpakRelatedRef *ref;
+
+      ref = flatpak_related_ref_new (rel->collection_id, rel->ref, rel->commit,
+                                     rel->subpaths, rel->download, rel->delete);
+
+      if (ref)
+        g_ptr_array_add (refs, ref);
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/**
+ * flatpak_installation_list_installed_related_refs_sync:
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @ref: the ref
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Lists all the locally installed refs from @remote_name that are
+ * related to @ref. These are things that are interesting to install,
+ * update, or uninstall together with @ref. For instance, locale data
+ * or debug information.
+ *
+ * This function is similar to flatpak_installation_list_remote_related_refs_sync,
+ * but instead of looking at what is available on the remote, it only looks
+ * at the locally installed refs. This is useful for instance when you're
+ * looking for related refs to uninstall, or when you're planning to use
+ * FLATPAK_UPDATE_FLAGS_NO_PULL to install previously pulled refs.
+ *
+ * Returns: (transfer container) (element-type FlatpakRelatedRef): an GPtrArray of
+ *   #FlatpakRelatedRef instances
+ *
+ * Since: 0.6.7
+ */
+GPtrArray *
+flatpak_installation_list_installed_related_refs_sync (FlatpakInstallation *self,
+                                                       const char          *remote_name,
+                                                       const char          *ref,
+                                                       GCancellable        *cancellable,
+                                                       GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+  g_autoptr(GPtrArray) related = NULL;
+  g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func (g_object_unref);
+  int i;
+
+  related = flatpak_dir_find_local_related (dir, ref, remote_name,
+                                            cancellable, error);
+  if (related == NULL)
+    return NULL;
+
+  for (i = 0; i < related->len; i++)
+    {
+      FlatpakRelated *rel = g_ptr_array_index (related, i);
+      FlatpakRelatedRef *ref;
+
+      ref = flatpak_related_ref_new (rel->collection_id, rel->ref, rel->commit,
+                                     rel->subpaths, rel->download, rel->delete);
+
+      if (ref)
+        g_ptr_array_add (refs, ref);
+    }
+
+  return g_steal_pointer (&refs);
+}
+
+/**
+ * flatpak_installation_remove_local_ref_sync
+ * @self: a #FlatpakInstallation
+ * @remote_name: the name of the remote
+ * @ref: the ref
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Remove the OSTree ref given by @remote_name:@ref from the local flatpak
+ * repository. The next time the underlying OSTree repo is pruned, objects
+ * which were attached to that ref will be removed. This is useful if you
+ * pulled a flatpak ref using flatpak_installation_install_full() and
+ * specified %FLATPAK_INSTALL_FLAGS_NO_DEPLOY but then decided not to
+ * deploy the ref later on and want to remove the local ref to prevent it
+ * from taking up disk space. Note that this will not remove the objects
+ * referred to by @ref from the underlying OSTree repo, you should use
+ * flatpak_installation_prune_local_repo() to do that.
+ *
+ * Returns: %TRUE on success
+ */
+gboolean
+flatpak_installation_remove_local_ref_sync (FlatpakInstallation *self,
+                                            const char          *remote_name,
+                                            const char          *ref,
+                                            GCancellable        *cancellable,
+                                            GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_remove_ref (dir, remote_name, ref, cancellable, error);
+}
+
+/**
+ * flatpak_installation_cleanup_local_refs_sync
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Remove all OSTree refs from the local flatpak repository which are not
+ * in a deployed state. The next time the underlying OSTree repo is pruned,
+ * objects which were attached to that ref will be removed. This is useful if
+ * you pulled a flatpak refs using flatpak_installation_install_full() and
+ * specified %FLATPAK_INSTALL_FLAGS_NO_DEPLOY but then decided not to
+ * deploy the refs later on and want to remove the local refs to prevent them
+ * from taking up disk space. Note that this will not remove the objects
+ * referred to by @ref from the underlying OSTree repo, you should use
+ * flatpak_installation_prune_local_repo() to do that.
+ *
+ * Since: 0.10.0
+ * Returns: %TRUE on success
+ */
+gboolean
+flatpak_installation_cleanup_local_refs_sync (FlatpakInstallation *self,
+                                              GCancellable        *cancellable,
+                                              GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_cleanup_undeployed_refs (dir, cancellable, error);
+}
+
+/**
+ * flatpak_installation_prune_local_repo
+ * @self: a #FlatpakInstallation
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Remove all orphaned OSTree objects from the underlying OSTree repo in
+ * @installation.
+ *
+ * Returns: %TRUE on success
+ */
+gboolean
+flatpak_installation_prune_local_repo (FlatpakInstallation *self,
+                                       GCancellable        *cancellable,
+                                       GError             **error)
+{
+  g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir (self);
+
+  return flatpak_dir_prune (dir, cancellable, error);
+}
diff --git a/lib/flatpak-installation.h b/lib/flatpak-installation.h
new file mode 100644 (file)
index 0000000..2f857c4
--- /dev/null
@@ -0,0 +1,334 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_INSTALLATION_H__
+#define __FLATPAK_INSTALLATION_H__
+
+typedef struct _FlatpakInstallation FlatpakInstallation;
+
+#include <gio/gio.h>
+#include <flatpak-installed-ref.h>
+#include <flatpak-remote.h>
+
+#define FLATPAK_TYPE_INSTALLATION flatpak_installation_get_type ()
+#define FLATPAK_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLATION, FlatpakInstallation))
+#define FLATPAK_IS_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLATION))
+
+FLATPAK_EXTERN GType flatpak_installation_get_type (void);
+
+struct _FlatpakInstallation
+{
+  GObject parent;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakInstallationClass;
+
+/**
+ * FlatpakUpdateFlags:
+ * @FLATPAK_UPDATE_FLAGS_NONE: Fetch remote builds and install the latest one (default)
+ * @FLATPAK_UPDATE_FLAGS_NO_DEPLOY: Don't install any new builds that might be fetched
+ * @FLATPAK_UPDATE_FLAGS_NO_PULL: Don't try to fetch new builds from the remote repo
+ *
+ * Flags to alter the behavior of flatpak_installation_update().
+ */
+typedef enum {
+  FLATPAK_UPDATE_FLAGS_NONE             = 0,
+  FLATPAK_UPDATE_FLAGS_NO_DEPLOY        = (1 << 0),
+  FLATPAK_UPDATE_FLAGS_NO_PULL          = (1 << 1),
+  FLATPAK_UPDATE_FLAGS_NO_STATIC_DELTAS = (1 << 2),
+} FlatpakUpdateFlags;
+
+/**
+ * FlatpakInstallFlags:
+ * @FLATPAK_INSTALL_FLAGS_NONE: Default
+ *
+ * Flags to alter the behavior of flatpak_installation_install_full().
+ */
+typedef enum {
+  FLATPAK_INSTALL_FLAGS_NONE             = 0,
+  FLATPAK_INSTALL_FLAGS_NO_STATIC_DELTAS = (1 << 0),
+  FLATPAK_INSTALL_FLAGS_NO_DEPLOY        = (1 << 2),
+  FLATPAK_INSTALL_FLAGS_NO_PULL          = (1 << 3),
+} FlatpakInstallFlags;
+
+/**
+ * FlatpakStorageType:
+ * @FLATPAK_STORAGE_TYPE_DEFAULT: default
+ * @FLATPAK_STORAGE_TYPE_HARD_DISK: installation is on a hard disk
+ * @FLATPAK_STORAGE_TYPE_SDCARD: installation is on a SD card
+ * @FLATPAK_STORAGE_TYPE_MMC: installation is on an MMC
+ *
+ * Flags to alter the behavior of flatpak_installation_install_full().
+ *
+ * Since: 0.6.15
+ */
+typedef enum {
+  FLATPAK_STORAGE_TYPE_DEFAULT = 0,
+  FLATPAK_STORAGE_TYPE_HARD_DISK,
+  FLATPAK_STORAGE_TYPE_SDCARD,
+  FLATPAK_STORAGE_TYPE_MMC,
+} FlatpakStorageType;
+
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstallation, g_object_unref)
+#endif
+
+FLATPAK_EXTERN const char  *flatpak_get_default_arch (void);
+
+FLATPAK_EXTERN const char *const *flatpak_get_supported_arches (void);
+
+FLATPAK_EXTERN GPtrArray *flatpak_get_system_installations (GCancellable *cancellable,
+                                                            GError      **error);
+FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_system (GCancellable *cancellable,
+                                                                     GError      **error);
+FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_system_with_id (const char   *id,
+                                                                             GCancellable *cancellable,
+                                                                             GError      **error);
+FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_user (GCancellable *cancellable,
+                                                                   GError      **error);
+FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_for_path (GFile        *path,
+                                                                       gboolean      user,
+                                                                       GCancellable *cancellable,
+                                                                       GError      **error);
+
+/**
+ * FlatpakProgressCallback:
+ * @status: A status string, suitable for display
+ * @progress: percentage of completion
+ * @estimating: whether @progress is just an estimate
+ * @user_data: User data passed to the caller
+ *
+ * The progress callback is called repeatedly during long-running operations
+ * such as installations or updates, and can be used to update progress information
+ * in a user interface.
+ *
+ * The callback occurs in the thread-default context of the caller.
+ */
+typedef void (*FlatpakProgressCallback)(const char *status,
+                                        guint       progress,
+                                        gboolean    estimating,
+                                        gpointer    user_data);
+
+FLATPAK_EXTERN gboolean             flatpak_installation_drop_caches (FlatpakInstallation *self,
+                                                                      GCancellable        *cancellable,
+                                                                      GError             **error);
+FLATPAK_EXTERN gboolean             flatpak_installation_get_is_user (FlatpakInstallation *self);
+FLATPAK_EXTERN GFile               *flatpak_installation_get_path (FlatpakInstallation *self);
+FLATPAK_EXTERN const char          *flatpak_installation_get_id (FlatpakInstallation *self);
+FLATPAK_EXTERN const char          *flatpak_installation_get_display_name (FlatpakInstallation *self);
+FLATPAK_EXTERN gint                 flatpak_installation_get_priority (FlatpakInstallation *self);
+FLATPAK_EXTERN FlatpakStorageType   flatpak_installation_get_storage_type (FlatpakInstallation *self);
+FLATPAK_EXTERN gboolean             flatpak_installation_launch (FlatpakInstallation *self,
+                                                                 const char          *name,
+                                                                 const char          *arch,
+                                                                 const char          *branch,
+                                                                 const char          *commit,
+                                                                 GCancellable        *cancellable,
+                                                                 GError             **error);
+FLATPAK_EXTERN GFileMonitor        *flatpak_installation_create_monitor (FlatpakInstallation *self,
+                                                                         GCancellable        *cancellable,
+                                                                         GError             **error);
+FLATPAK_EXTERN GPtrArray           *flatpak_installation_list_installed_refs (FlatpakInstallation *self,
+                                                                              GCancellable        *cancellable,
+                                                                              GError             **error);
+FLATPAK_EXTERN GPtrArray           *flatpak_installation_list_installed_refs_by_kind (FlatpakInstallation *self,
+                                                                                      FlatpakRefKind       kind,
+                                                                                      GCancellable        *cancellable,
+                                                                                      GError             **error);
+FLATPAK_EXTERN GPtrArray           *flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
+                                                                                         GCancellable        *cancellable,
+                                                                                         GError             **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_get_installed_ref (FlatpakInstallation *self,
+                                                                             FlatpakRefKind       kind,
+                                                                             const char          *name,
+                                                                             const char          *arch,
+                                                                             const char          *branch,
+                                                                             GCancellable        *cancellable,
+                                                                             GError             **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_get_current_installed_app (FlatpakInstallation *self,
+                                                                                     const char          *name,
+                                                                                     GCancellable        *cancellable,
+                                                                                     GError             **error);
+FLATPAK_EXTERN GPtrArray           *flatpak_installation_list_remotes (FlatpakInstallation *self,
+                                                                       GCancellable        *cancellable,
+                                                                       GError             **error);
+FLATPAK_EXTERN FlatpakRemote        *flatpak_installation_get_remote_by_name (FlatpakInstallation *self,
+                                                                              const gchar         *name,
+                                                                              GCancellable        *cancellable,
+                                                                              GError             **error);
+FLATPAK_EXTERN gboolean              flatpak_installation_modify_remote (FlatpakInstallation *self,
+                                                                         FlatpakRemote       *remote,
+                                                                         GCancellable        *cancellable,
+                                                                         GError             **error);
+FLATPAK_EXTERN gboolean              flatpak_installation_remove_remote (FlatpakInstallation *self,
+                                                                         const char          *name,
+                                                                         GCancellable        *cancellable,
+                                                                         GError             **error);
+FLATPAK_EXTERN gboolean              flatpak_installation_update_remote_sync (FlatpakInstallation *self,
+                                                                              const char          *name,
+                                                                              GCancellable        *cancellable,
+                                                                              GError             **error);
+FLATPAK_EXTERN gboolean              flatpak_installation_set_config_sync (FlatpakInstallation *self,
+                                                                          const char          *key,
+                                                                          const char          *value,
+                                                                          GCancellable        *cancellable,
+                                                                          GError             **error);
+FLATPAK_EXTERN char *                flatpak_installation_get_config      (FlatpakInstallation *self,
+                                                                          const char          *key,
+                                                                          GCancellable        *cancellable,
+                                                                          GError             **error);
+FLATPAK_EXTERN char *              flatpak_installation_load_app_overrides (FlatpakInstallation *self,
+                                                                            const char          *app_id,
+                                                                            GCancellable        *cancellable,
+                                                                            GError             **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_install (FlatpakInstallation    *self,
+                                                                   const char             *remote_name,
+                                                                   FlatpakRefKind          kind,
+                                                                   const char             *name,
+                                                                   const char             *arch,
+                                                                   const char             *branch,
+                                                                   FlatpakProgressCallback progress,
+                                                                   gpointer                progress_data,
+                                                                   GCancellable           *cancellable,
+                                                                   GError                **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_install_full (FlatpakInstallation    *self,
+                                                                        FlatpakInstallFlags     flags,
+                                                                        const char             *remote_name,
+                                                                        FlatpakRefKind          kind,
+                                                                        const char             *name,
+                                                                        const char             *arch,
+                                                                        const char             *branch,
+                                                                        const char * const     *subpaths,
+                                                                        FlatpakProgressCallback progress,
+                                                                        gpointer                progress_data,
+                                                                        GCancellable           *cancellable,
+                                                                        GError                **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_update (FlatpakInstallation    *self,
+                                                                  FlatpakUpdateFlags      flags,
+                                                                  FlatpakRefKind          kind,
+                                                                  const char             *name,
+                                                                  const char             *arch,
+                                                                  const char             *branch,
+                                                                  FlatpakProgressCallback progress,
+                                                                  gpointer                progress_data,
+                                                                  GCancellable           *cancellable,
+                                                                  GError                **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_update_full (FlatpakInstallation    *self,
+                                                                       FlatpakUpdateFlags      flags,
+                                                                       FlatpakRefKind          kind,
+                                                                       const char             *name,
+                                                                       const char             *arch,
+                                                                       const char             *branch,
+                                                                       const char * const     *subpaths,
+                                                                       FlatpakProgressCallback progress,
+                                                                       gpointer                progress_data,
+                                                                       GCancellable           *cancellable,
+                                                                       GError                **error);
+FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_install_bundle (FlatpakInstallation    *self,
+                                                                          GFile                  *file,
+                                                                          FlatpakProgressCallback progress,
+                                                                          gpointer                progress_data,
+                                                                          GCancellable           *cancellable,
+                                                                          GError                **error);
+FLATPAK_EXTERN FlatpakRemoteRef *   flatpak_installation_install_ref_file (FlatpakInstallation *self,
+                                                                           GBytes              *ref_file_data,
+                                                                           GCancellable        *cancellable,
+                                                                           GError             **error);
+FLATPAK_EXTERN gboolean             flatpak_installation_uninstall (FlatpakInstallation    *self,
+                                                                    FlatpakRefKind          kind,
+                                                                    const char             *name,
+                                                                    const char             *arch,
+                                                                    const char             *branch,
+                                                                    FlatpakProgressCallback progress,
+                                                                    gpointer                progress_data,
+                                                                    GCancellable           *cancellable,
+                                                                    GError                **error);
+
+FLATPAK_EXTERN gboolean          flatpak_installation_fetch_remote_size_sync (FlatpakInstallation *self,
+                                                                              const char          *remote_name,
+                                                                              FlatpakRef          *ref,
+                                                                              guint64             *download_size,
+                                                                              guint64             *installed_size,
+                                                                              GCancellable        *cancellable,
+                                                                              GError             **error);
+FLATPAK_EXTERN GBytes        *   flatpak_installation_fetch_remote_metadata_sync (FlatpakInstallation *self,
+                                                                                  const char          *remote_name,
+                                                                                  FlatpakRef          *ref,
+                                                                                  GCancellable        *cancellable,
+                                                                                  GError             **error);
+FLATPAK_EXTERN GPtrArray    *    flatpak_installation_list_remote_refs_sync (FlatpakInstallation *self,
+                                                                             const char          *remote_name,
+                                                                             GCancellable        *cancellable,
+                                                                             GError             **error);
+FLATPAK_EXTERN FlatpakRemoteRef  *flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
+                                                                              const char          *remote_name,
+                                                                              FlatpakRefKind       kind,
+                                                                              const char          *name,
+                                                                              const char          *arch,
+                                                                              const char          *branch,
+                                                                              GCancellable        *cancellable,
+                                                                              GError             **error);
+FLATPAK_EXTERN gboolean          flatpak_installation_update_appstream_sync (FlatpakInstallation *self,
+                                                                             const char          *remote_name,
+                                                                             const char          *arch,
+                                                                             gboolean            *out_changed,
+                                                                             GCancellable        *cancellable,
+                                                                             GError             **error);
+FLATPAK_EXTERN gboolean          flatpak_installation_update_appstream_full_sync (FlatpakInstallation *self,
+                                                                                  const char          *remote_name,
+                                                                                  const char          *arch,
+                                                                                  FlatpakProgressCallback progress,
+                                                                                  gpointer                progress_data,
+                                                                                  gboolean            *out_changed,
+                                                                                  GCancellable        *cancellable,
+                                                                                  GError             **error);
+FLATPAK_EXTERN GPtrArray    *    flatpak_installation_list_remote_related_refs_sync (FlatpakInstallation *self,
+                                                                                     const char          *remote_name,
+                                                                                     const char          *ref,
+                                                                                     GCancellable        *cancellable,
+                                                                                     GError             **error);
+FLATPAK_EXTERN GPtrArray    *    flatpak_installation_list_installed_related_refs_sync (FlatpakInstallation *self,
+                                                                                        const char          *remote_name,
+                                                                                        const char          *ref,
+                                                                                        GCancellable        *cancellable,
+                                                                                        GError             **error);
+
+FLATPAK_EXTERN gboolean          flatpak_installation_remove_local_ref_sync (FlatpakInstallation *self,
+                                                                             const char          *remote_name,
+                                                                             const char          *ref,
+                                                                             GCancellable        *cancellable,
+                                                                             GError              **error);
+FLATPAK_EXTERN gboolean          flatpak_installation_cleanup_local_refs_sync (FlatpakInstallation *self,
+                                                                               GCancellable        *cancellable,
+                                                                               GError              **error);
+FLATPAK_EXTERN gboolean          flatpak_installation_prune_local_repo (FlatpakInstallation *self,
+                                                                        GCancellable        *cancellable,
+                                                                        GError              **error);
+
+
+#endif /* __FLATPAK_INSTALLATION_H__ */
diff --git a/lib/flatpak-installed-ref-private.h b/lib/flatpak-installed-ref-private.h
new file mode 100644 (file)
index 0000000..90092a9
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_INSTALLED_REF_PRIVATE_H__
+#define __FLATPAK_INSTALLED_REF_PRIVATE_H__
+
+#include <flatpak-installed-ref.h>
+#include <flatpak-dir.h>
+
+FlatpakInstalledRef *flatpak_installed_ref_new (const char  *full_ref,
+                                                const char  *commit,
+                                                const char  *latest_commit,
+                                                const char  *origin,
+                                                const char **subpaths,
+                                                const char  *deploy_dir,
+                                                guint64      installed_size,
+                                                gboolean     current);
+
+#endif /* __FLATPAK_INSTALLED_REF_PRIVATE_H__ */
diff --git a/lib/flatpak-installed-ref.c b/lib/flatpak-installed-ref.c
new file mode 100644 (file)
index 0000000..6d1f326
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "flatpak-utils.h"
+#include "flatpak-installed-ref.h"
+#include "flatpak-installed-ref-private.h"
+#include "flatpak-enum-types.h"
+
+/**
+ * SECTION:flatpak-installed-ref
+ * @Title: FlatpakInstalledRef
+ * @Short_description: Installed application reference
+ *
+ * A FlatpakInstalledRef provides information about an installed
+ * application or runtime (in short: ref), such as the available
+ * builds, its size, location, etc.
+ */
+
+typedef struct _FlatpakInstalledRefPrivate FlatpakInstalledRefPrivate;
+
+struct _FlatpakInstalledRefPrivate
+{
+  gboolean is_current;
+  char    *origin;
+  char    *latest_commit;
+  char    *deploy_dir;
+  char   **subpaths;
+  guint64  installed_size;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakInstalledRef, flatpak_installed_ref, FLATPAK_TYPE_REF)
+
+enum {
+  PROP_0,
+
+  PROP_IS_CURRENT,
+  PROP_ORIGIN,
+  PROP_LATEST_COMMIT,
+  PROP_DEPLOY_DIR,
+  PROP_INSTALLED_SIZE,
+  PROP_SUBPATHS
+};
+
+static void
+flatpak_installed_ref_finalize (GObject *object)
+{
+  FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  g_free (priv->origin);
+  g_free (priv->latest_commit);
+  g_free (priv->deploy_dir);
+  g_strfreev (priv->subpaths);
+
+  G_OBJECT_CLASS (flatpak_installed_ref_parent_class)->finalize (object);
+}
+
+static void
+flatpak_installed_ref_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_IS_CURRENT:
+      priv->is_current = g_value_get_boolean (value);
+      break;
+
+    case PROP_INSTALLED_SIZE:
+      priv->installed_size = g_value_get_uint64 (value);
+      break;
+
+    case PROP_ORIGIN:
+      g_clear_pointer (&priv->origin, g_free);
+      priv->origin = g_value_dup_string (value);
+      break;
+
+    case PROP_LATEST_COMMIT:
+      g_clear_pointer (&priv->latest_commit, g_free);
+      priv->latest_commit = g_value_dup_string (value);
+      break;
+
+    case PROP_DEPLOY_DIR:
+      g_clear_pointer (&priv->deploy_dir, g_free);
+      priv->deploy_dir = g_value_dup_string (value);
+      break;
+
+    case PROP_SUBPATHS:
+      g_clear_pointer (&priv->subpaths, g_strfreev);
+      priv->subpaths = g_strdupv (g_value_get_boxed (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_installed_ref_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_IS_CURRENT:
+      g_value_set_boolean (value, priv->is_current);
+      break;
+
+    case PROP_INSTALLED_SIZE:
+      g_value_set_uint64 (value, priv->installed_size);
+      break;
+
+    case PROP_ORIGIN:
+      g_value_set_string (value, priv->origin);
+      break;
+
+    case PROP_LATEST_COMMIT:
+      g_value_set_string (value, priv->latest_commit);
+      break;
+
+    case PROP_DEPLOY_DIR:
+      g_value_set_string (value, priv->deploy_dir);
+      break;
+
+    case PROP_SUBPATHS:
+      g_value_set_boxed (value, priv->subpaths);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_installed_ref_class_init (FlatpakInstalledRefClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_installed_ref_get_property;
+  object_class->set_property = flatpak_installed_ref_set_property;
+  object_class->finalize = flatpak_installed_ref_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_IS_CURRENT,
+                                   g_param_spec_boolean ("is-current",
+                                                         "Is Current",
+                                                         "Whether the application is current",
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_INSTALLED_SIZE,
+                                   g_param_spec_uint64 ("installed-size",
+                                                        "Installed Size",
+                                                        "The installed size of the application",
+                                                        0, G_MAXUINT64, 0,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_ORIGIN,
+                                   g_param_spec_string ("origin",
+                                                        "Origin",
+                                                        "The origin",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_LATEST_COMMIT,
+                                   g_param_spec_string ("latest-commit",
+                                                        "Latest Commit",
+                                                        "The latest commit",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_DEPLOY_DIR,
+                                   g_param_spec_string ("deploy-dir",
+                                                        "Deploy Dir",
+                                                        "Where the application is installed",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_SUBPATHS,
+                                   g_param_spec_boxed ("subpaths",
+                                                       "",
+                                                       "",
+                                                       G_TYPE_STRV,
+                                                       G_PARAM_READWRITE));
+}
+
+static void
+flatpak_installed_ref_init (FlatpakInstalledRef *self)
+{
+}
+
+/**
+ * flatpak_installed_ref_get_origin:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Gets the origin of the ref.
+ *
+ * Returns: (transfer none): the origin
+ */
+const char *
+flatpak_installed_ref_get_origin (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return priv->origin;
+}
+
+/**
+ * flatpak_installed_ref_get_latest_commit:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Gets the latest commit of the ref.
+ *
+ * Returns: (transfer none): the latest commit
+ */
+const char *
+flatpak_installed_ref_get_latest_commit (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return priv->latest_commit;
+}
+
+/**
+ * flatpak_installed_ref_get_deploy_dir:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Gets the deploy dir of the ref.
+ *
+ * Returns: (transfer none): the deploy dir
+ */
+const char *
+flatpak_installed_ref_get_deploy_dir (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return priv->deploy_dir;
+}
+
+/**
+ * flatpak_installed_ref_get_is_current:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Returns whether the ref is current.
+ *
+ * Returns: %TRUE if the ref is current
+ */
+gboolean
+flatpak_installed_ref_get_is_current (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return priv->is_current;
+}
+
+/**
+ * flatpak_installed_ref_get_subpaths:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Returns the subpaths that are installed, or %NULL if all files installed.
+ *
+ * Returns: (transfer none): A strv, or %NULL
+ */
+const char * const *
+flatpak_installed_ref_get_subpaths (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return (const char * const *) priv->subpaths;
+}
+
+/**
+ * flatpak_installed_ref_get_installed_size:
+ * @self: a #FlatpakInstalledRef
+ *
+ * Returns the installed size of the ref.
+ *
+ * Returns: the installed size
+ */
+guint64
+flatpak_installed_ref_get_installed_size (FlatpakInstalledRef *self)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+
+  return priv->installed_size;
+}
+
+/**
+ * flatpak_installed_ref_load_metadata:
+ * @self: a #FlatpakInstalledRef
+ * @cancellable: (nullable): a #GCancellable
+ * @error: a return location for a #GError
+ *
+ * Loads the metadata file for this ref.
+ *
+ * Returns: (transfer full): a #GBytes containing the metadata file,
+ *     or %NULL if an error occurred
+ */
+GBytes *
+flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self,
+                                     GCancellable        *cancellable,
+                                     GError             **error)
+{
+  FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
+  g_autofree char *path = NULL;
+  char *metadata;
+  gsize length;
+
+  if (priv->deploy_dir == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   "Unknown deploy directory");
+      return NULL;
+    }
+
+  path = g_build_filename (priv->deploy_dir, "metadata", NULL);
+  if (!g_file_get_contents (path, &metadata, &length, error))
+    return NULL;
+
+  return g_bytes_new_take (metadata, length);
+}
+
+FlatpakInstalledRef *
+flatpak_installed_ref_new (const char  *full_ref,
+                           const char  *commit,
+                           const char  *latest_commit,
+                           const char  *origin,
+                           const char **subpaths,
+                           const char  *deploy_dir,
+                           guint64      installed_size,
+                           gboolean     is_current)
+{
+  FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
+  FlatpakInstalledRef *ref;
+
+  g_auto(GStrv) parts = NULL;
+
+  parts = g_strsplit (full_ref, "/", -1);
+
+  if (strcmp (parts[0], "app") != 0)
+    kind = FLATPAK_REF_KIND_RUNTIME;
+
+  /* Canonicalize the "no subpaths" case */
+  if (subpaths && *subpaths == NULL)
+    subpaths = NULL;
+
+  ref = g_object_new (FLATPAK_TYPE_INSTALLED_REF,
+                      "kind", kind,
+                      "name", parts[1],
+                      "arch", parts[2],
+                      "branch", parts[3],
+                      "commit", commit,
+                      "latest-commit", latest_commit,
+                      "origin", origin,
+                      "subpaths", subpaths,
+                      "is-current", is_current,
+                      "installed-size", installed_size,
+                      "deploy-dir", deploy_dir,
+                      NULL);
+
+  return ref;
+}
diff --git a/lib/flatpak-installed-ref.h b/lib/flatpak-installed-ref.h
new file mode 100644 (file)
index 0000000..325696e
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_INSTALLED_REF_H__
+#define __FLATPAK_INSTALLED_REF_H__
+
+typedef struct _FlatpakInstalledRef FlatpakInstalledRef;
+
+#include <gio/gio.h>
+#include <flatpak-ref.h>
+
+#define FLATPAK_TYPE_INSTALLED_REF flatpak_installed_ref_get_type ()
+#define FLATPAK_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLED_REF, FlatpakInstalledRef))
+#define FLATPAK_IS_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLED_REF))
+
+FLATPAK_EXTERN GType flatpak_installed_ref_get_type (void);
+
+struct _FlatpakInstalledRef
+{
+  FlatpakRef parent;
+};
+
+typedef struct
+{
+  FlatpakRefClass parent_class;
+} FlatpakInstalledRefClass;
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstalledRef, g_object_unref)
+#endif
+
+FLATPAK_EXTERN const char  *flatpak_installed_ref_get_origin (FlatpakInstalledRef  * self);
+FLATPAK_EXTERN const char * const *flatpak_installed_ref_get_subpaths (FlatpakInstalledRef *self);
+FLATPAK_EXTERN guint64      flatpak_installed_ref_get_installed_size (FlatpakInstalledRef *self);
+FLATPAK_EXTERN const char  *flatpak_installed_ref_get_deploy_dir (FlatpakInstalledRef *self);
+FLATPAK_EXTERN const char  *flatpak_installed_ref_get_latest_commit (FlatpakInstalledRef *self);
+FLATPAK_EXTERN gboolean     flatpak_installed_ref_get_is_current (FlatpakInstalledRef *self);
+FLATPAK_EXTERN GBytes      *flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self,
+                                                                 GCancellable        *cancellable,
+                                                                 GError             **error);
+
+#endif /* __FLATPAK_INSTALLED_REF_H__ */
diff --git a/lib/flatpak-ref.c b/lib/flatpak-ref.c
new file mode 100644 (file)
index 0000000..09604f1
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-utils.h"
+#include "flatpak-ref.h"
+#include "flatpak-enum-types.h"
+
+/**
+ * SECTION:flatpak-ref
+ * @Title: FlatpakRef
+ * @Short_description: Application reference
+ *
+ * Currently flatpak manages two types of binary artifacts: applications, and
+ * runtimes. Applications contain a program that desktop users can run, while
+ * runtimes contain only libraries and data. An FlatpakRef object (or short: ref)
+ * can refer to either of these.
+ *
+ * Both applications and runtimes are identified by a 4-tuple of strings: kind,
+ * name, arch and branch, e.g. app/org.gnome.evince/x86_64/master. The functions
+ * flatpak_ref_parse() and flatpak_ref_format_ref() can be used to convert
+ * FlatpakRef objects into this string representation and back.
+ *
+ * To uniquely identify a particular version of an application or runtime, you
+ * need a commit.
+ *
+ * The subclasses #FlatpakInstalledRef and #FlatpakRemoteRef provide more information
+ * for artifacts that are locally installed or available from a remote repository.
+ */
+typedef struct _FlatpakRefPrivate FlatpakRefPrivate;
+
+struct _FlatpakRefPrivate
+{
+  char          *name;
+  char          *arch;
+  char          *branch;
+  char          *commit;
+  FlatpakRefKind kind;
+  char          *collection_id;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRef, flatpak_ref, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+
+  PROP_NAME,
+  PROP_ARCH,
+  PROP_BRANCH,
+  PROP_COMMIT,
+  PROP_KIND,
+  PROP_COLLECTION_ID,
+};
+
+static void
+flatpak_ref_finalize (GObject *object)
+{
+  FlatpakRef *self = FLATPAK_REF (object);
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  g_free (priv->name);
+  g_free (priv->arch);
+  g_free (priv->branch);
+  g_free (priv->commit);
+
+  G_OBJECT_CLASS (flatpak_ref_parent_class)->finalize (object);
+}
+
+static void
+flatpak_ref_set_property (GObject      *object,
+                          guint         prop_id,
+                          const GValue *value,
+                          GParamSpec   *pspec)
+{
+  FlatpakRef *self = FLATPAK_REF (object);
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_NAME:
+      g_clear_pointer (&priv->name, g_free);
+      priv->name = g_value_dup_string (value);
+      break;
+
+    case PROP_ARCH:
+      g_clear_pointer (&priv->arch, g_free);
+      priv->arch = g_value_dup_string (value);
+      break;
+
+    case PROP_BRANCH:
+      g_clear_pointer (&priv->branch, g_free);
+      priv->branch = g_value_dup_string (value);
+      break;
+
+    case PROP_COMMIT:
+      g_clear_pointer (&priv->commit, g_free);
+      priv->commit = g_value_dup_string (value);
+      break;
+
+    case PROP_KIND:
+      priv->kind = g_value_get_enum (value);
+      break;
+
+    case PROP_COLLECTION_ID:
+      g_clear_pointer (&priv->collection_id, g_free);
+      priv->collection_id = g_value_dup_string (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_ref_get_property (GObject    *object,
+                          guint       prop_id,
+                          GValue     *value,
+                          GParamSpec *pspec)
+{
+  FlatpakRef *self = FLATPAK_REF (object);
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_NAME:
+      g_value_set_string (value, priv->name);
+      break;
+
+    case PROP_ARCH:
+      g_value_set_string (value, priv->arch);
+      break;
+
+    case PROP_BRANCH:
+      g_value_set_string (value, priv->branch);
+      break;
+
+    case PROP_COMMIT:
+      g_value_set_string (value, priv->commit);
+      break;
+
+    case PROP_KIND:
+      g_value_set_enum (value, priv->kind);
+      break;
+
+    case PROP_COLLECTION_ID:
+      g_value_set_string (value, priv->collection_id);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_ref_class_init (FlatpakRefClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_ref_get_property;
+  object_class->set_property = flatpak_ref_set_property;
+  object_class->finalize = flatpak_ref_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_NAME,
+                                   g_param_spec_string ("name",
+                                                        "Name",
+                                                        "The name of the application or runtime",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_ARCH,
+                                   g_param_spec_string ("arch",
+                                                        "Architecture",
+                                                        "The architecture of the application or runtime",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_BRANCH,
+                                   g_param_spec_string ("branch",
+                                                        "Branch",
+                                                        "The branch of the application or runtime",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_COMMIT,
+                                   g_param_spec_string ("commit",
+                                                        "Commit",
+                                                        "The commit",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_KIND,
+                                   g_param_spec_enum ("kind",
+                                                      "Kind",
+                                                      "The kind of artifact",
+                                                      FLATPAK_TYPE_REF_KIND,
+                                                      FLATPAK_REF_KIND_APP,
+                                                      G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_COLLECTION_ID,
+                                   g_param_spec_string ("collection-id",
+                                                        "Collection ID",
+                                                        "The collection ID",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+}
+
+static void
+flatpak_ref_init (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  priv->kind = FLATPAK_REF_KIND_APP;
+}
+
+/**
+ * flatpak_ref_get_name:
+ * @self: a #FlatpakRef
+ *
+ * Gets the name of the ref.
+ *
+ * Returns: (transfer none): the name
+ */
+const char *
+flatpak_ref_get_name (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->name;
+}
+
+/**
+ * flatpak_ref_get_arch:
+ * @self: a #FlatpakRef
+ *
+ * Gets the arch or the ref.
+ *
+ * Returns: (transfer none): the arch
+ */
+const char *
+flatpak_ref_get_arch (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->arch;
+}
+
+/**
+ * flatpak_ref_get_branch:
+ * @self: a #FlatpakRef
+ *
+ * Gets the branch of the ref.
+ *
+ * Returns: (transfer none): the branch
+ */
+const char *
+flatpak_ref_get_branch (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->branch;
+}
+
+/**
+ * flatpak_ref_get_commit:
+ * @self: a #FlatpakRef
+ *
+ * Gets the commit of the ref.
+ *
+ * Returns: (transfer none): the commit
+ */
+const char *
+flatpak_ref_get_commit (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->commit;
+}
+
+/**
+ * flatpak_ref_get_kind:
+ * @self: a #FlatpakRef
+ *
+ * Gets the kind of artifact that this ref refers to.
+ *
+ * Returns: the kind of artifact
+ */
+FlatpakRefKind
+flatpak_ref_get_kind (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->kind;
+}
+
+/**
+ * flatpak_ref_format_ref:
+ * @self: a #FlatpakRef
+ *
+ * Convert an FlatpakRef object into a string representation that
+ * can be parsed by flatpak_ref_parse().
+ *
+ * Returns: (transfer full): string representation
+ */
+char *
+flatpak_ref_format_ref (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  if (priv->kind == FLATPAK_REF_KIND_APP)
+    return flatpak_build_app_ref (priv->name,
+                                  priv->branch,
+                                  priv->arch);
+  else
+    return flatpak_build_runtime_ref (priv->name,
+                                      priv->branch,
+                                      priv->arch);
+}
+
+/**
+ * flatpak_ref_parse:
+ * @ref: A string ref name, such as "app/org.test.App/86_64/master"
+ * @error: return location for a #GError
+ *
+ * Tries to parse a full ref name and return a #FlatpakRef (without a
+ * commit set) or fail if the ref is invalid somehow.
+ *
+ * Returns: (transfer full): an #FlatpakRef, or %NULL
+ */
+FlatpakRef *
+flatpak_ref_parse (const char *ref, GError **error)
+{
+  g_auto(GStrv) parts = NULL;
+
+  parts = flatpak_decompose_ref (ref, error);
+  if (parts == NULL)
+    return NULL;
+
+  FlatpakRefKind kind;
+  if (g_strcmp0 (parts[0], "app") == 0)
+    {
+      kind = FLATPAK_REF_KIND_APP;
+    }
+  else if (g_strcmp0 (parts[0], "runtime") == 0)
+    {
+      kind = FLATPAK_REF_KIND_RUNTIME;
+    }
+  else
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                   "Invalid kind: %s", parts[0]);
+      return NULL;
+    }
+
+  return FLATPAK_REF (g_object_new (FLATPAK_TYPE_REF,
+                                    "kind", kind,
+                                    "name", parts[1],
+                                    "arch", parts[2],
+                                    "branch", parts[3],
+                                    NULL));
+}
+
+/**
+ * flatpak_ref_get_collection_id:
+ * @self: a #FlatpakRef
+ *
+ * Gets the collection ID of the ref.
+ *
+ * Returns: (transfer none): the collection ID
+ */
+const char *
+flatpak_ref_get_collection_id (FlatpakRef *self)
+{
+  FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
+
+  return priv->collection_id;
+}
diff --git a/lib/flatpak-ref.h b/lib/flatpak-ref.h
new file mode 100644 (file)
index 0000000..e42c180
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_REF_H__
+#define __FLATPAK_REF_H__
+
+typedef struct _FlatpakRef FlatpakRef;
+
+#include <glib-object.h>
+
+#define FLATPAK_TYPE_REF flatpak_ref_get_type ()
+#define FLATPAK_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REF, FlatpakRef))
+#define FLATPAK_IS_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REF))
+
+FLATPAK_EXTERN GType flatpak_ref_get_type (void);
+
+struct _FlatpakRef
+{
+  GObject parent;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakRefClass;
+
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRef, g_object_unref)
+#endif
+
+/**
+ * FlatpakRefKind:
+ * @FLATPAK_REF_KIND_APP: An application
+ * @FLATPAK_REF_KIND_RUNTIME: A runtime that applications can use.
+ *
+ * The kind of artifact that a FlatpakRef refers to.
+ */
+typedef enum {
+  FLATPAK_REF_KIND_APP,
+  FLATPAK_REF_KIND_RUNTIME,
+} FlatpakRefKind;
+
+FLATPAK_EXTERN const char *  flatpak_ref_get_name (FlatpakRef *self);
+FLATPAK_EXTERN const char *  flatpak_ref_get_arch (FlatpakRef *self);
+FLATPAK_EXTERN const char *  flatpak_ref_get_branch (FlatpakRef *self);
+FLATPAK_EXTERN const char *  flatpak_ref_get_commit (FlatpakRef *self);
+FLATPAK_EXTERN FlatpakRefKind flatpak_ref_get_kind (FlatpakRef *self);
+FLATPAK_EXTERN char *        flatpak_ref_format_ref (FlatpakRef *self);
+FLATPAK_EXTERN FlatpakRef *   flatpak_ref_parse (const char *ref,
+                                                 GError    **error);
+FLATPAK_EXTERN const char *   flatpak_ref_get_collection_id (FlatpakRef *self);
+
+#endif /* __FLATPAK_REF_H__ */
diff --git a/lib/flatpak-related-ref-private.h b/lib/flatpak-related-ref-private.h
new file mode 100644 (file)
index 0000000..7bec4e9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_RELATED_REF_PRIVATE_H__
+#define __FLATPAK_RELATED_REF_PRIVATE_H__
+
+#include <flatpak-related-ref.h>
+#include <flatpak-dir.h>
+
+FlatpakRelatedRef *flatpak_related_ref_new (const char  *collection_id,
+                                            const char  *full_ref,
+                                            const char  *commit,
+                                            char       **subpaths,
+                                            gboolean     download,
+                                            gboolean     delete);
+
+#endif /* __FLATPAK_RELATED_REF_PRIVATE_H__ */
diff --git a/lib/flatpak-related-ref.c b/lib/flatpak-related-ref.c
new file mode 100644 (file)
index 0000000..808ab78
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "flatpak-utils.h"
+#include "flatpak-related-ref.h"
+#include "flatpak-related-ref-private.h"
+#include "flatpak-enum-types.h"
+
+/**
+ * SECTION:flatpak-related-ref
+ * @Title: FlatpakRelatedRef
+ * @Short_description: Related application reference
+ *
+ * A FlatpakRelatedRef provides information about an ref that is related
+ * to another ref. For instance, the local extension ref of an app.
+ *
+ * Since: 0.6.7
+ */
+
+typedef struct _FlatpakRelatedRefPrivate FlatpakRelatedRefPrivate;
+
+struct _FlatpakRelatedRefPrivate
+{
+  char   **subpaths;
+  gboolean download;
+  gboolean delete;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRelatedRef, flatpak_related_ref, FLATPAK_TYPE_REF)
+
+enum {
+  PROP_0,
+
+  PROP_SUBPATHS,
+  PROP_SHOULD_DOWNLOAD,
+  PROP_SHOULD_DELETE,
+};
+
+static void
+flatpak_related_ref_finalize (GObject *object)
+{
+  FlatpakRelatedRef *self = FLATPAK_RELATED_REF (object);
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  g_strfreev (priv->subpaths);
+
+  G_OBJECT_CLASS (flatpak_related_ref_parent_class)->finalize (object);
+}
+
+static void
+flatpak_related_ref_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  FlatpakRelatedRef *self = FLATPAK_RELATED_REF (object);
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_SHOULD_DOWNLOAD:
+      priv->download = g_value_get_boolean (value);
+      break;
+
+    case PROP_SHOULD_DELETE:
+      priv->delete = g_value_get_boolean (value);
+      break;
+
+    case PROP_SUBPATHS:
+      g_clear_pointer (&priv->subpaths, g_strfreev);
+      priv->subpaths = g_strdupv (g_value_get_boxed (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_related_ref_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  FlatpakRelatedRef *self = FLATPAK_RELATED_REF (object);
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_SHOULD_DOWNLOAD:
+      g_value_set_boolean (value, priv->download);
+      break;
+
+    case PROP_SHOULD_DELETE:
+      g_value_set_boolean (value, priv->delete);
+      break;
+
+    case PROP_SUBPATHS:
+      g_value_set_boxed (value, priv->subpaths);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_related_ref_class_init (FlatpakRelatedRefClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_related_ref_get_property;
+  object_class->set_property = flatpak_related_ref_set_property;
+  object_class->finalize = flatpak_related_ref_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_SHOULD_DOWNLOAD,
+                                   g_param_spec_boolean ("should-download",
+                                                         "Should download",
+                                                         "Whether to auto-download the ref with the main ref",
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_SHOULD_DELETE,
+                                   g_param_spec_boolean ("should-delete",
+                                                         "Should delete",
+                                                         "Whether to auto-delete the ref with the main ref",
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   PROP_SUBPATHS,
+                                   g_param_spec_boxed ("subpaths",
+                                                       "",
+                                                       "",
+                                                       G_TYPE_STRV,
+                                                       G_PARAM_READWRITE));
+}
+
+static void
+flatpak_related_ref_init (FlatpakRelatedRef *self)
+{
+}
+
+/**
+ * flatpak_related_ref_get_download:
+ * @self: a #FlatpakRelatedRef
+ *
+ * Returns whether to auto-download the ref with the main ref.
+ *
+ * Returns: %TRUE if the ref should be downloaded with the main ref.
+ *
+ * Since: 0.6.7 
+*/
+gboolean
+flatpak_related_ref_should_download (FlatpakRelatedRef *self)
+{
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  return priv->download;
+}
+
+/**
+ * flatpak_related_ref_should_delete:
+ * @self: a #FlatpakRelatedRef
+ *
+ * Returns whether to auto-delete the ref with the main ref.
+ *
+ * Returns: %TRUE if the ref should be deleted with the main ref.
+ *
+ * Since: 0.6.7 
+ */
+gboolean
+flatpak_related_ref_should_delete (FlatpakRelatedRef *self)
+{
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  return priv->delete;
+}
+
+/**
+ * flatpak_related_ref_get_subpaths:
+ * @self: a #FlatpakRelatedRef
+ *
+ * Returns the subpaths that should be installed/updated for the ref.
+ * This returns %NULL if all files should be installed.
+ *
+ * Returns: (transfer none): A strv, or %NULL
+ *
+ * Since: 0.6.7 
+ */
+const char * const *
+flatpak_related_ref_get_subpaths (FlatpakRelatedRef *self)
+{
+  FlatpakRelatedRefPrivate *priv = flatpak_related_ref_get_instance_private (self);
+
+  return (const char * const *) priv->subpaths;
+}
+
+
+FlatpakRelatedRef *
+flatpak_related_ref_new (const char  *collection_id,
+                         const char  *full_ref,
+                         const char  *commit,
+                         char       **subpaths,
+                         gboolean     download,
+                         gboolean     delete)
+{
+  FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
+  FlatpakRelatedRef *ref;
+
+  g_auto(GStrv) parts = NULL;
+
+  parts = g_strsplit (full_ref, "/", -1);
+
+  if (strcmp (parts[0], "app") != 0)
+    kind = FLATPAK_REF_KIND_RUNTIME;
+
+  /* Canonicalize the "no subpaths" case */
+  if (subpaths && *subpaths == NULL)
+    subpaths = NULL;
+  
+  ref = g_object_new (FLATPAK_TYPE_RELATED_REF,
+                      "kind", kind,
+                      "name", parts[1],
+                      "arch", parts[2],
+                      "branch", parts[3],
+                      "commit", commit,
+                      "subpaths", subpaths,
+                      "should-download", download,
+                      "should-delete", delete,
+#ifdef FLATPAK_ENABLE_P2P
+                      "collection-id", collection_id,
+#endif  /* FLATPAK_ENABLE_P2P */
+                      NULL);
+
+  return ref;
+}
diff --git a/lib/flatpak-related-ref.h b/lib/flatpak-related-ref.h
new file mode 100644 (file)
index 0000000..bb0d717
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_RELATED_REF_H__
+#define __FLATPAK_RELATED_REF_H__
+
+typedef struct _FlatpakRelatedRef FlatpakRelatedRef;
+
+#include <gio/gio.h>
+#include <flatpak-ref.h>
+
+#define FLATPAK_TYPE_RELATED_REF flatpak_related_ref_get_type ()
+#define FLATPAK_RELATED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_RELATED_REF, FlatpakRelatedRef))
+#define FLATPAK_IS_RELATED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_RELATED_REF))
+
+FLATPAK_EXTERN GType flatpak_related_ref_get_type (void);
+
+struct _FlatpakRelatedRef
+{
+  FlatpakRef parent;
+};
+
+typedef struct
+{
+  FlatpakRefClass parent_class;
+} FlatpakRelatedRefClass;
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRelatedRef, g_object_unref)
+#endif
+
+FLATPAK_EXTERN const char * const *flatpak_related_ref_get_subpaths (FlatpakRelatedRef *self);
+FLATPAK_EXTERN gboolean     flatpak_related_ref_should_download (FlatpakRelatedRef *self);
+FLATPAK_EXTERN gboolean     flatpak_related_ref_should_delete (FlatpakRelatedRef *self);
+
+#endif /* __FLATPAK_RELATED_REF_H__ */
diff --git a/lib/flatpak-remote-private.h b/lib/flatpak-remote-private.h
new file mode 100644 (file)
index 0000000..21febf9
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_REMOTE_PRIVATE_H__
+#define __FLATPAK_REMOTE_PRIVATE_H__
+
+#include <flatpak-remote.h>
+#include <flatpak-dir.h>
+#include <ostree.h>
+
+FlatpakRemote *flatpak_remote_new_with_dir (const char *name,
+                                            FlatpakDir *dir);
+
+#ifdef FLATPAK_ENABLE_P2P
+FlatpakRemote *flatpak_remote_new_from_ostree (OstreeRemote     *remote,
+                                               OstreeRepoFinder *repo_finder,
+                                               FlatpakDir       *dir);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+gboolean flatpak_remote_commit (FlatpakRemote   *self,
+                                FlatpakDir      *dir,
+                                GCancellable    *cancellable,
+                                GError         **error);
+
+#endif /* __FLATPAK_REMOTE_PRIVATE_H__ */
diff --git a/lib/flatpak-remote-ref-private.h b/lib/flatpak-remote-ref-private.h
new file mode 100644 (file)
index 0000000..98e43f4
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_REMOTE_REF_PRIVATE_H__
+#define __FLATPAK_REMOTE_REF_PRIVATE_H__
+
+#include <flatpak-remote-ref.h>
+#include <flatpak-dir.h>
+
+FlatpakRemoteRef *flatpak_remote_ref_new (const char *full_ref,
+                                          const char *commit,
+                                          const char *remote_name);
+
+#endif /* __FLATPAK_REMOTE_REF_PRIVATE_H__ */
diff --git a/lib/flatpak-remote-ref.c b/lib/flatpak-remote-ref.c
new file mode 100644 (file)
index 0000000..9a7646f
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "flatpak-utils.h"
+#include "flatpak-remote-ref-private.h"
+#include "flatpak-remote-ref.h"
+#include "flatpak-enum-types.h"
+
+/**
+ * SECTION:flatpak-remote-ref
+ * @Title: FlatpakRemoteRef
+ * @Short_description: Remote application reference
+ *
+ * A FlatpakRemoteRef provides information about an application or runtime
+ * (in short: ref) that is available from a remote repository.
+ */
+typedef struct _FlatpakRemoteRefPrivate FlatpakRemoteRefPrivate;
+
+struct _FlatpakRemoteRefPrivate
+{
+  char *remote_name;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRemoteRef, flatpak_remote_ref, FLATPAK_TYPE_REF)
+
+enum {
+  PROP_0,
+
+  PROP_REMOTE_NAME,
+};
+
+static void
+flatpak_remote_ref_finalize (GObject *object)
+{
+  FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
+  FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
+
+  g_free (priv->remote_name);
+
+  G_OBJECT_CLASS (flatpak_remote_ref_parent_class)->finalize (object);
+}
+
+static void
+flatpak_remote_ref_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+  FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
+  FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_REMOTE_NAME:
+      g_clear_pointer (&priv->remote_name, g_free);
+      priv->remote_name = g_value_dup_string (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_remote_ref_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
+  FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_REMOTE_NAME:
+      g_value_set_string (value, priv->remote_name);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_remote_ref_class_init (FlatpakRemoteRefClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_remote_ref_get_property;
+  object_class->set_property = flatpak_remote_ref_set_property;
+  object_class->finalize = flatpak_remote_ref_finalize;
+
+  g_object_class_install_property (object_class,
+                                   PROP_REMOTE_NAME,
+                                   g_param_spec_string ("remote-name",
+                                                        "Remote Name",
+                                                        "The name of the remote",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+}
+
+static void
+flatpak_remote_ref_init (FlatpakRemoteRef *self)
+{
+}
+
+/**
+ * flatpak_remote_ref_get_remote_name:
+ * @self: a #FlatpakRemoteRef
+ *
+ * Gets the remote name of the ref.
+ *
+ * Returns: (transfer none): the remote name
+ */
+const char *
+flatpak_remote_ref_get_remote_name (FlatpakRemoteRef *self)
+{
+  FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
+
+  return priv->remote_name;
+}
+
+
+FlatpakRemoteRef *
+flatpak_remote_ref_new (const char *full_ref,
+                        const char *commit,
+                        const char *remote_name)
+{
+  FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
+
+  g_auto(GStrv) parts = NULL;
+  FlatpakRemoteRef *ref;
+
+  parts = flatpak_decompose_ref (full_ref, NULL);
+  if (parts == NULL)
+    return NULL;
+
+  if (strcmp (parts[0], "app") != 0)
+    kind = FLATPAK_REF_KIND_RUNTIME;
+
+  ref = g_object_new (FLATPAK_TYPE_REMOTE_REF,
+                      "kind", kind,
+                      "name", parts[1],
+                      "arch", parts[2],
+                      "branch", parts[3],
+                      "commit", commit,
+                      "remote-name", remote_name,
+                      NULL);
+
+  return ref;
+}
diff --git a/lib/flatpak-remote-ref.h b/lib/flatpak-remote-ref.h
new file mode 100644 (file)
index 0000000..203c607
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_REMOTE_REF_H__
+#define __FLATPAK_REMOTE_REF_H__
+
+typedef struct _FlatpakRemoteRef FlatpakRemoteRef;
+
+#include <gio/gio.h>
+#include <flatpak-ref.h>
+
+#define FLATPAK_TYPE_REMOTE_REF flatpak_remote_ref_get_type ()
+#define FLATPAK_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE_REF, FlatpakRemoteRef))
+#define FLATPAK_IS_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE_REF))
+
+FLATPAK_EXTERN GType flatpak_remote_ref_get_type (void);
+
+struct _FlatpakRemoteRef
+{
+  FlatpakRef parent;
+};
+
+typedef struct
+{
+  FlatpakRefClass parent_class;
+} FlatpakRemoteRefClass;
+
+FLATPAK_EXTERN const char * flatpak_remote_ref_get_remote_name (FlatpakRemoteRef *self);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemoteRef, g_object_unref)
+#endif
+
+#endif /* __FLATPAK_REMOTE_REF_H__ */
diff --git a/lib/flatpak-remote.c b/lib/flatpak-remote.c
new file mode 100644 (file)
index 0000000..0364426
--- /dev/null
@@ -0,0 +1,860 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include "flatpak-utils.h"
+#include "flatpak-remote-private.h"
+#include "flatpak-remote-ref-private.h"
+#include "flatpak-enum-types.h"
+
+#include <string.h>
+#include <ostree.h>
+
+#ifdef FLATPAK_ENABLE_P2P
+#include <ostree-repo-finder-avahi.h>
+#endif  /* FLATPAK_ENABLE_P2P */
+
+/**
+ * SECTION:flatpak-remote
+ * @Short_description: Remote repository
+ * @Title: FlatpakRemote
+ *
+ * A #FlatpakRemote object provides information about a remote
+ * repository (or short: remote) that has been configured.
+ *
+ * At its most basic level, a remote has a name and the URL for
+ * the repository. In addition, they provide some additional
+ * information that can be useful when presenting repositories
+ * in a UI, such as a title, a priority or a "don't enumerate"
+ * flags.
+ *
+ * To obtain FlatpakRemote objects for the configured remotes
+ * on a system, use flatpak_installation_list_remotes() or
+ * flatpak_installation_get_remote_by_name().
+ */
+
+typedef struct _FlatpakRemotePrivate FlatpakRemotePrivate;
+
+struct _FlatpakRemotePrivate
+{
+  char       *name;
+  FlatpakDir *dir;
+
+  char       *local_url;
+  char       *local_collection_id;
+  char       *local_title;
+  char       *local_default_branch;
+  gboolean    local_gpg_verify;
+  gboolean    local_noenumerate;
+  gboolean    local_nodeps;
+  gboolean    local_disabled;
+  int         local_prio;
+  FlatpakRemoteType type;
+
+  guint       local_url_set : 1;
+  guint       local_collection_id_set : 1;
+  guint       local_title_set : 1;
+  guint       local_default_branch_set : 1;
+  guint       local_gpg_verify_set : 1;
+  guint       local_noenumerate_set : 1;
+  guint       local_nodeps_set : 1;
+  guint       local_disabled_set : 1;
+  guint       local_prio_set : 1;
+
+  GBytes     *local_gpg_key;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRemote, flatpak_remote, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+
+  PROP_NAME,
+  PROP_TYPE,
+};
+
+static void
+flatpak_remote_finalize (GObject *object)
+{
+  FlatpakRemote *self = FLATPAK_REMOTE (object);
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  g_free (priv->name);
+  if (priv->dir)
+    g_object_unref (priv->dir);
+  if (priv->local_gpg_key)
+    g_bytes_unref (priv->local_gpg_key);
+
+  g_free (priv->local_url);
+  g_free (priv->local_collection_id);
+  g_free (priv->local_title);
+  g_free (priv->local_default_branch);
+
+  G_OBJECT_CLASS (flatpak_remote_parent_class)->finalize (object);
+}
+
+static void
+flatpak_remote_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+  FlatpakRemote *self = FLATPAK_REMOTE (object);
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_NAME:
+      g_clear_pointer (&priv->name, g_free);
+      priv->name = g_value_dup_string (value);
+      break;
+
+    case PROP_TYPE:
+      priv->type = g_value_get_enum (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_remote_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+  FlatpakRemote *self = FLATPAK_REMOTE (object);
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_NAME:
+      g_value_set_string (value, priv->name);
+      break;
+
+    case PROP_TYPE:
+      g_value_set_enum (value, priv->type);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+flatpak_remote_class_init (FlatpakRemoteClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = flatpak_remote_get_property;
+  object_class->set_property = flatpak_remote_set_property;
+  object_class->finalize = flatpak_remote_finalize;
+
+  /**
+   * FlatpakRemote:name:
+   *
+   * Name of the remote, as used in configuration files and when interfacing
+   * with OSTree. This is typically human readable, but could be generated, and
+   * must conform to ostree_validate_remote_name(). It should typically not be
+   * presented in the UI.
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_NAME,
+                                   g_param_spec_string ("name",
+                                                        "Name",
+                                                        "The name of the remote",
+                                                        NULL,
+                                                        G_PARAM_READWRITE));
+
+  /**
+   * FlatpakRemote:type:
+   *
+   * The type of the remote: whether it comes from static configuration files
+   * (@FLATPAK_REMOTE_TYPE_STATIC) or has been dynamically found from the local
+   * network or a mounted USB drive (@FLATPAK_REMOTE_TYPE_LAN,
+   * @FLATPAK_REMOTE_TYPE_USB). Dynamic remotes may be added and removed over
+   * time.
+   *
+   * Since: 0.9.8
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_TYPE,
+                                   g_param_spec_enum ("type",
+                                                      "Type",
+                                                      "The type of the remote",
+                                                      FLATPAK_TYPE_REMOTE_TYPE,
+                                                      FLATPAK_REMOTE_TYPE_STATIC,
+                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+flatpak_remote_init (FlatpakRemote *self)
+{
+}
+
+/**
+ * flatpak_remote_get_name:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the name of the remote repository.
+ *
+ * Returns: (transfer none): the name
+ */
+const char *
+flatpak_remote_get_name (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  return priv->name;
+}
+
+/**
+ * flatpak_remote_get_appstream_dir:
+ * @self: a #FlatpakRemote
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ *
+ * Returns the directory where this remote will store locally cached
+ * appstream information for the specified @arch.
+ *
+ * Returns: (transfer full): a #GFile
+ **/
+GFile *
+flatpak_remote_get_appstream_dir (FlatpakRemote *self,
+                                  const char    *arch)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+  g_autofree char *subdir = NULL;
+
+  if (priv->dir == NULL)
+    return NULL;
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  subdir = g_strdup_printf ("appstream/%s/%s/active", priv->name, arch);
+  return g_file_resolve_relative_path (flatpak_dir_get_path (priv->dir),
+                                       subdir);
+}
+
+/**
+ * flatpak_remote_get_appstream_timestamp:
+ * @self: a #FlatpakRemote
+ * @arch: (nullable): which architecture to fetch (default: current architecture)
+ *
+ * Returns the timestamp file that will be updated whenever the appstream information
+ * has been updated (or tried to update) for the specified @arch.
+ *
+ * Returns: (transfer full): a #GFile
+ **/
+GFile *
+flatpak_remote_get_appstream_timestamp (FlatpakRemote *self,
+                                        const char    *arch)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+  g_autofree char *subdir = NULL;
+
+  if (priv->dir == NULL)
+    return NULL;
+
+  if (arch == NULL)
+    arch = flatpak_get_arch ();
+
+  subdir = g_strdup_printf ("appstream/%s/%s/.timestamp", priv->name, arch);
+  return g_file_resolve_relative_path (flatpak_dir_get_path (priv->dir),
+                                       subdir);
+}
+
+/**
+ * flatpak_remote_get_url:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the repository URL of this remote.
+ *
+ * Returns: (transfer full): the URL
+ */
+char *
+flatpak_remote_get_url (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+  char *url;
+
+  if (priv->local_url_set)
+    return g_strdup (priv->local_url);
+
+  if (priv->dir)
+    {
+      OstreeRepo *repo = flatpak_dir_get_repo (priv->dir);
+      if (ostree_repo_remote_get_url (repo, priv->name, &url, NULL))
+        return url;
+    }
+
+  return NULL;
+}
+
+/**
+ * flatpak_remote_set_url:
+ * @self: a #FlatpakRemote
+ * @url: The new url
+ *
+ * Sets the repository URL of this remote.
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_url (FlatpakRemote *self,
+                        const char    *url)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  g_free (priv->local_url);
+  priv->local_url = g_strdup (url);
+  priv->local_url_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_collection_id:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the repository collection ID of this remote, if set.
+ *
+ * Returns: (transfer full) (nullable): the collection ID, or %NULL if unset
+ */
+char *
+flatpak_remote_get_collection_id (FlatpakRemote *self)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_collection_id_set)
+    return g_strdup (priv->local_collection_id);
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_collection_id (priv->dir, priv->name);
+#endif  /** FLATPAK_ENABLE_P2P */
+
+  return NULL;
+}
+
+/**
+ * flatpak_remote_set_collection_id:
+ * @self: a #FlatpakRemote
+ * @collection_id: (nullable): The new collection ID, or %NULL to unset
+ *
+ * Sets the repository collection ID of this remote.
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_collection_id (FlatpakRemote *self,
+                                  const char    *collection_id)
+{
+#ifdef FLATPAK_ENABLE_P2P
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (collection_id != NULL && *collection_id == '\0')
+    collection_id = NULL;
+
+  g_free (priv->local_collection_id);
+  priv->local_collection_id = g_strdup (collection_id);
+  priv->local_collection_id_set = TRUE;
+#endif  /* FLATPAK_ENABLE_P2P */
+}
+
+/**
+ * flatpak_remote_get_title:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the title of the remote.
+ *
+ * Returns: (transfer full): the title
+ */
+char *
+flatpak_remote_get_title (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_title_set)
+    return g_strdup (priv->local_title);
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_title (priv->dir, priv->name);
+
+  return NULL;
+}
+
+/**
+ * flatpak_remote_set_title:
+ * @self: a #FlatpakRemote
+ * @title: The new title
+ *
+ * Sets the repository title of this remote.
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_title (FlatpakRemote *self,
+                          const char    *title)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  g_free (priv->local_title);
+  priv->local_title = g_strdup (title);
+  priv->local_title_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_default_branch:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the default branch configured for the remote.
+ *
+ * Returns: (transfer full): the default branch, or %NULL
+ *
+ * Since: 0.6.12
+ */
+char *
+flatpak_remote_get_default_branch (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_default_branch_set)
+    return g_strdup (priv->local_default_branch);
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_default_branch (priv->dir, priv->name);
+
+  return NULL;
+}
+
+/**
+ * flatpak_remote_set_default_branch:
+ * @self: a #FlatpakRemote
+ * @default_branch: The new default_branch
+ *
+ * Sets the default branch configured for this remote.
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ *
+ * Since: 0.6.12
+ */
+void
+flatpak_remote_set_default_branch (FlatpakRemote *self,
+                                   const char    *default_branch)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  g_free (priv->local_default_branch);
+  priv->local_default_branch = g_strdup (default_branch);
+  priv->local_default_branch_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_noenumerate:
+ * @self: a #FlatpakRemote
+ *
+ * Returns whether this remote should be used to list applications.
+ *
+ * Returns: whether the remote is marked as "don't enumerate"
+ */
+gboolean
+flatpak_remote_get_noenumerate (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_noenumerate_set)
+    return priv->local_noenumerate;
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_noenumerate (priv->dir, priv->name);
+
+  return FALSE;
+}
+
+/**
+ * flatpak_remote_set_noenumerate:
+ * @self: a #FlatpakRemote
+ * @noenumerate: a bool
+ *
+ * Sets the noenumeration config of this remote. See flatpak_remote_get_noenumerate().
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_noenumerate (FlatpakRemote *self,
+                                gboolean noenumerate)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  priv->local_noenumerate = noenumerate;
+  priv->local_noenumerate_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_nodeps:
+ * @self: a #FlatpakRemote
+ *
+ * Returns whether this remote should be used to find dependencies.
+ *
+ * Returns: whether the remote is marked as "don't use for dependencies"
+ */
+gboolean
+flatpak_remote_get_nodeps (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_nodeps_set)
+    return priv->local_nodeps;
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_nodeps (priv->dir, priv->name);
+
+  return FALSE;
+}
+
+/**
+ * flatpak_remote_set_nodeps:
+ * @self: a #FlatpakRemote
+ * @nodeps: a bool
+ *
+ * Sets the nodeps config of this remote. See flatpak_remote_get_nodeps().
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_nodeps (FlatpakRemote *self,
+                           gboolean nodeps)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  priv->local_nodeps = nodeps;
+  priv->local_nodeps_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_disabled:
+ * @self: a #FlatpakRemote
+ *
+ * Returns whether this remote is disabled.
+ *
+ * Returns: whether the remote is marked as "don't enumerate"
+ */
+gboolean
+flatpak_remote_get_disabled (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_disabled_set)
+    return priv->local_disabled;
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_disabled (priv->dir, priv->name);
+
+  return FALSE;
+}
+/**
+ * flatpak_remote_set_disabled:
+ * @self: a #FlatpakRemote
+ * @disabled: a bool
+ *
+ * Sets the disabled config of this remote. See flatpak_remote_get_disable().
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_disabled (FlatpakRemote *self,
+                             gboolean disabled)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  priv->local_disabled = disabled;
+  priv->local_disabled_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_prio:
+ * @self: a #FlatpakRemote
+ *
+ * Returns the priority for the remote.
+ *
+ * Returns: the priority
+ */
+int
+flatpak_remote_get_prio (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_prio_set)
+    return priv->local_prio;
+
+  if (priv->dir)
+    return flatpak_dir_get_remote_prio (priv->dir, priv->name);
+
+  return 1;
+}
+
+/**
+ * flatpak_remote_set_prio:
+ * @self: a #FlatpakRemote
+ * @prio: a bool
+ *
+ * Sets the prio config of this remote. See flatpak_remote_get_prio().
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_prio (FlatpakRemote *self,
+                         int prio)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  priv->local_prio = prio;
+  priv->local_prio_set = TRUE;
+}
+
+/**
+ * flatpak_remote_get_gpg_verify:
+ * @self: a #FlatpakRemote
+ *
+ * Returns whether GPG verification is enabled for the remote.
+ *
+ * Returns: whether GPG verification is enabled
+ */
+gboolean
+flatpak_remote_get_gpg_verify (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+  gboolean res;
+
+  if (priv->local_gpg_verify_set)
+    return priv->local_gpg_verify;
+
+  if (priv->dir)
+    {
+      OstreeRepo *repo = flatpak_dir_get_repo (priv->dir);
+      if (ostree_repo_remote_get_gpg_verify (repo, priv->name, &res, NULL))
+        return res;
+    }
+
+  return FALSE;
+}
+
+/**
+ * flatpak_remote_set_gpg_verify:
+ * @self: a #FlatpakRemote
+ * @gpg_verify: a bool
+ *
+ * Sets the gpg_verify config of this remote. See flatpak_remote_get_gpg_verify().
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_gpg_verify (FlatpakRemote *self,
+                               gboolean gpg_verify)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  priv->local_gpg_verify = gpg_verify;
+  priv->local_gpg_verify_set = TRUE;
+}
+
+/**
+ * flatpak_remote_set_gpg_key:
+ * @self: a #FlatpakRemote
+ * @gpg_key: a #GBytes with gpg binary key data
+ *
+ * Sets the trusted gpg key for this remote.
+ *
+ * Note: This is a local modification of this object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ */
+void
+flatpak_remote_set_gpg_key (FlatpakRemote *self,
+                            GBytes        *gpg_key)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  if (priv->local_gpg_key != NULL)
+    g_bytes_unref (priv->local_gpg_key);
+  priv->local_gpg_key = g_bytes_ref (gpg_key);
+}
+
+FlatpakRemote *
+flatpak_remote_new_with_dir (const char *name,
+                             FlatpakDir *dir)
+{
+  FlatpakRemotePrivate *priv;
+  FlatpakRemote *self = g_object_new (FLATPAK_TYPE_REMOTE,
+                                      "name", name,
+                                      NULL);
+
+  priv = flatpak_remote_get_instance_private (self);
+  if (dir)
+    priv->dir = g_object_ref (dir);
+
+  return self;
+}
+
+#ifdef FLATPAK_ENABLE_P2P
+static FlatpakRemoteType
+repo_finder_to_remote_type (OstreeRepoFinder *repo_finder)
+{
+  if (OSTREE_IS_REPO_FINDER_AVAHI (repo_finder))
+    return FLATPAK_REMOTE_TYPE_LAN;
+  else if (OSTREE_IS_REPO_FINDER_MOUNT (repo_finder))
+    return FLATPAK_REMOTE_TYPE_USB;
+  else
+    return FLATPAK_REMOTE_TYPE_STATIC;
+}
+
+FlatpakRemote *
+flatpak_remote_new_from_ostree (OstreeRemote     *remote,
+                                OstreeRepoFinder *repo_finder,
+                                FlatpakDir       *dir)
+{
+  FlatpakRemotePrivate *priv;
+  FlatpakRemote *self = g_object_new (FLATPAK_TYPE_REMOTE,
+                                      "name", ostree_remote_get_name (remote),
+                                      "type", repo_finder_to_remote_type (repo_finder),
+                                      NULL);
+
+  priv = flatpak_remote_get_instance_private (self);
+  if (dir)
+    priv->dir = g_object_ref (dir);
+
+  return self;
+}
+#endif  /* FLATPAK_ENABLE_P2P */
+
+/**
+ * flatpak_remote_new:
+ * @name: a name
+ *
+ * Returns a new remote object which can be used to configure a new remote.
+ *
+ * Note: This is a local configuration object, you must commit changes
+ * using flatpak_installation_modify_remote() for the changes to take
+ * effect.
+ *
+ * Returns: (transfer full): a new #FlatpakRemote
+ **/
+FlatpakRemote *
+flatpak_remote_new (const char *name)
+{
+  return flatpak_remote_new_with_dir (name, NULL);
+}
+
+gboolean
+flatpak_remote_commit (FlatpakRemote   *self,
+                       FlatpakDir      *dir,
+                       GCancellable    *cancellable,
+                       GError         **error)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+  g_autofree char *url = NULL;
+  g_autoptr(GKeyFile) config = NULL;
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", priv->name);
+
+  url = flatpak_remote_get_url (self);
+  if (url == NULL || *url == 0)
+    return flatpak_fail (error, "No url specified");
+
+  if (priv->type != FLATPAK_REMOTE_TYPE_STATIC)
+    return flatpak_fail (error, "Dynamic remote cannot be committed");
+
+  config = ostree_repo_copy_config (flatpak_dir_get_repo (dir));
+  if (priv->local_url_set)
+    g_key_file_set_string (config, group, "url", priv->local_url);
+
+  if (priv->local_collection_id_set)
+    {
+      if (priv->local_collection_id != NULL)
+        g_key_file_set_string (config, group, "collection-id", priv->local_collection_id);
+      else
+        g_key_file_remove_key (config, group, "collection-id", NULL);
+    }
+
+  if (priv->local_title_set)
+    g_key_file_set_string (config, group, "xa.title", priv->local_title);
+
+  if (priv->local_default_branch_set)
+    g_key_file_set_string (config, group, "xa.default-branch", priv->local_default_branch);
+
+  if (priv->local_gpg_verify_set)
+    {
+      g_key_file_set_boolean (config, group, "gpg-verify", priv->local_gpg_verify);
+      g_key_file_set_boolean (config, group, "gpg-verify-summary", priv->local_gpg_verify);
+    }
+
+  if (priv->local_noenumerate_set)
+    g_key_file_set_boolean (config, group, "xa.noenumerate", priv->local_noenumerate);
+
+  if (priv->local_disabled_set)
+    g_key_file_set_boolean (config, group, "xa.disable", priv->local_disabled);
+
+  if (priv->local_prio_set)
+    {
+      g_autofree char *prio_as_string = g_strdup_printf ("%d", priv->local_prio);
+      g_key_file_set_string (config, group, "xa.prio", prio_as_string);
+    }
+
+  return flatpak_dir_modify_remote (dir, priv->name, config, priv->local_gpg_key, cancellable, error);
+}
+
+/**
+ * flatpak_remote_get_remote_type:
+ * @self: a #FlatpakRemote
+ *
+ * Get the value of #FlatpakRemote:type.
+ *
+ * Returns: the type of remote this is
+ * Since: 0.9.8
+ */
+FlatpakRemoteType
+flatpak_remote_get_remote_type (FlatpakRemote *self)
+{
+  FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
+
+  g_return_val_if_fail (FLATPAK_IS_REMOTE (self), FLATPAK_REMOTE_TYPE_STATIC);
+
+  return priv->type;
+}
diff --git a/lib/flatpak-remote.h b/lib/flatpak-remote.h
new file mode 100644 (file)
index 0000000..bd4c333
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_REMOTE_H__
+#define __FLATPAK_REMOTE_H__
+
+typedef enum
+{
+  FLATPAK_REMOTE_TYPE_STATIC,
+  FLATPAK_REMOTE_TYPE_USB,
+  FLATPAK_REMOTE_TYPE_LAN,
+} FlatpakRemoteType;
+
+typedef struct _FlatpakRemote FlatpakRemote;
+
+#include <gio/gio.h>
+#include <flatpak-remote-ref.h>
+
+#define FLATPAK_TYPE_REMOTE flatpak_remote_get_type ()
+#define FLATPAK_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE, FlatpakRemote))
+#define FLATPAK_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE))
+
+FLATPAK_EXTERN GType flatpak_remote_get_type (void);
+
+struct _FlatpakRemote
+{
+  GObject parent;
+};
+
+typedef struct
+{
+  GObjectClass parent_class;
+} FlatpakRemoteClass;
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemote, g_object_unref)
+#endif
+
+FLATPAK_EXTERN FlatpakRemote * flatpak_remote_new (const char    *name);
+
+FLATPAK_EXTERN const char *  flatpak_remote_get_name (FlatpakRemote *self);
+FLATPAK_EXTERN GFile *       flatpak_remote_get_appstream_dir (FlatpakRemote *self,
+                                                               const char    *arch);
+FLATPAK_EXTERN GFile *       flatpak_remote_get_appstream_timestamp (FlatpakRemote *self,
+                                                                     const char    *arch);
+FLATPAK_EXTERN char *        flatpak_remote_get_url (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_url (FlatpakRemote *self,
+                                                     const char    *url);
+FLATPAK_EXTERN char *        flatpak_remote_get_collection_id (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_collection_id (FlatpakRemote *self,
+                                                               const char    *collection_id);
+FLATPAK_EXTERN char *        flatpak_remote_get_title (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_title (FlatpakRemote *self,
+                                                       const char    *title);
+FLATPAK_EXTERN char *        flatpak_remote_get_default_branch (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_default_branch (FlatpakRemote *self,
+                                                                const char    *default_branch);
+FLATPAK_EXTERN gboolean      flatpak_remote_get_gpg_verify (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_gpg_verify (FlatpakRemote *self,
+                                                            gboolean       gpg_verify);
+FLATPAK_EXTERN void          flatpak_remote_set_gpg_key (FlatpakRemote *self,
+                                                         GBytes        *gpg_key);
+FLATPAK_EXTERN gboolean      flatpak_remote_get_noenumerate (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_noenumerate (FlatpakRemote *self,
+                                                             gboolean       noenumerate);
+FLATPAK_EXTERN gboolean      flatpak_remote_get_nodeps (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_nodeps (FlatpakRemote *self,
+                                                        gboolean       nodeps);
+FLATPAK_EXTERN gboolean      flatpak_remote_get_disabled (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_disabled (FlatpakRemote *self,
+                                                          gboolean       disabled);
+FLATPAK_EXTERN int           flatpak_remote_get_prio (FlatpakRemote *self);
+FLATPAK_EXTERN void          flatpak_remote_set_prio (FlatpakRemote *self,
+                                                      int            prio);
+
+FLATPAK_EXTERN FlatpakRemoteType flatpak_remote_get_remote_type (FlatpakRemote *self);
+
+
+#endif /* __FLATPAK_REMOTE_H__ */
diff --git a/lib/flatpak-version-macros.h b/lib/flatpak-version-macros.h
new file mode 100644 (file)
index 0000000..529b77d
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined (__FLATPAK_H_INSIDE__) && !defined (FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_VERSION_MACROS_H__
+#define __FLATPAK_VERSION_MACROS_H__
+
+#define FLATPAK_MAJOR_VERSION (0)
+#define FLATPAK_MINOR_VERSION (10)
+#define FLATPAK_MICRO_VERSION (2)
+
+#define FLATPAK_CHECK_VERSION(major,minor,micro)        \
+    (FLATPAK_MAJOR_VERSION > (major) || \
+     (FLATPAK_MAJOR_VERSION == (major) && FLATPAK_MINOR_VERSION > (minor)) || \
+     (FLATPAK_MAJOR_VERSION == (major) && FLATPAK_MINOR_VERSION == (minor) && \
+      FLATPAK_MICRO_VERSION >= (micro)))
+
+#ifndef FLATPAK_EXTERN
+#define FLATPAK_EXTERN extern
+#endif
+
+/**
+ * SECTION:flatpak-version-macros
+ * @Title: Version information
+ */
+
+#endif /* __FLATPAK_VERSION_MACROS_H__ */
diff --git a/lib/flatpak-version-macros.h.in b/lib/flatpak-version-macros.h.in
new file mode 100644 (file)
index 0000000..efa1142
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#if !defined (__FLATPAK_H_INSIDE__) && !defined (FLATPAK_COMPILATION)
+#error "Only <flatpak.h> can be included directly."
+#endif
+
+#ifndef __FLATPAK_VERSION_MACROS_H__
+#define __FLATPAK_VERSION_MACROS_H__
+
+#define FLATPAK_MAJOR_VERSION (@FLATPAK_MAJOR_VERSION@)
+#define FLATPAK_MINOR_VERSION (@FLATPAK_MINOR_VERSION@)
+#define FLATPAK_MICRO_VERSION (@FLATPAK_MICRO_VERSION@)
+
+#define FLATPAK_CHECK_VERSION(major,minor,micro)        \
+    (FLATPAK_MAJOR_VERSION > (major) || \
+     (FLATPAK_MAJOR_VERSION == (major) && FLATPAK_MINOR_VERSION > (minor)) || \
+     (FLATPAK_MAJOR_VERSION == (major) && FLATPAK_MINOR_VERSION == (minor) && \
+      FLATPAK_MICRO_VERSION >= (micro)))
+
+#ifndef FLATPAK_EXTERN
+#define FLATPAK_EXTERN extern
+#endif
+
+/**
+ * SECTION:flatpak-version-macros
+ * @Title: Version information
+ */
+
+#endif /* __FLATPAK_VERSION_MACROS_H__ */
diff --git a/lib/flatpak.c b/lib/flatpak.c
new file mode 100644 (file)
index 0000000..91c5098
--- /dev/null
@@ -0,0 +1,3 @@
+#include "config.h"
+
+#include "flatpak-version-macros.h"
diff --git a/lib/flatpak.h b/lib/flatpak.h
new file mode 100644 (file)
index 0000000..ef72dd6
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_H__
+#define __FLATPAK_H__
+
+#define __FLATPAK_H_INSIDE__
+
+#include <gio/gio.h>
+
+#include <flatpak-version-macros.h>
+#include <flatpak-enum-types.h>
+#include <flatpak-error.h>
+#include <flatpak-ref.h>
+#include <flatpak-installed-ref.h>
+#include <flatpak-remote-ref.h>
+#include <flatpak-related-ref.h>
+#include <flatpak-bundle-ref.h>
+#include <flatpak-remote.h>
+#include <flatpak-installation.h>
+
+#undef __FLATPAK_H_INSIDE__
+
+#endif /* __FLATPAK_H__ */
diff --git a/lib/test-lib.c b/lib/test-lib.c
new file mode 100644 (file)
index 0000000..38566be
--- /dev/null
@@ -0,0 +1,457 @@
+#include "config.h"
+
+#include "libglnx/libglnx.h"
+
+#include <flatpak.h>
+#include <gio/gunixoutputstream.h>
+
+
+static void
+progress_cb (const char *status,
+             guint       progress,
+             gboolean    estimating,
+             gpointer    user_data)
+{
+  g_print ("status: %s, progress: %d estimating: %d, user_data: %p\n", status, progress, estimating, user_data);
+}
+
+static gboolean
+monitor_callback (GFileMonitor    * monitor,
+                  GFile           * child,
+                  GFile           * other_file,
+                  GFileMonitorEvent eflags)
+{
+  g_print ("Database changed\n");
+  return TRUE;
+}
+
+int
+main (int argc, char *argv[])
+{
+  FlatpakInstallation *installation;
+  FlatpakInstalledRef *app1;
+  FlatpakInstalledRef *app2;
+  FlatpakRemoteRef *remote_ref;
+
+  g_autoptr(GPtrArray) remotes = NULL;
+  GError *error = NULL;
+  int i, j, k;
+
+  installation = flatpak_installation_new_user (NULL, &error);
+  if (installation == NULL)
+    {
+      g_print ("error: %s\n", error->message);
+      return 1;
+    }
+
+  if (0)
+    {
+      const char *list[] = { "gnome-apps", "app/org.gnome.iagno/x86_64/stable",
+                             "gnome", "runtime/org.gnome.Sdk/x86_64/3.20" };
+
+      for (j = 0; j < G_N_ELEMENTS(list); j += 2)
+        {
+          g_print ("looking for related to ref: %s\n", list[j+1]);
+
+          for (k = 0; k < 2; k++)
+            {
+              g_autoptr(GError) error = NULL;
+              g_autoptr(GPtrArray) related = NULL;
+
+
+              if (k == 0)
+                related = flatpak_installation_list_remote_related_refs_sync (installation,
+                                                                              list[j],
+                                                                              list[j+1],
+                                                                              NULL,
+                                                                              &error);
+              else
+                related = flatpak_installation_list_installed_related_refs_sync (installation,
+                                                                                 list[j],
+                                                                                 list[j+1],
+                                                                                 NULL,
+                                                                                 &error);
+
+              if (related == NULL)
+                {
+                  g_warning ("Error: %s", error->message);
+                  continue;
+                }
+
+              g_print ("%s related:\n", (k == 0) ? "remote" : "local");
+              for (i = 0; i < related->len; i++)
+                {
+                  FlatpakRelatedRef *rel = g_ptr_array_index (related, i);
+                  const char * const *subpaths = flatpak_related_ref_get_subpaths (rel);
+                  g_autofree char *subpaths_str = NULL;
+
+                  if (subpaths)
+                    {
+                      g_autofree char *subpaths_joined = g_strjoinv (",", (char **) subpaths);
+                      subpaths_str = g_strdup_printf (" subpaths: %s", subpaths_joined);
+                    }
+                  else
+                    subpaths_str = g_strdup ("");
+                  g_print ("%d %s %s %s %s dl:%d del:%d%s\n",
+                           flatpak_ref_get_kind (FLATPAK_REF (rel)),
+                           flatpak_ref_get_name (FLATPAK_REF (rel)),
+                           flatpak_ref_get_arch (FLATPAK_REF (rel)),
+                           flatpak_ref_get_branch (FLATPAK_REF (rel)),
+                           flatpak_ref_get_commit (FLATPAK_REF (rel)),
+                           flatpak_related_ref_should_download (rel),
+                           flatpak_related_ref_should_delete (rel),
+                           subpaths_str);
+                }
+            }
+        }
+
+      return 0;
+    }
+
+  if (argc == 4)
+    {
+      GFileMonitor * monitor = flatpak_installation_create_monitor (installation, NULL, NULL);
+      GMainLoop *main_loop;
+
+      g_signal_connect (monitor, "changed", (GCallback) monitor_callback, NULL);
+      main_loop = g_main_loop_new (NULL, FALSE);
+      g_main_loop_run (main_loop);
+    }
+
+  if (argc == 3)
+    {
+      app1 = flatpak_installation_install (installation,
+                                           argv[1],
+                                           FLATPAK_REF_KIND_APP,
+                                           argv[2],
+                                           NULL, NULL,
+                                           progress_cb, (gpointer) 0xdeadbeef,
+                                           NULL, &error);
+      if (app1 == NULL)
+        g_print ("Error: %s\n", error->message);
+      else
+        g_print ("Installed %s: %s\n", argv[2],
+                 flatpak_ref_get_commit (FLATPAK_REF (app1)));
+
+      return 0;
+    }
+
+  if (argc == 2)
+    {
+      app1 = flatpak_installation_update (installation,
+                                          FLATPAK_UPDATE_FLAGS_NONE,
+                                          FLATPAK_REF_KIND_APP,
+                                          argv[1],
+                                          NULL, NULL,
+                                          progress_cb, (gpointer) 0xdeadbeef,
+                                          NULL, &error);
+      if (app1 == NULL)
+        g_print ("Error: %s\n", error->message);
+      else
+        g_print ("Updated %s: %s\n", argv[1],
+                 flatpak_ref_get_commit (FLATPAK_REF (app1)));
+
+      return 0;
+    }
+
+  g_print ("\n**** Loading bundle\n");
+  {
+    g_autoptr(GFile) f = g_file_new_for_commandline_arg ("tests/hello.pak");
+    g_autoptr(FlatpakBundleRef) bundle = flatpak_bundle_ref_new (f, &error);
+    if (bundle == NULL)
+      {
+        g_print ("Error loading bundle: %s\n", error->message);
+        g_clear_error (&error);
+      }
+    else
+      {
+        g_autofree char *path = g_file_get_path (flatpak_bundle_ref_get_file (bundle));
+        g_autoptr(GBytes) metadata = flatpak_bundle_ref_get_metadata (bundle);
+        g_autoptr(GBytes) appdata = flatpak_bundle_ref_get_appstream (bundle);
+        g_print ("%d %s %s %s %s %s %"G_GUINT64_FORMAT "\n%s\n",
+                 flatpak_ref_get_kind (FLATPAK_REF (bundle)),
+                 flatpak_ref_get_name (FLATPAK_REF (bundle)),
+                 flatpak_ref_get_arch (FLATPAK_REF (bundle)),
+                 flatpak_ref_get_branch (FLATPAK_REF (bundle)),
+                 flatpak_ref_get_commit (FLATPAK_REF (bundle)),
+                 path,
+                 flatpak_bundle_ref_get_installed_size (bundle),
+                 (char *) g_bytes_get_data (metadata, NULL));
+
+        if (appdata != NULL)
+          {
+            g_autoptr(GZlibDecompressor) decompressor = NULL;
+            g_autoptr(GOutputStream) out2 = NULL;
+            g_autoptr(GOutputStream) out = NULL;
+
+            out = g_unix_output_stream_new (1, FALSE);
+            decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
+            out2 = g_converter_output_stream_new (out, G_CONVERTER (decompressor));
+
+            if (!g_output_stream_write_all (out2,
+                                            g_bytes_get_data (appdata, NULL),
+                                            g_bytes_get_size (appdata),
+                                            NULL, NULL, &error))
+              {
+                g_print ("Error decompressing appdata: %s\n", error->message);
+                g_clear_error (&error);
+              }
+          }
+      }
+  }
+
+  g_print ("\n**** Checking for updates\n");
+  {
+    g_autoptr(GPtrArray) updates =
+      flatpak_installation_list_installed_refs_for_update (installation,
+                                                           NULL, &error);
+
+    if (updates == NULL)
+      {
+        g_print ("check for updates error: %s\n", error->message);
+        g_clear_error (&error);
+      }
+    else
+      {
+        for (i = 0; i < updates->len; i++)
+          {
+            FlatpakInstalledRef *ref = g_ptr_array_index (updates, i);
+            g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
+                     flatpak_ref_get_kind (FLATPAK_REF (ref)),
+                     flatpak_ref_get_name (FLATPAK_REF (ref)),
+                     flatpak_ref_get_arch (FLATPAK_REF (ref)),
+                     flatpak_ref_get_branch (FLATPAK_REF (ref)),
+                     flatpak_ref_get_commit (FLATPAK_REF (ref)),
+                     flatpak_installed_ref_get_latest_commit (ref),
+                     flatpak_installed_ref_get_origin (ref),
+                     flatpak_installed_ref_get_deploy_dir (ref),
+                     flatpak_installed_ref_get_is_current (ref),
+                     flatpak_installed_ref_get_installed_size (ref));
+          }
+      }
+  }
+
+  g_print ("\n**** Listing all installed refs\n");
+  {
+    g_autoptr(GPtrArray) refs = NULL;
+
+    refs = flatpak_installation_list_installed_refs (installation,
+                                                     NULL, NULL);
+
+    for (i = 0; i < refs->len; i++)
+      {
+        FlatpakInstalledRef *ref = g_ptr_array_index (refs, i);
+        g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
+                 flatpak_ref_get_kind (FLATPAK_REF (ref)),
+                 flatpak_ref_get_name (FLATPAK_REF (ref)),
+                 flatpak_ref_get_arch (FLATPAK_REF (ref)),
+                 flatpak_ref_get_branch (FLATPAK_REF (ref)),
+                 flatpak_ref_get_commit (FLATPAK_REF (ref)),
+                 flatpak_installed_ref_get_latest_commit (ref),
+                 flatpak_installed_ref_get_origin (ref),
+                 flatpak_installed_ref_get_deploy_dir (ref),
+                 flatpak_installed_ref_get_is_current (ref),
+                 flatpak_installed_ref_get_installed_size (ref));
+      }
+  }
+
+  g_print ("**** Listing all installed apps\n");
+  {
+    g_autoptr(GPtrArray) apps = NULL;
+
+    apps = flatpak_installation_list_installed_refs_by_kind (installation,
+                                                             FLATPAK_REF_KIND_APP,
+                                                             NULL, NULL);
+
+    for (i = 0; i < apps->len; i++)
+      {
+        FlatpakInstalledRef *app = g_ptr_array_index (apps, i);
+
+        g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
+                 flatpak_ref_get_kind (FLATPAK_REF (app)),
+                 flatpak_ref_get_name (FLATPAK_REF (app)),
+                 flatpak_ref_get_arch (FLATPAK_REF (app)),
+                 flatpak_ref_get_branch (FLATPAK_REF (app)),
+                 flatpak_ref_get_commit (FLATPAK_REF (app)),
+                 flatpak_installed_ref_get_latest_commit (app),
+                 flatpak_installed_ref_get_origin (app),
+                 flatpak_installed_ref_get_deploy_dir (app),
+                 flatpak_installed_ref_get_is_current (app),
+                 flatpak_installed_ref_get_installed_size (app));
+        g_print ("metadata:\n%s\n", (char *) g_bytes_get_data (flatpak_installed_ref_load_metadata (app, NULL, NULL), NULL));
+      }
+  }
+
+  g_print ("\n**** Listing all installed runtimes\n");
+  {
+    g_autoptr(GPtrArray) runtimes = NULL;
+
+    runtimes = flatpak_installation_list_installed_refs_by_kind (installation,
+                                                                 FLATPAK_REF_KIND_RUNTIME,
+                                                                 NULL, NULL);
+
+    for (i = 0; i < runtimes->len; i++)
+      {
+        FlatpakInstalledRef *runtime = g_ptr_array_index (runtimes, i);
+        g_print ("%d %s %s %s %s %s %s %d\n",
+                 flatpak_ref_get_kind (FLATPAK_REF (runtime)),
+                 flatpak_ref_get_name (FLATPAK_REF (runtime)),
+                 flatpak_ref_get_arch (FLATPAK_REF (runtime)),
+                 flatpak_ref_get_branch (FLATPAK_REF (runtime)),
+                 flatpak_ref_get_commit (FLATPAK_REF (runtime)),
+                 flatpak_installed_ref_get_origin (runtime),
+                 flatpak_installed_ref_get_deploy_dir (runtime),
+                 flatpak_installed_ref_get_is_current (runtime));
+      }
+  }
+
+  g_print ("\n**** Getting installed gedit master\n");
+  app1 = flatpak_installation_get_installed_ref (installation,
+                                                 FLATPAK_REF_KIND_APP,
+                                                 "org.gnome.gedit",
+                                                 NULL, "master", NULL, NULL);
+  if (app1)
+    {
+      g_print ("gedit master: %d %s %s %s %s %s %s %d\n",
+               flatpak_ref_get_kind (FLATPAK_REF (app1)),
+               flatpak_ref_get_name (FLATPAK_REF (app1)),
+               flatpak_ref_get_arch (FLATPAK_REF (app1)),
+               flatpak_ref_get_branch (FLATPAK_REF (app1)),
+               flatpak_ref_get_commit (FLATPAK_REF (app1)),
+               flatpak_installed_ref_get_origin (app1),
+               flatpak_installed_ref_get_deploy_dir (app1),
+               flatpak_installed_ref_get_is_current (app1));
+    }
+  if (!flatpak_installation_launch (installation,
+                                    "org.gnome.gedit",
+                                    NULL, NULL, NULL,
+                                    NULL, &error))
+    {
+      g_print ("launch gedit error: %s\n", error->message);
+      g_clear_error (&error);
+    }
+
+  g_print ("\n**** Getting current installed gedit\n");
+  app2 = flatpak_installation_get_current_installed_app (installation,
+                                                         "org.gnome.gedit",
+                                                         NULL, NULL);
+  if (app2)
+    {
+      g_print ("gedit current: %d %s %s %s %s %s %s %d\n",
+               flatpak_ref_get_kind (FLATPAK_REF (app2)),
+               flatpak_ref_get_name (FLATPAK_REF (app2)),
+               flatpak_ref_get_arch (FLATPAK_REF (app2)),
+               flatpak_ref_get_branch (FLATPAK_REF (app2)),
+               flatpak_ref_get_commit (FLATPAK_REF (app2)),
+               flatpak_installed_ref_get_origin (app2),
+               flatpak_installed_ref_get_deploy_dir (app2),
+               flatpak_installed_ref_get_is_current (app2));
+    }
+
+
+  g_print ("\n**** Listing remotes\n");
+  remotes = flatpak_installation_list_remotes (installation,
+                                               NULL, NULL);
+
+  for (i = 0; i < remotes->len; i++)
+    {
+      FlatpakRemote *remote = g_ptr_array_index (remotes, i);
+      g_autoptr(GPtrArray) refs = NULL;
+      const char *collection_id = NULL;
+
+#ifdef FLATPAK_ENABLE_P2P
+      collection_id = flatpak_remote_get_collection_id (remote);
+#endif  /* !FLATPAK_ENABLE_P2P */
+
+      g_print ("\nRemote: %s %u %d %s %s %s %s %d %d %s\n",
+               flatpak_remote_get_name (remote),
+               flatpak_remote_get_remote_type (remote),
+               flatpak_remote_get_prio (remote),
+               flatpak_remote_get_url (remote),
+               collection_id,
+               flatpak_remote_get_title (remote),
+               flatpak_remote_get_default_branch (remote),
+               flatpak_remote_get_gpg_verify (remote),
+               flatpak_remote_get_noenumerate (remote),
+               g_file_get_path (flatpak_remote_get_appstream_dir (remote, NULL)));
+
+      g_print ("\n**** Listing remote refs on %s\n", flatpak_remote_get_name (remote));
+      refs = flatpak_installation_list_remote_refs_sync (installation, flatpak_remote_get_name (remote),
+                                                         NULL, NULL);
+      if (refs)
+        {
+          for (j = 0; j < refs->len; j++)
+            {
+              FlatpakRemoteRef *ref = g_ptr_array_index (refs, j);
+              g_print ("%d %s %s %s %s %s\n",
+                       flatpak_ref_get_kind (FLATPAK_REF (ref)),
+                       flatpak_ref_get_name (FLATPAK_REF (ref)),
+                       flatpak_ref_get_arch (FLATPAK_REF (ref)),
+                       flatpak_ref_get_branch (FLATPAK_REF (ref)),
+                       flatpak_ref_get_commit (FLATPAK_REF (ref)),
+                       flatpak_remote_ref_get_remote_name (ref));
+
+              if (j == 0)
+                {
+                  guint64 download_size;
+                  guint64 installed_size;
+
+                  if (!flatpak_installation_fetch_remote_size_sync (installation,
+                                                                    flatpak_remote_get_name (remote),
+                                                                    FLATPAK_REF (ref),
+                                                                    &download_size,
+                                                                    &installed_size,
+                                                                    NULL, &error))
+                    {
+                      g_print ("error fetching sizes: %s\n", error->message);
+                      g_clear_error (&error);
+                    }
+                  else
+                    {
+                      g_print ("Download size: %"G_GUINT64_FORMAT " Installed size: %"G_GUINT64_FORMAT "\n",
+                               download_size, installed_size);
+                    }
+
+                }
+            }
+        }
+
+      g_print ("\n**** Getting remote platform 3.20 on %s\n", flatpak_remote_get_name (remote));
+      error = NULL;
+      remote_ref = flatpak_installation_fetch_remote_ref_sync (installation, flatpak_remote_get_name (remote),
+                                                               FLATPAK_REF_KIND_RUNTIME,
+                                                               "org.gnome.Platform", NULL, "3.20",
+                                                               NULL, &error);
+      if (remote_ref)
+        {
+          GBytes *metadata;
+
+          g_print ("%d %s %s %s %s %s\n",
+                   flatpak_ref_get_kind (FLATPAK_REF (remote_ref)),
+                   flatpak_ref_get_name (FLATPAK_REF (remote_ref)),
+                   flatpak_ref_get_arch (FLATPAK_REF (remote_ref)),
+                   flatpak_ref_get_branch (FLATPAK_REF (remote_ref)),
+                   flatpak_ref_get_commit (FLATPAK_REF (remote_ref)),
+                   flatpak_remote_ref_get_remote_name (remote_ref));
+
+          metadata = flatpak_installation_fetch_remote_metadata_sync (installation, flatpak_remote_get_name (remote),
+                                                                      FLATPAK_REF (remote_ref), NULL, &error);
+          if (metadata)
+            {
+              g_print ("metadata: %s\n", (char *) g_bytes_get_data (metadata, NULL));
+            }
+          else
+            {
+              g_print ("fetch error\n");
+              g_print ("error: %s\n", error->message);
+              g_clear_error (&error);
+            }
+        }
+      else
+        {
+          g_print ("error: %s\n", error->message);
+          g_clear_error (&error);
+        }
+    }
+  return 0;
+}
diff --git a/libglnx/COPYING b/libglnx/COPYING
new file mode 100644 (file)
index 0000000..4362b49
--- /dev/null
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/libglnx/Makefile-libglnx.am.inc b/libglnx/Makefile-libglnx.am.inc
new file mode 100644 (file)
index 0000000..ff2700c
--- /dev/null
@@ -0,0 +1,78 @@
+# Copyright (C) 2015 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+EXTRA_DIST += \
+       libglnx/README.md \
+       libglnx/COPYING \
+       libglnx/libglnx.m4 \
+       $(NULL)
+
+libglnx_la_SOURCES = \
+       libglnx/glnx-macros.h \
+       libglnx/glnx-backport-autocleanups.h \
+       libglnx/glnx-backport-autoptr.h \
+       libglnx/glnx-backports.h \
+       libglnx/glnx-backports.c \
+       libglnx/glnx-local-alloc.h \
+       libglnx/glnx-local-alloc.c \
+       libglnx/glnx-errors.h \
+       libglnx/glnx-errors.c \
+       libglnx/glnx-console.h \
+       libglnx/glnx-console.c \
+       libglnx/glnx-dirfd.h \
+       libglnx/glnx-dirfd.c \
+       libglnx/glnx-fdio.h \
+       libglnx/glnx-fdio.c \
+       libglnx/glnx-lockfile.h \
+       libglnx/glnx-lockfile.c \
+       libglnx/glnx-missing-syscall.h \
+       libglnx/glnx-missing.h \
+       libglnx/glnx-xattrs.h \
+       libglnx/glnx-xattrs.c \
+       libglnx/glnx-shutil.h \
+       libglnx/glnx-shutil.c \
+       libglnx/libglnx.h \
+       libglnx/tests/libglnx-testlib.h \
+       $(NULL)
+
+libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic 
+libglnx_la_LIBADD = $(libglnx_libs)
+
+libglnx_tests = test-libglnx-xattrs test-libglnx-fdio test-libglnx-errors test-libglnx-macros test-libglnx-shutil
+TESTS += $(libglnx_tests)
+
+check_PROGRAMS += $(libglnx_tests)
+test_libglnx_xattrs_SOURCES = libglnx/tests/test-libglnx-xattrs.c
+test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la
+
+test_libglnx_fdio_SOURCES = libglnx/tests/test-libglnx-fdio.c
+test_libglnx_fdio_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_fdio_LDADD = $(libglnx_libs) libglnx.la
+
+test_libglnx_errors_SOURCES = libglnx/tests/test-libglnx-errors.c
+test_libglnx_errors_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_errors_LDADD = $(libglnx_libs) libglnx.la
+
+test_libglnx_macros_SOURCES = libglnx/tests/test-libglnx-macros.c
+test_libglnx_macros_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_macros_LDADD = $(libglnx_libs) libglnx.la
+
+test_libglnx_shutil_SOURCES = libglnx/tests/test-libglnx-shutil.c
+test_libglnx_shutil_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_shutil_LDADD = $(libglnx_libs) libglnx.la
diff --git a/libglnx/README.md b/libglnx/README.md
new file mode 100644 (file)
index 0000000..8fb2faa
--- /dev/null
@@ -0,0 +1,52 @@
+libglnx is the successor to libgsystem: https://git.gnome.org/browse/libgsystem
+
+It is for modules which depend on both GLib and Linux, intended to be
+used as a git submodule.
+
+Features:
+
+ - File APIs which use `openat()` like APIs, but also take a `GCancellable`
+   to support dynamic cancellation
+ - APIs also have a `GError` parameter
+ - High level "shutil", somewhat inspired by Python's
+ - A "console" API for tty output
+ - A backport of the GLib cleanup macros for projects which can't yet take
+   a dependency on 2.40.
+
+Why?
+----
+
+There are multiple projects which have a hard dependency on Linux and
+GLib, such as NetworkManager, ostree, flatpak, etc.  It makes sense
+for them to be able to share Linux-specific APIs.
+
+This module also contains some code taken from systemd, which has very
+high quality LGPLv2+ shared library code, but most of the internal
+shared library is private, and not namespaced.
+
+One could also compare this project to gnulib; the salient differences
+there are that at least some of this module is eventually destined for
+inclusion in GLib.
+
+Porting from libgsystem
+-----------------------
+
+For all of the filesystem access code, libglnx exposes only
+fd-relative API, not `GFile*`.  It does use `GCancellable` where
+applicable.
+
+For local allocation macros, you should start using the `g_auto`
+macros from GLib.  A backport is included in libglnx.  There are a few
+APIs not defined in GLib yet, such as `glnx_fd_close`.
+
+`gs_transfer_out_value` is replaced by `g_steal_pointer`.
+
+Contributing
+------------
+
+Currently there is not a Bugzilla product - one may be created
+in the future.  You can submit PRs against the Github mirror:
+
+https://github.com/GNOME/libglnx/pulls
+
+Or alternatively, email one of the maintainers directly.
diff --git a/libglnx/glnx-backport-autocleanups.h b/libglnx/glnx-backport-autocleanups.h
new file mode 100644 (file)
index 0000000..cc24961
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright © 2015 Canonical Limited
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Ryan Lortie <desrt@desrt.ca>
+ */
+
+#pragma once
+
+#include <glnx-backport-autoptr.h>
+
+#if !GLIB_CHECK_VERSION(2, 43, 4)
+
+static inline void
+g_autoptr_cleanup_generic_gfree (void *p)
+{ 
+  void **pp = (void**)p;
+  if (*pp)
+    g_free (*pp);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free)
+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref)
+
+/* Add GObject-based types as needed. */
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCancellable, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFile, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIOStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInfo, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileMonitor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryInputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusConnection, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMessage, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref)
+
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 45, 8)
+
+static inline void
+g_autoptr_cleanup_gstring_free (GString *string)
+{
+  if (string)
+    g_string_free (string, TRUE);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free)
+
+#endif
diff --git a/libglnx/glnx-backport-autoptr.h b/libglnx/glnx-backport-autoptr.h
new file mode 100644 (file)
index 0000000..b36919d
--- /dev/null
@@ -0,0 +1,133 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2015 Colin Walters <walters@verbum.org>
+ * 
+ * GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#if !GLIB_CHECK_VERSION(2, 43, 4)
+
+#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
+#define _GLIB_AUTOPTR_TYPENAME(TypeName)  TypeName##_autoptr
+#define _GLIB_AUTO_FUNC_NAME(TypeName)    glib_auto_cleanup_##TypeName
+#define _GLIB_CLEANUP(func)               __attribute__((cleanup(func)))
+#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \
+  typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName);                                          \
+  static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) {                     \
+    _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); }                                        \
+
+
+/* these macros are API */
+#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \
+  typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName);                                                           \
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                              \
+  static inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); }         \
+  G_GNUC_END_IGNORE_DEPRECATIONS
+#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                              \
+  static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); }                         \
+  G_GNUC_END_IGNORE_DEPRECATIONS
+#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                              \
+  static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); }     \
+  G_GNUC_END_IGNORE_DEPRECATIONS
+#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName)
+#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName
+#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree)
+
+/**
+ * g_steal_pointer:
+ * @pp: a pointer to a pointer
+ *
+ * Sets @pp to %NULL, returning the value that was there before.
+ *
+ * Conceptually, this transfers the ownership of the pointer from the
+ * referenced variable to the "caller" of the macro (ie: "steals" the
+ * reference).
+ *
+ * The return value will be properly typed, according to the type of
+ * @pp.
+ *
+ * This can be very useful when combined with g_autoptr() to prevent the
+ * return value of a function from being automatically freed.  Consider
+ * the following example (which only works on GCC and clang):
+ *
+ * |[
+ * GObject *
+ * create_object (void)
+ * {
+ *   g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL);
+ *
+ *   if (early_error_case)
+ *     return NULL;
+ *
+ *   return g_steal_pointer (&obj);
+ * }
+ * ]|
+ *
+ * It can also be used in similar ways for 'out' parameters and is
+ * particularly useful for dealing with optional out parameters:
+ *
+ * |[
+ * gboolean
+ * get_object (GObject **obj_out)
+ * {
+ *   g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL);
+ *
+ *   if (early_error_case)
+ *     return FALSE;
+ *
+ *   if (obj_out)
+ *     *obj_out = g_steal_pointer (&obj);
+ *
+ *   return TRUE;
+ * }
+ * ]|
+ *
+ * In the above example, the object will be automatically freed in the
+ * early error case and also in the case that %NULL was given for
+ * @obj_out.
+ *
+ * Since: 2.44
+ */
+static inline gpointer
+(g_steal_pointer) (gpointer pp)
+{
+  gpointer *ptr = (gpointer *) pp;
+  gpointer ref;
+
+  ref = *ptr;
+  *ptr = NULL;
+
+  return ref;
+}
+
+/* type safety */
+#define g_steal_pointer(pp) \
+  (0 ? (*(pp)) : (g_steal_pointer) (pp))
+
+#endif /* !GLIB_CHECK_VERSION(2, 43, 3) */
+
+G_END_DECLS
diff --git a/libglnx/glnx-backports.c b/libglnx/glnx-backports.c
new file mode 100644 (file)
index 0000000..c7bb600
--- /dev/null
@@ -0,0 +1,61 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2015 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "glnx-backports.h"
+
+#if !GLIB_CHECK_VERSION(2, 44, 0)
+gboolean
+glnx_strv_contains (const gchar * const *strv,
+                    const gchar         *str)
+{
+  g_return_val_if_fail (strv != NULL, FALSE);
+  g_return_val_if_fail (str != NULL, FALSE);
+
+  for (; *strv != NULL; strv++)
+    {
+      if (g_str_equal (str, *strv))
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+gboolean
+glnx_set_object (GObject **object_ptr,
+                 GObject  *new_object)
+{
+  GObject *old_object = *object_ptr;
+
+  if (old_object == new_object)
+    return FALSE;
+
+  if (new_object != NULL)
+    g_object_ref (new_object);
+
+  *object_ptr = new_object;
+
+  if (old_object != NULL)
+    g_object_unref (old_object);
+
+  return TRUE;
+}
+#endif
diff --git a/libglnx/glnx-backports.h b/libglnx/glnx-backports.h
new file mode 100644 (file)
index 0000000..cd853cc
--- /dev/null
@@ -0,0 +1,46 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2015 Colin Walters <walters@verbum.org>
+ * 
+ * GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#if !GLIB_CHECK_VERSION(2, 44, 0)
+
+#define g_strv_contains glnx_strv_contains
+gboolean              glnx_strv_contains  (const gchar * const *strv,
+                                           const gchar         *str);
+
+#define g_set_object(object_ptr, new_object) \
+ (/* Check types match. */ \
+  0 ? *(object_ptr) = (new_object), FALSE : \
+  glnx_set_object ((GObject **) (object_ptr), (GObject *) (new_object)) \
+ )
+gboolean              glnx_set_object  (GObject **object_ptr,
+                                        GObject  *new_object);
+
+#endif /* !GLIB_CHECK_VERSION(2, 44, 0) */
+
+G_END_DECLS
diff --git a/libglnx/glnx-console.c b/libglnx/glnx-console.c
new file mode 100644 (file)
index 0000000..c6d9331
--- /dev/null
@@ -0,0 +1,309 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013,2014,2015 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "glnx-console.h"
+
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+
+static char *current_text = NULL;
+static gint current_percent = -1;
+static gboolean locked;
+
+static gboolean
+stdout_is_tty (void)
+{
+  static gsize initialized = 0;
+  static gboolean stdout_is_tty_v;
+
+  if (g_once_init_enter (&initialized))
+    {
+      stdout_is_tty_v = isatty (1);
+      g_once_init_leave (&initialized, 1);
+    }
+
+  return stdout_is_tty_v;
+}
+
+static volatile guint cached_columns = 0;
+static volatile guint cached_lines = 0;
+
+static int
+fd_columns (int fd)
+{
+  struct winsize ws = {};
+
+  if (ioctl (fd, TIOCGWINSZ, &ws) < 0)
+    return -errno;
+
+  if (ws.ws_col <= 0)
+    return -EIO;
+
+  return ws.ws_col;
+}
+
+/**
+ * glnx_console_columns:
+ * 
+ * Returns: The number of columns for terminal output
+ */
+guint
+glnx_console_columns (void)
+{
+  if (G_UNLIKELY (cached_columns == 0))
+    {
+      int c;
+
+      c = fd_columns (STDOUT_FILENO);
+
+      if (c <= 0)
+        c = 80;
+
+      if (c > 256)
+        c = 256;
+
+      cached_columns = c;
+    }
+
+  return cached_columns;
+}
+
+static int
+fd_lines (int fd)
+{
+  struct winsize ws = {};
+
+  if (ioctl (fd, TIOCGWINSZ, &ws) < 0)
+    return -errno;
+
+  if (ws.ws_row <= 0)
+    return -EIO;
+
+  return ws.ws_row;
+}
+
+/**
+ * glnx_console_lines:
+ * 
+ * Returns: The number of lines for terminal output
+ */
+guint
+glnx_console_lines (void)
+{
+  if (G_UNLIKELY (cached_lines == 0))
+    {
+      int l;
+
+      l = fd_lines (STDOUT_FILENO);
+
+      if (l <= 0)
+        l = 24;
+
+      cached_lines = l;
+    }
+
+  return cached_lines;
+}
+
+static void
+on_sigwinch (int signum)
+{
+  cached_columns = 0;
+  cached_lines = 0;
+}
+
+void
+glnx_console_lock (GLnxConsoleRef *console)
+{
+  static gsize sigwinch_initialized = 0;
+
+  g_return_if_fail (!locked);
+  g_return_if_fail (!console->locked);
+
+  console->is_tty = stdout_is_tty ();
+
+  locked = console->locked = TRUE;
+
+  current_percent = 0;
+
+  if (console->is_tty)
+    {
+      if (g_once_init_enter (&sigwinch_initialized))
+        {
+          signal (SIGWINCH, on_sigwinch);
+          g_once_init_leave (&sigwinch_initialized, 1);
+        }
+      
+      { static const char initbuf[] = { '\n', 0x1B, 0x37 };
+        (void) fwrite (initbuf, 1, sizeof (initbuf), stdout);
+      }
+    }
+}
+
+static void
+printpad (const char *padbuf,
+          guint       padbuf_len,
+          guint       n)
+{
+  const guint d = n / padbuf_len;
+  const guint r = n % padbuf_len;
+  guint i;
+
+  for (i = 0; i < d; i++)
+    fwrite (padbuf, 1, padbuf_len, stdout);
+  fwrite (padbuf, 1, r, stdout);
+}
+
+static void
+text_percent_internal (const char *text,
+                       int percentage)
+{
+  static const char equals[] = "====================";
+  const guint n_equals = sizeof (equals) - 1;
+  static const char spaces[] = "                    ";
+  const guint n_spaces = sizeof (spaces) - 1;
+  const guint ncolumns = glnx_console_columns ();
+  const guint bar_min = 10;
+
+  if (text && !*text)
+    text = NULL;
+
+  const guint input_textlen = text ? strlen (text) : 0;
+
+  if (percentage == current_percent
+      && g_strcmp0 (text, current_text) == 0)
+    return;
+
+  if (!stdout_is_tty ())
+    {
+      if (text)
+        fprintf (stdout, "%s", text);
+      if (percentage != -1)
+        {
+          if (text)
+            fputc (' ', stdout);
+          fprintf (stdout, "%u%%", percentage);
+        }
+      fputc ('\n', stdout);
+      fflush (stdout);
+      return;
+    }
+
+  if (ncolumns < bar_min)
+    return; /* TODO: spinner */
+
+  /* Restore cursor */
+  { const char beginbuf[2] = { 0x1B, 0x38 };
+    (void) fwrite (beginbuf, 1, sizeof (beginbuf), stdout);
+  }
+
+  if (percentage == -1)
+    {
+      if (text != NULL)
+        fwrite (text, 1, input_textlen, stdout);
+
+      /* Overwrite remaining space, if any */
+      if (ncolumns > input_textlen)
+        printpad (spaces, n_spaces, ncolumns - input_textlen);
+    }
+  else
+    {
+      const guint textlen = MIN (input_textlen, ncolumns - bar_min);
+      const guint barlen = ncolumns - (textlen + 1);;
+
+      if (textlen > 0)
+        {
+          fwrite (text, 1, textlen, stdout);
+          fputc (' ', stdout);
+        }
+
+      {
+        const guint nbraces = 2;
+        const guint textpercent_len = 5;
+        const guint bar_internal_len = barlen - nbraces - textpercent_len;
+        const guint eqlen = bar_internal_len * (percentage / 100.0);
+        const guint spacelen = bar_internal_len - eqlen; 
+
+        fputc ('[', stdout);
+        printpad (equals, n_equals, eqlen);
+        printpad (spaces, n_spaces, spacelen);
+        fputc (']', stdout);
+        fprintf (stdout, " %3d%%", percentage);
+      }
+    }
+
+  fflush (stdout);
+}
+
+/**
+ * glnx_console_progress_text_percent:
+ * @text: Show this text before the progress bar
+ * @percentage: An integer in the range of 0 to 100
+ *
+ * On a tty, print to the console @text followed by an ASCII art
+ * progress bar whose percentage is @percentage.  If stdout is not a
+ * tty, a more basic line by line change will be printed.
+ *
+ * You must have called glnx_console_lock() before invoking this
+ * function.
+ *
+ */
+void
+glnx_console_progress_text_percent (const char *text,
+                                    guint percentage)
+{
+  g_return_if_fail (percentage <= 100);
+
+  text_percent_internal (text, percentage);
+}
+
+void
+glnx_console_text (const char *text)
+{
+  text_percent_internal (text, -1);
+}
+
+/**
+ * glnx_console_unlock:
+ *
+ * Print a newline, and reset all cached console progress state.
+ *
+ * This function does nothing if stdout is not a tty.
+ */
+void
+glnx_console_unlock (GLnxConsoleRef *console)
+{
+  g_return_if_fail (locked);
+  g_return_if_fail (console->locked);
+
+  current_percent = -1;
+  g_clear_pointer (&current_text, g_free);
+
+  if (console->is_tty)
+    fputc ('\n', stdout);
+      
+  locked = console->locked = FALSE;
+}
diff --git a/libglnx/glnx-console.h b/libglnx/glnx-console.h
new file mode 100644 (file)
index 0000000..8c1d811
--- /dev/null
@@ -0,0 +1,55 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013,2014,2015 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-backport-autocleanups.h>
+
+G_BEGIN_DECLS
+
+struct GLnxConsoleRef {
+  gboolean locked;
+  gboolean is_tty;
+};
+
+typedef struct GLnxConsoleRef GLnxConsoleRef;
+
+void    glnx_console_lock (GLnxConsoleRef *ref);
+
+void    glnx_console_text (const char     *text);
+
+void    glnx_console_progress_text_percent (const char     *text,
+                                             guint           percentage);
+
+void    glnx_console_unlock (GLnxConsoleRef *ref);
+
+guint    glnx_console_lines (void);
+
+guint    glnx_console_columns (void);
+
+static inline void
+glnx_console_ref_cleanup (GLnxConsoleRef *p)
+{
+  if (p->locked)
+    glnx_console_unlock (p);
+}
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxConsoleRef, glnx_console_ref_cleanup)
+
+G_END_DECLS
diff --git a/libglnx/glnx-dirfd.c b/libglnx/glnx-dirfd.c
new file mode 100644 (file)
index 0000000..e6c3319
--- /dev/null
@@ -0,0 +1,432 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glnx-dirfd.h>
+#include <glnx-fdio.h>
+#include <glnx-errors.h>
+#include <glnx-local-alloc.h>
+#include <glnx-shutil.h>
+
+/**
+ * glnx_opendirat_with_errno:
+ * @dfd: File descriptor for origin directory
+ * @name: Pathname, relative to @dfd
+ * @follow: Whether or not to follow symbolic links
+ *
+ * Use openat() to open a directory, using a standard set of flags.
+ * This function sets errno.
+ */
+int
+glnx_opendirat_with_errno (int           dfd,
+                           const char   *path,
+                           gboolean      follow)
+{
+  int flags = O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY;
+  if (!follow)
+    flags |= O_NOFOLLOW;
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  return openat (dfd, path, flags);
+}
+
+/**
+ * glnx_opendirat:
+ * @dfd: File descriptor for origin directory
+ * @path: Pathname, relative to @dfd
+ * @follow: Whether or not to follow symbolic links
+ * @error: Error
+ *
+ * Use openat() to open a directory, using a standard set of flags.
+ */
+gboolean
+glnx_opendirat (int             dfd,
+                const char     *path,
+                gboolean        follow,
+                int            *out_fd,
+                GError        **error)
+{
+  int ret = glnx_opendirat_with_errno (dfd, path, follow);
+  if (ret == -1)
+    return glnx_throw_errno_prefix (error, "opendir(%s)", path);
+  *out_fd = ret;
+  return TRUE;
+}
+
+struct GLnxRealDirfdIterator
+{
+  gboolean initialized;
+  int fd;
+  DIR *d;
+};
+typedef struct GLnxRealDirfdIterator GLnxRealDirfdIterator;
+
+/**
+ * glnx_dirfd_iterator_init_at:
+ * @dfd: File descriptor, may be AT_FDCWD or -1
+ * @path: Path, may be relative to @dfd
+ * @follow: If %TRUE and the last component of @path is a symlink, follow it
+ * @out_dfd_iter: (out caller-allocates): A directory iterator, will be initialized
+ * @error: Error
+ *
+ * Initialize @out_dfd_iter from @dfd and @path.
+ */
+gboolean
+glnx_dirfd_iterator_init_at (int                     dfd,
+                             const char             *path,
+                             gboolean                follow,
+                             GLnxDirFdIterator      *out_dfd_iter,
+                             GError                **error)
+{
+  glnx_fd_close int fd = -1;
+  if (!glnx_opendirat (dfd, path, follow, &fd, error))
+    return FALSE;
+
+  if (!glnx_dirfd_iterator_init_take_fd (&fd, out_dfd_iter, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+/**
+ * glnx_dirfd_iterator_init_take_fd:
+ * @dfd: File descriptor - ownership is taken, and the value is set to -1
+ * @dfd_iter: A directory iterator
+ * @error: Error
+ *
+ * Steal ownership of @dfd, using it to initialize @dfd_iter for
+ * iteration.
+ */
+gboolean
+glnx_dirfd_iterator_init_take_fd (int               *dfd,
+                                  GLnxDirFdIterator *dfd_iter,
+                                  GError           **error)
+{
+  GLnxRealDirfdIterator *real_dfd_iter = (GLnxRealDirfdIterator*) dfd_iter;
+  DIR *d = fdopendir (*dfd);
+  if (!d)
+    return glnx_throw_errno_prefix (error, "fdopendir");
+
+  real_dfd_iter->fd = glnx_steal_fd (dfd);
+  real_dfd_iter->d = d;
+  real_dfd_iter->initialized = TRUE;
+
+  return TRUE;
+}
+
+/**
+ * glnx_dirfd_iterator_next_dent:
+ * @dfd_iter: A directory iterator
+ * @out_dent: (out) (transfer none): Pointer to dirent; do not free
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Read the next value from @dfd_iter, causing @out_dent to be
+ * updated.  If end of stream is reached, @out_dent will be set
+ * to %NULL, and %TRUE will be returned.
+ */
+gboolean
+glnx_dirfd_iterator_next_dent (GLnxDirFdIterator  *dfd_iter,
+                               struct dirent     **out_dent,
+                               GCancellable       *cancellable,
+                               GError             **error)
+{
+  GLnxRealDirfdIterator *real_dfd_iter = (GLnxRealDirfdIterator*) dfd_iter;
+
+  g_return_val_if_fail (out_dent, FALSE);
+  g_return_val_if_fail (dfd_iter->initialized, FALSE);
+
+  if (g_cancellable_set_error_if_cancelled (cancellable, error))
+    return FALSE;
+
+  do
+    {
+      errno = 0;
+      *out_dent = readdir (real_dfd_iter->d);
+      if (*out_dent == NULL && errno != 0)
+        return glnx_throw_errno_prefix (error, "readdir");
+    } while (*out_dent &&
+             (strcmp ((*out_dent)->d_name, ".") == 0 ||
+              strcmp ((*out_dent)->d_name, "..") == 0));
+
+  return TRUE;
+}
+
+/**
+ * glnx_dirfd_iterator_next_dent_ensure_dtype:
+ * @dfd_iter: A directory iterator
+ * @out_dent: (out) (transfer none): Pointer to dirent; do not free
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * A variant of @glnx_dirfd_iterator_next_dent, which will ensure the
+ * `dent->d_type` member is filled in by calling `fstatat`
+ * automatically if the underlying filesystem type sets `DT_UNKNOWN`.
+ */
+gboolean
+glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator  *dfd_iter,
+                                            struct dirent     **out_dent,
+                                            GCancellable       *cancellable,
+                                            GError            **error)
+{
+  struct dirent *ret_dent;
+
+  g_return_val_if_fail (out_dent, FALSE);
+
+  if (!glnx_dirfd_iterator_next_dent (dfd_iter, out_dent, cancellable, error))
+    return FALSE;
+
+  ret_dent = *out_dent;
+
+  if (ret_dent)
+    {
+
+      if (ret_dent->d_type == DT_UNKNOWN)
+        {
+          struct stat stbuf;
+          if (!glnx_fstatat (dfd_iter->fd, ret_dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW, error))
+            return FALSE;
+          ret_dent->d_type = IFTODT (stbuf.st_mode);
+        }
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_dirfd_iterator_clear:
+ * @dfd_iter: Iterator, will be de-initialized
+ *
+ * Unset @dfd_iter, freeing any resources.  If @dfd_iter is not
+ * initialized, do nothing.
+ */
+void
+glnx_dirfd_iterator_clear (GLnxDirFdIterator *dfd_iter)
+{
+  GLnxRealDirfdIterator *real_dfd_iter = (GLnxRealDirfdIterator*) dfd_iter;
+  /* fd is owned by dfd_iter */
+  if (!real_dfd_iter->initialized)
+    return;
+  (void) closedir (real_dfd_iter->d);
+  real_dfd_iter->initialized = FALSE;
+}
+
+/**
+ * glnx_fdrel_abspath:
+ * @dfd: Directory fd
+ * @path: Path
+ *
+ * Turn a fd-relative pair into something that can be used for legacy
+ * APIs expecting absolute paths.
+ *
+ * This is Linux specific, and only valid inside this process (unless
+ * you set up the child process to have the exact same fd number, but
+ * don't try that).
+ */
+char *
+glnx_fdrel_abspath (int         dfd,
+                    const char *path)
+{
+  dfd = glnx_dirfd_canonicalize (dfd);
+  if (dfd == AT_FDCWD)
+    return g_strdup (path);
+  return g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
+}
+
+/**
+ * glnx_gen_temp_name:
+ * @tmpl: (type filename): template directory name, the last 6 characters will be replaced
+ *
+ * Replace the last 6 characters of @tmpl with random ASCII.  You must
+ * use this in combination with a mechanism to ensure race-free file
+ * creation such as `O_EXCL`.
+ */
+void
+glnx_gen_temp_name (gchar *tmpl)
+{
+  size_t len;
+  char *XXXXXX;
+  int i;
+  static const char letters[] =
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+  static const int NLETTERS = sizeof (letters) - 1;
+
+  g_return_if_fail (tmpl != NULL);
+  len = strlen (tmpl);
+  g_return_if_fail (len >= 6);
+
+  XXXXXX = tmpl + (len - 6);
+
+  for (i = 0; i < 6; i++)
+    XXXXXX[i] = letters[g_random_int_range(0, NLETTERS)];
+}
+
+/**
+ * glnx_mkdtempat:
+ * @dfd: Directory fd
+ * @tmpl: (type filename): Initial template directory name, last 6 characters will be replaced
+ * @mode: permissions with which to create the temporary directory
+ * @out_tmpdir: (out caller-allocates): Initialized tempdir structure
+ * @error: Error
+ *
+ * Somewhat similar to g_mkdtemp_full(), but fd-relative, and returns a
+ * structure that uses autocleanups.  Note that the supplied @dfd lifetime
+ * must match or exceed that of @out_tmpdir in order to remove the directory.
+ */
+gboolean
+glnx_mkdtempat (int dfd, const char *tmpl, int mode,
+                GLnxTmpDir *out_tmpdir, GError **error)
+{
+  g_return_val_if_fail (tmpl != NULL, FALSE);
+  g_return_val_if_fail (out_tmpdir != NULL, FALSE);
+  g_return_val_if_fail (!out_tmpdir->initialized, FALSE);
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  g_autofree char *path = g_strdup (tmpl);
+  for (int count = 0; count < 100; count++)
+    {
+      glnx_gen_temp_name (path);
+
+      /* Ideally we could use openat(O_DIRECTORY | O_CREAT | O_EXCL) here
+       * to create and open the directory atomically, but that’s not supported by
+       * current kernel versions: http://www.openwall.com/lists/oss-security/2014/11/26/14
+       * (Tested on kernel 4.10.10-200.fc25.x86_64). For the moment, accept a
+       * TOCTTOU race here. */
+      if (mkdirat (dfd, path, mode) == -1)
+        {
+          if (errno == EEXIST)
+            continue;
+
+          /* Any other error will apply also to other names we might
+           *  try, and there are 2^32 or so of them, so give up now.
+           */
+          return glnx_throw_errno_prefix (error, "mkdirat");
+        }
+
+      /* And open it */
+      glnx_fd_close int ret_dfd = -1;
+      if (!glnx_opendirat (dfd, path, FALSE, &ret_dfd, error))
+        {
+          /* If we fail to open, let's try to clean up */
+          (void)unlinkat (dfd, path, AT_REMOVEDIR);
+          return FALSE;
+        }
+
+      /* Return the initialized directory struct */
+      out_tmpdir->initialized = TRUE;
+      out_tmpdir->src_dfd = dfd; /* referenced; see above docs */
+      out_tmpdir->fd = glnx_steal_fd (&ret_dfd);
+      out_tmpdir->path = g_steal_pointer (&path);
+      return TRUE;
+    }
+
+  /* Failure */
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
+               "glnx_mkdtempat ran out of combinations to try");
+  return FALSE;
+}
+
+/**
+ * glnx_mkdtemp:
+ * @tmpl: (type filename): Source template directory name, last 6 characters will be replaced
+ * @mode: permissions to create the temporary directory with
+ * @out_tmpdir: (out caller-allocates): Return location for tmpdir data
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Similar to glnx_mkdtempat(), but will use g_get_tmp_dir() as the parent
+ * directory to @tmpl.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+gboolean
+glnx_mkdtemp (const gchar   *tmpl,
+              int      mode,
+              GLnxTmpDir *out_tmpdir,
+              GError **error)
+{
+  g_autofree char *path = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
+  return glnx_mkdtempat (AT_FDCWD, path, mode,
+                         out_tmpdir, error);
+}
+
+static gboolean
+_glnx_tmpdir_free (GLnxTmpDir *tmpd,
+                   gboolean    delete_dir,
+                   GCancellable *cancellable,
+                   GError    **error)
+{
+  /* Support being passed NULL so we work nicely in a GPtrArray */
+  if (!(tmpd && tmpd->initialized))
+    return TRUE;
+  g_assert_cmpint (tmpd->fd, !=, -1);
+  glnx_close_fd (&tmpd->fd);
+  g_assert (tmpd->path);
+  g_assert_cmpint (tmpd->src_dfd, !=, -1);
+  g_autofree char *path = tmpd->path; /* Take ownership */
+  tmpd->initialized = FALSE;
+  if (delete_dir)
+    {
+      if (!glnx_shutil_rm_rf_at (tmpd->src_dfd, path, cancellable, error))
+        return FALSE;
+    }
+  return TRUE;
+}
+
+/**
+ * glnx_tmpdir_delete:
+ * @tmpf: Temporary dir
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Deallocate a tmpdir, closing the fd and recursively deleting the path. This
+ * is normally called indirectly via glnx_tmpdir_cleanup() by the autocleanup
+ * attribute, but you can also invoke this directly.
+ *
+ * If an error occurs while deleting the filesystem path, @tmpf will still have
+ * been deallocated and should not be reused.
+ *
+ * See also `glnx_tmpdir_unset` to avoid deleting the path.
+ */
+gboolean
+glnx_tmpdir_delete (GLnxTmpDir *tmpf, GCancellable *cancellable, GError **error)
+{
+  return _glnx_tmpdir_free (tmpf, TRUE, cancellable, error);
+}
+
+/**
+ * glnx_tmpdir_unset:
+ * @tmpf: Temporary dir
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Deallocate a tmpdir, but do not delete the filesystem path.  See also
+ * `glnx_tmpdir_delete()`.
+ */
+void
+glnx_tmpdir_unset (GLnxTmpDir *tmpf)
+{
+  (void) _glnx_tmpdir_free (tmpf, FALSE, NULL, NULL);
+}
diff --git a/libglnx/glnx-dirfd.h b/libglnx/glnx-dirfd.h
new file mode 100644 (file)
index 0000000..0046ac8
--- /dev/null
@@ -0,0 +1,137 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-backport-autocleanups.h>
+#include <glnx-macros.h>
+#include <glnx-errors.h>
+#include <limits.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+G_BEGIN_DECLS
+/**
+ * glnx_dirfd_canonicalize:
+ * @fd: A directory file descriptor
+ *
+ * It's often convenient in programs to use `-1` for "unassigned fd",
+ * and also because gobject-introspection doesn't support `AT_FDCWD`,
+ * libglnx honors `-1` to mean `AT_FDCWD`.  This small inline function
+ * canonicalizes `-1 -> AT_FDCWD`.
+ */
+static inline int
+glnx_dirfd_canonicalize (int fd)
+{
+  if (fd == -1)
+    return AT_FDCWD;
+  return fd;
+}
+
+struct GLnxDirFdIterator {
+  gboolean initialized;
+  int fd;
+  gpointer padding_data[4];
+};
+
+typedef struct GLnxDirFdIterator GLnxDirFdIterator;
+gboolean glnx_dirfd_iterator_init_at (int dfd, const char *path,
+                                    gboolean follow,
+                                    GLnxDirFdIterator *dfd_iter, GError **error);
+gboolean glnx_dirfd_iterator_init_take_fd (int *dfd, GLnxDirFdIterator *dfd_iter, GError **error);
+gboolean glnx_dirfd_iterator_next_dent (GLnxDirFdIterator  *dfd_iter,
+                                        struct dirent     **out_dent,
+                                        GCancellable       *cancellable,
+                                        GError            **error);
+gboolean glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator  *dfd_iter,
+                                                     struct dirent     **out_dent,
+                                                     GCancellable       *cancellable,
+                                                     GError            **error);
+void glnx_dirfd_iterator_clear (GLnxDirFdIterator *dfd_iter);
+
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxDirFdIterator, glnx_dirfd_iterator_clear)
+
+int glnx_opendirat_with_errno (int           dfd,
+                               const char   *path,
+                               gboolean      follow);
+
+gboolean glnx_opendirat (int             dfd,
+                         const char     *path,
+                         gboolean        follow,
+                         int            *out_fd,
+                         GError        **error);
+
+char *glnx_fdrel_abspath (int         dfd,
+                          const char *path);
+
+void glnx_gen_temp_name (gchar *tmpl);
+
+/**
+ * glnx_ensure_dir:
+ * @dfd: directory fd
+ * @path: Directory path
+ * @mode: Mode
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Wrapper around mkdirat() which adds #GError support, ensures that
+ * it retries on %EINTR, and also ignores `EEXIST`.
+ *
+ * See also `glnx_shutil_mkdir_p_at()` for recursive handling.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ */
+static inline gboolean
+glnx_ensure_dir (int           dfd,
+                 const char   *path,
+                 mode_t        mode,
+                 GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (mkdirat (dfd, path, mode)) != 0)
+    {
+      if (G_UNLIKELY (errno != EEXIST))
+        return glnx_throw_errno_prefix (error, "mkdirat(%s)", path);
+    }
+  return TRUE;
+}
+
+typedef struct {
+  gboolean initialized;
+  int src_dfd;
+  int fd;
+  char *path;
+} GLnxTmpDir;
+gboolean glnx_tmpdir_delete (GLnxTmpDir *tmpf, GCancellable *cancellable, GError **error);
+void glnx_tmpdir_unset (GLnxTmpDir *tmpf);
+static inline void
+glnx_tmpdir_cleanup (GLnxTmpDir *tmpf)
+{
+  (void)glnx_tmpdir_delete (tmpf, NULL, NULL);
+}
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxTmpDir, glnx_tmpdir_cleanup)
+
+gboolean glnx_mkdtempat (int dfd, const char *tmpl, int mode,
+                         GLnxTmpDir *out_tmpdir, GError **error);
+
+gboolean glnx_mkdtemp (const char *tmpl, int      mode,
+                       GLnxTmpDir *out_tmpdir, GError **error);
+
+G_END_DECLS
diff --git a/libglnx/glnx-errors.c b/libglnx/glnx-errors.c
new file mode 100644 (file)
index 0000000..4800873
--- /dev/null
@@ -0,0 +1,56 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glnx-backport-autocleanups.h>
+#include <glnx-errors.h>
+
+void
+glnx_real_set_prefix_error_va (GError     *error,
+                               const char *format,
+                               va_list     args)
+{
+  if (error == NULL)
+    return;
+
+  g_autofree char *old_msg = g_steal_pointer (&error->message);
+  g_autoptr(GString) buf = g_string_new ("");
+  g_string_append_vprintf (buf, format, args);
+  g_string_append (buf, ": ");
+  g_string_append (buf, old_msg);
+  error->message = g_string_free (g_steal_pointer (&buf), FALSE);
+}
+
+void
+glnx_real_set_prefix_error_from_errno_va (GError     **error,
+                                          gint         errsv,
+                                          const char  *format,
+                                          va_list      args)
+{
+  if (!error)
+    return;
+
+  g_set_error_literal (error,
+                       G_IO_ERROR,
+                       g_io_error_from_errno (errsv),
+                       g_strerror (errsv));
+  glnx_real_set_prefix_error_va (*error, format, args);
+}
diff --git a/libglnx/glnx-errors.h b/libglnx/glnx-errors.h
new file mode 100644 (file)
index 0000000..5a6fe19
--- /dev/null
@@ -0,0 +1,197 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-backport-autocleanups.h>
+#include <errno.h>
+
+G_BEGIN_DECLS
+
+/* Set @error with G_IO_ERROR/G_IO_ERROR_FAILED.
+ *
+ * This function returns %FALSE so it can be used conveniently in a single
+ * statement:
+ *
+ * ```
+ *   if (strcmp (foo, "somevalue") != 0)
+ *     return glnx_throw (error, "key must be somevalue, not '%s'", foo);
+ * ```
+ */
+static inline gboolean G_GNUC_PRINTF (2,3)
+glnx_throw (GError **error, const char *fmt, ...)
+{
+  if (error == NULL)
+    return FALSE;
+
+  va_list args;
+  va_start (args, fmt);
+  GError *new = g_error_new_valist (G_IO_ERROR, G_IO_ERROR_FAILED, fmt, args);
+  va_end (args);
+  g_propagate_error (error, g_steal_pointer (&new));
+  return FALSE;
+}
+
+/* Like `glnx_throw ()`, but returns %NULL. */
+#define glnx_null_throw(error, args...) \
+  ({glnx_throw (error, args); NULL;})
+
+/* Implementation detail of glnx_throw_prefix() */
+void glnx_real_set_prefix_error_va (GError     *error,
+                                    const char *format,
+                                    va_list     args) G_GNUC_PRINTF (2,0);
+
+/* Prepend to @error's message by `$prefix: ` where `$prefix` is computed via
+ * printf @fmt. Returns %FALSE so it can be used conveniently in a single
+ * statement:
+ *
+ * ```
+ *   if (!function_that_fails (s, error))
+ *     return glnx_throw_prefix (error, "while handling '%s'", s);
+ * ```
+ * */
+static inline gboolean G_GNUC_PRINTF (2,3)
+glnx_prefix_error (GError **error, const char *fmt, ...)
+{
+  if (error == NULL)
+    return FALSE;
+
+  va_list args;
+  va_start (args, fmt);
+  glnx_real_set_prefix_error_va (*error, fmt, args);
+  va_end (args);
+  return FALSE;
+}
+
+/* Like `glnx_prefix_error ()`, but returns %NULL. */
+#define glnx_prefix_error_null(error, args...) \
+  ({glnx_prefix_error (error, args); NULL;})
+
+/**
+ * GLNX_AUTO_PREFIX_ERROR:
+ *
+ * An autocleanup-based macro to automatically call `g_prefix_error()` (also with a colon+space `: `)
+ * when it goes out of scope.  This is useful when one wants error strings built up by the callee
+ * function, not all callers.
+ *
+ * ```
+ * gboolean start_http_request (..., GError **error)
+ * {
+ *   GLNX_AUTO_PREFIX_ERROR ("HTTP request", error)
+ *
+ *   if (!libhttp_request_start (..., error))
+ *     return FALSE;
+ *   ...
+ *   return TRUE;
+ * ```
+ */
+typedef struct {
+  const char *prefix;
+  GError **error;
+} GLnxAutoErrorPrefix;
+static inline void
+glnx_cleanup_auto_prefix_error (GLnxAutoErrorPrefix *prefix)
+{
+  if (prefix->error && *(prefix->error))
+    g_prefix_error (prefix->error, "%s: ", prefix->prefix);
+}
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxAutoErrorPrefix, glnx_cleanup_auto_prefix_error)
+#define GLNX_AUTO_PREFIX_ERROR(text, error) \
+  G_GNUC_UNUSED g_auto(GLnxAutoErrorPrefix) _GLNX_MAKE_ANONYMOUS(_glnxautoprefixerror_) = { text, error }
+
+/* Set @error using the value of `g_strerror (errno)`.
+ *
+ * This function returns %FALSE so it can be used conveniently in a single
+ * statement:
+ *
+ * ```
+ *   if (unlinkat (fd, somepathname) < 0)
+ *     return glnx_throw_errno (error);
+ * ```
+ */
+static inline gboolean
+glnx_throw_errno (GError **error)
+{
+  /* Save the value of errno, in case one of the
+   * intermediate function calls happens to set it.
+   */
+  int errsv = errno;
+  g_set_error_literal (error, G_IO_ERROR,
+                       g_io_error_from_errno (errsv),
+                       g_strerror (errsv));
+  /* We also restore the value of errno, since that's
+   * what was done in a long-ago libgsystem commit
+   * https://git.gnome.org/browse/libgsystem/commit/?id=ed106741f7a0596dc8b960b31fdae671d31d666d
+   * but I certainly can't remember now why I did that.
+   */
+  errno = errsv;
+  return FALSE;
+}
+
+/* Like glnx_throw_errno(), but yields a NULL pointer. */
+#define glnx_null_throw_errno(error) \
+  ({glnx_throw_errno (error); NULL;})
+
+/* Implementation detail of glnx_throw_errno_prefix() */
+void glnx_real_set_prefix_error_from_errno_va (GError     **error,
+                                               gint         errsv,
+                                               const char  *format,
+                                               va_list      args) G_GNUC_PRINTF (3,0);
+
+/* Set @error using the value of `$prefix: g_strerror (errno)` where `$prefix`
+ * is computed via printf @fmt.
+ *
+ * This function returns %FALSE so it can be used conveniently in a single
+ * statement:
+ *
+ * ```
+ *   return glnx_throw_errno_prefix (error, "unlinking %s", pathname);
+ * ```
+ */
+static inline gboolean G_GNUC_PRINTF (2,3)
+glnx_throw_errno_prefix (GError **error, const char *fmt, ...)
+{
+  int errsv = errno;
+  va_list args;
+  va_start (args, fmt);
+  glnx_real_set_prefix_error_from_errno_va (error, errsv, fmt, args);
+  va_end (args);
+  /* See comment above about preserving errno */
+  errno = errsv;
+  return FALSE;
+}
+
+/* Like glnx_throw_errno_prefix(), but yields a NULL pointer. */
+#define glnx_null_throw_errno_prefix(error, args...) \
+  ({glnx_throw_errno_prefix (error, args); NULL;})
+
+/* BEGIN LEGACY APIS */
+
+#define glnx_set_error_from_errno(error)                \
+  do {                                                  \
+    glnx_throw_errno (error);                           \
+  } while (0);
+
+#define glnx_set_prefix_error_from_errno(error, format, args...)  \
+  do {                                                            \
+    glnx_throw_errno_prefix (error, format, args);                \
+  } while (0);
+
+G_END_DECLS
diff --git a/libglnx/glnx-fdio.c b/libglnx/glnx-fdio.c
new file mode 100644 (file)
index 0000000..892be2a
--- /dev/null
@@ -0,0 +1,1116 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * Portions derived from systemd:
+ *  Copyright 2010 Lennart Poettering
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/ioctl.h>
+#include <sys/sendfile.h>
+#include <errno.h>
+
+#include <glnx-fdio.h>
+#include <glnx-dirfd.h>
+#include <glnx-errors.h>
+#include <glnx-xattrs.h>
+#include <glnx-backport-autoptr.h>
+#include <glnx-local-alloc.h>
+#include <glnx-missing.h>
+
+/* The standardized version of BTRFS_IOC_CLONE */
+#ifndef FICLONE
+#define FICLONE _IOW(0x94, 9, int)
+#endif
+
+/* Returns the number of chars needed to format variables of the
+ * specified type as a decimal string. Adds in extra space for a
+ * negative '-' prefix (hence works correctly on signed
+ * types). Includes space for the trailing NUL. */
+#define DECIMAL_STR_MAX(type)                                           \
+        (2+(sizeof(type) <= 1 ? 3 :                                     \
+            sizeof(type) <= 2 ? 5 :                                     \
+            sizeof(type) <= 4 ? 10 :                                    \
+            sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
+
+gboolean
+glnx_stdio_file_flush (FILE *f, GError **error)
+{
+  if (fflush (f) != 0)
+    return glnx_throw_errno_prefix (error, "fflush");
+  if (ferror (f) != 0)
+    return glnx_throw_errno_prefix (error, "ferror");
+  return TRUE;
+}
+
+/* An implementation of renameat2(..., RENAME_NOREPLACE)
+ * with fallback to a non-atomic version.
+ */
+int
+glnx_renameat2_noreplace (int olddirfd, const char *oldpath,
+                          int newdirfd, const char *newpath)
+{
+#ifndef ENABLE_WRPSEUDO_COMPAT
+  if (renameat2 (olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE) < 0)
+    {
+      if (G_IN_SET(errno, EINVAL, ENOSYS))
+        {
+          /* Fall through */
+        }
+      else
+        {
+          return -1;
+        }
+    }
+  else
+    return TRUE;
+#endif
+
+  if (linkat (olddirfd, oldpath, newdirfd, newpath, 0) < 0)
+    return -1;
+
+  if (unlinkat (olddirfd, oldpath, 0) < 0)
+    return -1;
+
+  return 0;
+}
+
+static gboolean
+rename_file_noreplace_at (int olddirfd, const char *oldpath,
+                          int newdirfd, const char *newpath,
+                          gboolean ignore_eexist,
+                          GError **error)
+{
+  if (glnx_renameat2_noreplace (olddirfd, oldpath,
+                                newdirfd, newpath) < 0)
+    {
+      if (errno == EEXIST && ignore_eexist)
+        {
+          (void) unlinkat (olddirfd, oldpath, 0);
+          return TRUE;
+        }
+      else
+        return glnx_throw_errno_prefix (error, "renameat");
+    }
+  return TRUE;
+}
+
+/* An implementation of renameat2(..., RENAME_EXCHANGE)
+ * with fallback to a non-atomic version.
+ */
+int
+glnx_renameat2_exchange (int olddirfd, const char *oldpath,
+                         int newdirfd, const char *newpath)
+{
+#ifndef ENABLE_WRPSEUDO_COMPAT
+  if (renameat2 (olddirfd, oldpath, newdirfd, newpath, RENAME_EXCHANGE) == 0)
+    return 0;
+  else
+    {
+      if (G_IN_SET(errno, ENOSYS, EINVAL))
+        {
+          /* Fall through */
+        }
+      else
+        {
+          return -1;
+        }
+    }
+#endif
+
+  /* Fallback */
+  { char *old_tmp_name_buf = glnx_strjoina (oldpath, ".XXXXXX");
+    /* This obviously isn't race-free, but doing better gets tricky, since if
+     * we're here the kernel isn't likely to support RENAME_NOREPLACE either.
+     * Anyways, upgrade the kernel. Failing that, avoid use of this function in
+     * shared subdirectories like /tmp.
+     */
+    glnx_gen_temp_name (old_tmp_name_buf);
+    const char *old_tmp_name = old_tmp_name_buf;
+
+    /* Move old out of the way */
+    if (renameat (olddirfd, oldpath, olddirfd, old_tmp_name) < 0)
+      return -1;
+    /* Now move new into its place */
+    if (renameat (newdirfd, newpath, olddirfd, oldpath) < 0)
+      return -1;
+    /* And finally old(tmp) into new */
+    if (renameat (olddirfd, old_tmp_name, newdirfd, newpath) < 0)
+      return -1;
+  }
+  return 0;
+}
+
+/* Deallocate a tmpfile, closing the fd and deleting the path, if any. This is
+ * normally called by default by the autocleanup attribute, but you can also
+ * invoke this directly.
+ */
+void
+glnx_tmpfile_clear (GLnxTmpfile *tmpf)
+{
+  /* Support being passed NULL so we work nicely in a GPtrArray */
+  if (!tmpf)
+    return;
+  if (!tmpf->initialized)
+    return;
+  if (tmpf->fd != -1)
+    {
+      if (close (tmpf->fd) < 0)
+        g_assert (errno != EBADF);
+    }
+  /* If ->path is set, we're likely aborting due to an error. Clean it up */
+  if (tmpf->path)
+    {
+      (void) unlinkat (tmpf->src_dfd, tmpf->path, 0);
+      g_free (tmpf->path);
+    }
+  tmpf->initialized = FALSE;
+}
+
+static gboolean
+open_tmpfile_core (int dfd, const char *subpath,
+                   int flags,
+                   GLnxTmpfile *out_tmpf,
+                   GError **error)
+{
+  const guint mode = 0600;
+  glnx_fd_close int fd = -1;
+  int count;
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  /* Creates a temporary file, that shall be renamed to "target"
+   * later. If possible, this uses O_TMPFILE – in which case
+   * "ret_path" will be returned as NULL. If not possible a the
+   * tempoary path name used is returned in "ret_path". Use
+   * link_tmpfile() below to rename the result after writing the file
+   * in full. */
+#if defined(O_TMPFILE) && !defined(DISABLE_OTMPFILE) && !defined(ENABLE_WRPSEUDO_COMPAT)
+  fd = openat (dfd, subpath, O_TMPFILE|flags, mode);
+  if (fd == -1 && !(G_IN_SET(errno, ENOSYS, EISDIR, EOPNOTSUPP)))
+    return glnx_throw_errno_prefix (error, "open(O_TMPFILE)");
+  if (fd != -1)
+    {
+      /* Workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=17523
+       * See also https://github.com/ostreedev/ostree/issues/991
+       */
+      if (fchmod (fd, mode) < 0)
+        return glnx_throw_errno_prefix (error, "fchmod");
+      out_tmpf->initialized = TRUE;
+      out_tmpf->src_dfd = dfd; /* Copied; caller must keep open */
+      out_tmpf->fd = glnx_steal_fd (&fd);
+      out_tmpf->path = NULL;
+      return TRUE;
+    }
+  /* Fallthrough */
+#endif
+
+  { g_autofree char *tmp = g_strconcat (subpath, "/tmp.XXXXXX", NULL);
+    const guint count_max = 100;
+
+    for (count = 0; count < count_max; count++)
+      {
+        glnx_gen_temp_name (tmp);
+
+        fd = openat (dfd, tmp, O_CREAT|O_EXCL|O_NOFOLLOW|O_NOCTTY|flags, mode);
+        if (fd < 0)
+          {
+            if (errno == EEXIST)
+              continue;
+            else
+              return glnx_throw_errno_prefix (error, "Creating temp file");
+          }
+        else
+          {
+            out_tmpf->initialized = TRUE;
+            out_tmpf->src_dfd = dfd;  /* Copied; caller must keep open */
+            out_tmpf->fd = glnx_steal_fd (&fd);
+            out_tmpf->path = g_steal_pointer (&tmp);
+            return TRUE;
+          }
+      }
+  }
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
+               "Exhausted %u attempts to create temporary file", count);
+  return FALSE;
+}
+
+/* Allocate a temporary file, using Linux O_TMPFILE if available. The file mode
+ * will be 0600.
+ *
+ * The result will be stored in @out_tmpf, which is caller allocated
+ * so you can store it on the stack in common scenarios.
+ *
+ * The directory fd @dfd must live at least as long as the output @out_tmpf.
+ */
+gboolean
+glnx_open_tmpfile_linkable_at (int dfd,
+                               const char *subpath,
+                               int flags,
+                               GLnxTmpfile *out_tmpf,
+                               GError **error)
+{
+  /* Don't allow O_EXCL, as that has a special meaning for O_TMPFILE;
+   * it's used for glnx_open_anonymous_tmpfile().
+   */
+  g_return_val_if_fail ((flags & O_EXCL) == 0, FALSE);
+
+  return open_tmpfile_core (dfd, subpath, flags, out_tmpf, error);
+}
+
+/* A variant of `glnx_open_tmpfile_linkable_at()` which doesn't support linking.
+ * Useful for true temporary storage. The fd will be allocated in /var/tmp to
+ * ensure maximum storage space.
+ */
+gboolean
+glnx_open_anonymous_tmpfile (int          flags,
+                             GLnxTmpfile *out_tmpf,
+                             GError     **error)
+{
+  /* Add in O_EXCL */
+  if (!open_tmpfile_core (AT_FDCWD, "/var/tmp", flags | O_EXCL, out_tmpf, error))
+    return FALSE;
+  if (out_tmpf->path)
+    {
+      (void) unlinkat (out_tmpf->src_dfd, out_tmpf->path, 0);
+      g_clear_pointer (&out_tmpf->path, g_free);
+    }
+  out_tmpf->anonymous = TRUE;
+  out_tmpf->src_dfd = -1;
+  return TRUE;
+}
+
+/* Use this after calling glnx_open_tmpfile_linkable_at() to give
+ * the file its final name (link into place).
+ */
+gboolean
+glnx_link_tmpfile_at (GLnxTmpfile *tmpf,
+                      GLnxLinkTmpfileReplaceMode mode,
+                      int target_dfd,
+                      const char *target,
+                      GError **error)
+{
+  const gboolean replace = (mode == GLNX_LINK_TMPFILE_REPLACE);
+  const gboolean ignore_eexist = (mode == GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST);
+
+  g_return_val_if_fail (!tmpf->anonymous, FALSE);
+  g_return_val_if_fail (tmpf->fd >= 0, FALSE);
+  g_return_val_if_fail (tmpf->src_dfd == AT_FDCWD || tmpf->src_dfd >= 0, FALSE);
+
+  /* Unlike the original systemd code, this function also supports
+   * replacing existing files.
+   */
+
+  /* We have `tmpfile_path` for old systems without O_TMPFILE. */
+  if (tmpf->path)
+    {
+      if (replace)
+        {
+          /* We have a regular tempfile, we're overwriting - this is a
+           * simple renameat().
+           */
+          if (renameat (tmpf->src_dfd, tmpf->path, target_dfd, target) < 0)
+            return glnx_throw_errno_prefix (error, "renameat");
+        }
+      else
+        {
+          /* We need to use renameat2(..., NOREPLACE) or emulate it */
+          if (!rename_file_noreplace_at (tmpf->src_dfd, tmpf->path, target_dfd, target,
+                                         ignore_eexist,
+                                         error))
+            return FALSE;
+        }
+      /* Now, clear the pointer so we don't try to unlink it */
+      g_clear_pointer (&tmpf->path, g_free);
+    }
+  else
+    {
+      /* This case we have O_TMPFILE, so our reference to it is via /proc/self/fd */
+      char proc_fd_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(tmpf->fd) + 1];
+
+      sprintf (proc_fd_path, "/proc/self/fd/%i", tmpf->fd);
+
+      if (replace)
+        {
+          /* In this case, we had our temp file atomically hidden, but now
+           * we need to make it visible in the FS so we can do a rename.
+           * Ideally, linkat() would gain AT_REPLACE or so.
+           */
+          /* TODO - avoid double alloca, we can just alloca a copy of
+           * the pathname plus space for tmp.XXXXX */
+          char *dnbuf = strdupa (target);
+          const char *dn = dirname (dnbuf);
+          char *tmpname_buf = glnx_strjoina (dn, "/tmp.XXXXXX");
+          guint count;
+          const guint count_max = 100;
+
+          for (count = 0; count < count_max; count++)
+            {
+              glnx_gen_temp_name (tmpname_buf);
+
+              if (linkat (AT_FDCWD, proc_fd_path, target_dfd, tmpname_buf, AT_SYMLINK_FOLLOW) < 0)
+                {
+                  if (errno == EEXIST)
+                    continue;
+                  else
+                    return glnx_throw_errno_prefix (error, "linkat");
+                }
+              else
+                break;
+            }
+          if (count == count_max)
+            {
+              g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
+               "Exhausted %u attempts to create temporary file", count);
+              return FALSE;
+            }
+          if (!glnx_renameat (target_dfd, tmpname_buf, target_dfd, target, error))
+            {
+              /* This is currently the only case where we need to have
+               * a cleanup unlinkat() still with O_TMPFILE.
+               */
+              (void) unlinkat (target_dfd, tmpname_buf, 0);
+              return FALSE;
+            }
+        }
+      else
+        {
+          if (linkat (AT_FDCWD, proc_fd_path, target_dfd, target, AT_SYMLINK_FOLLOW) < 0)
+            {
+              if (errno == EEXIST && mode == GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST)
+                ;
+              else
+                return glnx_throw_errno_prefix (error, "linkat");
+            }
+        }
+
+    }
+  return TRUE;
+}
+
+/**
+ * glnx_openat_rdonly:
+ * @dfd: File descriptor for origin directory
+ * @path: Pathname, relative to @dfd
+ * @follow: Whether or not to follow symbolic links in the final component
+ * @out_fd: (out): File descriptor
+ * @error: Error
+ *
+ * Use openat() to open a file, with flags `O_RDONLY | O_CLOEXEC | O_NOCTTY`.
+ * Like the other libglnx wrappers, will use `TEMP_FAILURE_RETRY` and
+ * also includes @path in @error in case of failure.
+ */
+gboolean
+glnx_openat_rdonly (int             dfd,
+                    const char     *path,
+                    gboolean        follow,
+                    int            *out_fd,
+                    GError        **error)
+{
+  int flags = O_RDONLY | O_CLOEXEC | O_NOCTTY;
+  if (!follow)
+    flags |= O_NOFOLLOW;
+  int fd = TEMP_FAILURE_RETRY (openat (dfd, path, flags));
+  if (fd == -1)
+    return glnx_throw_errno_prefix (error, "openat(%s)", path);
+  *out_fd = fd;
+  return TRUE;
+}
+
+static guint8*
+glnx_fd_readall_malloc (int               fd,
+                        gsize            *out_len,
+                        gboolean          nul_terminate,
+                        GCancellable     *cancellable,
+                        GError          **error)
+{
+  const guint maxreadlen = 4096;
+
+  struct stat stbuf;
+  if (!glnx_fstat (fd, &stbuf, error))
+    return FALSE;
+
+  gsize buf_allocated;
+  if (S_ISREG (stbuf.st_mode) && stbuf.st_size > 0)
+    buf_allocated = stbuf.st_size;
+  else
+    buf_allocated = 16;
+
+  g_autofree guint8* buf = g_malloc (buf_allocated);
+
+  gsize buf_size = 0;
+  while (TRUE)
+    {
+      gsize readlen = MIN (buf_allocated - buf_size, maxreadlen);
+
+      if (g_cancellable_set_error_if_cancelled (cancellable, error))
+        return FALSE;
+
+      gssize bytes_read;
+      do
+        bytes_read = read (fd, buf + buf_size, readlen);
+      while (G_UNLIKELY (bytes_read == -1 && errno == EINTR));
+      if (G_UNLIKELY (bytes_read == -1))
+        return glnx_null_throw_errno (error);
+      if (bytes_read == 0)
+        break;
+
+      buf_size += bytes_read;
+      if (buf_allocated - buf_size < maxreadlen)
+        buf = g_realloc (buf, buf_allocated *= 2);
+    }
+
+  if (nul_terminate)
+    {
+      if (buf_allocated - buf_size == 0)
+        buf = g_realloc (buf, buf_allocated + 1);
+      buf[buf_size] = '\0';
+    }
+
+  *out_len = buf_size;
+  return g_steal_pointer (&buf);
+}
+
+/**
+ * glnx_fd_readall_bytes:
+ * @fd: A file descriptor
+ * @cancellable: Cancellable:
+ * @error: Error
+ *
+ * Read all data from file descriptor @fd into a #GBytes.  It's
+ * recommended to only use this for small files.
+ *
+ * Returns: (transfer full): A newly allocated #GBytes
+ */
+GBytes *
+glnx_fd_readall_bytes (int               fd,
+                       GCancellable     *cancellable,
+                       GError          **error)
+{
+  gsize len;
+  guint8 *buf = glnx_fd_readall_malloc (fd, &len, FALSE, cancellable, error);
+  if (!buf)
+    return NULL;
+  return g_bytes_new_take (buf, len);
+}
+
+/**
+ * glnx_fd_readall_utf8:
+ * @fd: A file descriptor
+ * @out_len: (out): Returned length
+ * @cancellable: Cancellable:
+ * @error: Error
+ *
+ * Read all data from file descriptor @fd, validating
+ * the result as UTF-8.
+ *
+ * Returns: (transfer full): A string validated as UTF-8, or %NULL on error.
+ */
+char *
+glnx_fd_readall_utf8 (int               fd,
+                      gsize            *out_len,
+                      GCancellable     *cancellable,
+                      GError          **error)
+{
+  gsize len;
+  g_autofree guint8 *buf = glnx_fd_readall_malloc (fd, &len, TRUE, cancellable, error);
+  if (!buf)
+    return FALSE;
+
+  if (!g_utf8_validate ((char*)buf, len, NULL))
+    {
+      g_set_error (error,
+                   G_IO_ERROR,
+                   G_IO_ERROR_INVALID_DATA,
+                   "Invalid UTF-8");
+      return FALSE;
+    }
+
+  if (out_len)
+    *out_len = len;
+  return (char*)g_steal_pointer (&buf);
+}
+
+/**
+ * glnx_file_get_contents_utf8_at:
+ * @dfd: Directory file descriptor
+ * @subpath: Path relative to @dfd
+ * @out_len: (out) (allow-none): Optional length
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Read the entire contents of the file referred
+ * to by @dfd and @subpath, validate the result as UTF-8.
+ * The length is optionally stored in @out_len.
+ *
+ * Returns: (transfer full): UTF-8 validated text, or %NULL on error
+ */
+char *
+glnx_file_get_contents_utf8_at (int                   dfd,
+                                const char           *subpath,
+                                gsize                *out_len,
+                                GCancellable         *cancellable,
+                                GError              **error)
+{
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  glnx_fd_close int fd = -1;
+  if (!glnx_openat_rdonly (dfd, subpath, TRUE, &fd, error))
+    return NULL;
+
+  gsize len;
+  g_autofree char *buf = glnx_fd_readall_utf8 (fd, &len, cancellable, error);
+  if (G_UNLIKELY(!buf))
+    return FALSE;
+
+  if (out_len)
+    *out_len = len;
+  return g_steal_pointer (&buf);
+}
+
+/**
+ * glnx_readlinkat_malloc:
+ * @dfd: Directory file descriptor
+ * @subpath: Subpath
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Read the value of a symlink into a dynamically
+ * allocated buffer.
+ */
+char *
+glnx_readlinkat_malloc (int            dfd,
+                        const char    *subpath,
+                        GCancellable  *cancellable,
+                        GError       **error)
+{
+  size_t l = 100;
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  for (;;)
+    {
+      g_autofree char *c = NULL;
+      ssize_t n;
+
+      c = g_malloc (l);
+      n = TEMP_FAILURE_RETRY (readlinkat (dfd, subpath, c, l-1));
+      if (n < 0)
+        return glnx_null_throw_errno_prefix (error, "readlinkat");
+
+      if ((size_t) n < l-1)
+        {
+          c[n] = 0;
+          return g_steal_pointer (&c);
+        }
+
+      l *= 2;
+    }
+
+  g_assert_not_reached ();
+}
+
+static gboolean
+copy_symlink_at (int                   src_dfd,
+                 const char           *src_subpath,
+                 const struct stat    *src_stbuf,
+                 int                   dest_dfd,
+                 const char           *dest_subpath,
+                 GLnxFileCopyFlags     copyflags,
+                 GCancellable         *cancellable,
+                 GError              **error)
+{
+  g_autofree char *buf = glnx_readlinkat_malloc (src_dfd, src_subpath, cancellable, error);
+  if (!buf)
+    return FALSE;
+
+  if (TEMP_FAILURE_RETRY (symlinkat (buf, dest_dfd, dest_subpath)) != 0)
+    return glnx_throw_errno_prefix (error, "symlinkat");
+
+  if (!(copyflags & GLNX_FILE_COPY_NOXATTRS))
+    {
+      g_autoptr(GVariant) xattrs = NULL;
+
+      if (!glnx_dfd_name_get_all_xattrs (src_dfd, src_subpath, &xattrs,
+                                         cancellable, error))
+        return FALSE;
+
+      if (!glnx_dfd_name_set_all_xattrs (dest_dfd, dest_subpath, xattrs,
+                                         cancellable, error))
+        return FALSE;
+    }
+
+  if (TEMP_FAILURE_RETRY (fchownat (dest_dfd, dest_subpath,
+                                    src_stbuf->st_uid, src_stbuf->st_gid,
+                                    AT_SYMLINK_NOFOLLOW)) != 0)
+    return glnx_throw_errno_prefix (error, "fchownat");
+
+  return TRUE;
+}
+
+#define COPY_BUFFER_SIZE (16*1024)
+
+/* Most of the code below is from systemd, but has been reindented to GNU style,
+ * and changed to use POSIX error conventions (return -1, set errno) to more
+ * conveniently fit in with the rest of libglnx.
+ */
+
+/* Like write(), but loop until @nbytes are written, or an error
+ * occurs.
+ *
+ * On error, -1 is returned an @errno is set.  NOTE: This is an
+ * API change from previous versions of this function.
+ */
+int
+glnx_loop_write(int fd, const void *buf, size_t nbytes)
+{
+  const uint8_t *p = buf;
+
+  g_return_val_if_fail(fd >= 0, -1);
+  g_return_val_if_fail(buf, -1);
+
+  errno = 0;
+
+  while (nbytes > 0)
+    {
+      ssize_t k;
+
+      k = write(fd, p, nbytes);
+      if (k < 0)
+        {
+          if (errno == EINTR)
+            continue;
+
+          return -1;
+        }
+
+      if (k == 0) /* Can't really happen */
+        {
+          errno = EIO;
+          return -1;
+        }
+
+      p += k;
+      nbytes -= k;
+    }
+
+  return 0;
+}
+
+/* Read from @fdf until EOF, writing to @fdt. If max_bytes is -1, a full-file
+ * clone will be attempted. Otherwise Linux copy_file_range(), sendfile()
+ * syscall will be attempted.  If none of those work, this function will do a
+ * plain read()/write() loop.
+ *
+ * The file descriptor @fdf must refer to a regular file.
+ *
+ * If provided, @max_bytes specifies the maximum number of bytes to read from @fdf.
+ * On error, this function returns `-1` and @errno will be set.
+ */
+int
+glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
+{
+  /* Last updates from systemd as of commit 6bda23dd6aaba50cf8e3e6024248cf736cc443ca */
+  static int have_cfr = -1; /* -1 means unknown */
+  bool try_cfr = have_cfr != 0;
+  static int have_sendfile = -1; /* -1 means unknown */
+  bool try_sendfile = have_sendfile != 0;
+
+  g_return_val_if_fail (fdf >= 0, -1);
+  g_return_val_if_fail (fdt >= 0, -1);
+  g_return_val_if_fail (max_bytes >= -1, -1);
+
+  /* If we've requested to copy the whole range, try a full-file clone first.
+   */
+  if (max_bytes == (off_t) -1)
+    {
+      if (ioctl (fdt, FICLONE, fdf) == 0)
+        return 0;
+      /* Fall through */
+      struct stat stbuf;
+
+      /* Gather the size so we can provide the whole thing at once to
+       * copy_file_range() or sendfile().
+       */
+      if (fstat (fdf, &stbuf) < 0)
+        return -1;
+      max_bytes = stbuf.st_size;
+    }
+
+  while (TRUE)
+    {
+      ssize_t n;
+
+      /* First, try copy_file_range(). Note this is an inlined version of
+       * try_copy_file_range() from systemd upstream, which works better since
+       * we use POSIX errno style.
+       */
+      if (try_cfr)
+        {
+          n = copy_file_range (fdf, NULL, fdt, NULL, max_bytes, 0u);
+          if (n < 0)
+            {
+              if (errno == ENOSYS)
+                {
+                  /* No cfr in kernel, mark as permanently unavailable
+                   * and fall through to sendfile().
+                   */
+                  have_cfr = 0;
+                  try_cfr = false;
+                }
+              else if (errno == EXDEV)
+                /* We won't try cfr again for this run, but let's be
+                 * conservative and not mark it as available/unavailable until
+                 * we know for sure.
+                 */
+                try_cfr = false;
+              else
+                return -1;
+            }
+          else
+            {
+              /* cfr worked, mark it as available */
+              if (have_cfr == -1)
+                have_cfr = 1;
+
+              if (n == 0) /* EOF */
+                break;
+              else
+                /* Success! */
+                goto next;
+            }
+        }
+
+      /* Next try sendfile(); this version is also changed from systemd upstream
+       * to match the same logic we have for copy_file_range().
+       */
+      if (try_sendfile)
+        {
+          n = sendfile (fdt, fdf, NULL, max_bytes);
+          if (n < 0)
+            {
+              if (G_IN_SET (errno, EINVAL, ENOSYS))
+                {
+                  /* No sendfile(), or it doesn't work on regular files.
+                   * Mark it as permanently unavailable, and fall through
+                   * to plain read()/write().
+                   */
+                  have_sendfile = 0;
+                  try_sendfile = false;
+                }
+              else
+                return -1;
+            }
+          else
+            {
+              /* sendfile() worked, mark it as available */
+              if (have_sendfile == -1)
+                have_sendfile = 1;
+
+              if (n == 0) /* EOF */
+                break;
+              else if (n > 0)
+                /* Succcess! */
+                goto next;
+            }
+        }
+
+      /* As a fallback just copy bits by hand */
+      { size_t m = COPY_BUFFER_SIZE;
+        if (max_bytes != (off_t) -1)
+          {
+            if ((off_t) m > max_bytes)
+              m = (size_t) max_bytes;
+          }
+        char buf[m];
+
+        n = TEMP_FAILURE_RETRY (read (fdf, buf, m));
+        if (n < 0)
+          return -1;
+        if (n == 0) /* EOF */
+          break;
+
+        if (glnx_loop_write (fdt, buf, (size_t) n) < 0)
+          return -1;
+      }
+
+    next:
+      if (max_bytes != (off_t) -1)
+        {
+          g_assert_cmpint (max_bytes, >=, n);
+          max_bytes -= n;
+          if (max_bytes == 0)
+            break;
+        }
+    }
+
+  return 0;
+}
+
+/**
+ * glnx_file_copy_at:
+ * @src_dfd: Source directory fd
+ * @src_subpath: Subpath relative to @src_dfd
+ * @src_stbuf: (allow-none): Optional stat buffer for source; if a stat() has already been done
+ * @dest_dfd: Target directory fd
+ * @dest_subpath: Destination name
+ * @copyflags: Flags
+ * @cancellable: cancellable
+ * @error: Error
+ *
+ * Perform a full copy of the regular file or symbolic link from @src_subpath to
+ * @dest_subpath; if @src_subpath is anything other than a regular file or
+ * symbolic link, an error will be returned.
+ *
+ * If the source is a regular file and the destination exists as a symbolic
+ * link, the symbolic link will not be followed; rather the link itself will be
+ * replaced. Related to this: for regular files, when `GLNX_FILE_COPY_OVERWRITE`
+ * is specified, this function always uses `O_TMPFILE` (if available) and does a
+ * rename-into-place rather than `open(O_TRUNC)`.
+ */
+gboolean
+glnx_file_copy_at (int                   src_dfd,
+                   const char           *src_subpath,
+                   struct stat          *src_stbuf,
+                   int                   dest_dfd,
+                   const char           *dest_subpath,
+                   GLnxFileCopyFlags     copyflags,
+                   GCancellable         *cancellable,
+                   GError              **error)
+{
+  /* Canonicalize dfds */
+  src_dfd = glnx_dirfd_canonicalize (src_dfd);
+  dest_dfd = glnx_dirfd_canonicalize (dest_dfd);
+
+  if (g_cancellable_set_error_if_cancelled (cancellable, error))
+    return FALSE;
+
+  /* Automatically do stat() if no stat buffer was supplied */
+  struct stat local_stbuf;
+  if (!src_stbuf)
+    {
+      if (!glnx_fstatat (src_dfd, src_subpath, &local_stbuf, AT_SYMLINK_NOFOLLOW, error))
+        return FALSE;
+      src_stbuf = &local_stbuf;
+    }
+
+  /* For symlinks, defer entirely to copy_symlink_at() */
+  if (S_ISLNK (src_stbuf->st_mode))
+    {
+      return copy_symlink_at (src_dfd, src_subpath, src_stbuf,
+                              dest_dfd, dest_subpath,
+                              copyflags,
+                              cancellable, error);
+    }
+  else if (!S_ISREG (src_stbuf->st_mode))
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+                   "Cannot copy non-regular/non-symlink file: %s", src_subpath);
+      return FALSE;
+    }
+
+  /* Regular file path below here */
+
+  glnx_fd_close int src_fd = -1;
+  if (!glnx_openat_rdonly (src_dfd, src_subpath, FALSE, &src_fd, error))
+    return FALSE;
+
+  /* Open a tmpfile for dest. Particularly for AT_FDCWD calls, we really want to
+   * open in the target directory, otherwise we may not be able to link.
+   */
+  g_auto(GLnxTmpfile) tmp_dest = { 0, };
+  { char *dnbuf = strdupa (dest_subpath);
+    const char *dn = dirname (dnbuf);
+    if (!glnx_open_tmpfile_linkable_at (dest_dfd, dn, O_WRONLY | O_CLOEXEC,
+                                        &tmp_dest, error))
+      return FALSE;
+  }
+
+  if (glnx_regfile_copy_bytes (src_fd, tmp_dest.fd, (off_t) -1) < 0)
+    return glnx_throw_errno_prefix (error, "regfile copy");
+
+  if (fchown (tmp_dest.fd, src_stbuf->st_uid, src_stbuf->st_gid) != 0)
+    return glnx_throw_errno_prefix (error, "fchown");
+
+  if (!(copyflags & GLNX_FILE_COPY_NOXATTRS))
+    {
+      g_autoptr(GVariant) xattrs = NULL;
+
+      if (!glnx_fd_get_all_xattrs (src_fd, &xattrs,
+                                   cancellable, error))
+        return FALSE;
+
+      if (!glnx_fd_set_all_xattrs (tmp_dest.fd, xattrs,
+                                   cancellable, error))
+        return FALSE;
+    }
+
+  /* Always chmod after setting xattrs, in case the file has mode 0400 or less,
+   * like /etc/shadow.  Linux currently allows write() on non-writable open files
+   * but not fsetxattr().
+   */
+  if (fchmod (tmp_dest.fd, src_stbuf->st_mode & 07777) != 0)
+    return glnx_throw_errno_prefix (error, "fchmod");
+
+  struct timespec ts[2];
+  ts[0] = src_stbuf->st_atim;
+  ts[1] = src_stbuf->st_mtim;
+  (void) futimens (tmp_dest.fd, ts);
+
+  if (copyflags & GLNX_FILE_COPY_DATASYNC)
+    {
+      if (fdatasync (tmp_dest.fd) < 0)
+        return glnx_throw_errno_prefix (error, "fdatasync");
+    }
+
+  const GLnxLinkTmpfileReplaceMode replacemode =
+    (copyflags & GLNX_FILE_COPY_OVERWRITE) ?
+    GLNX_LINK_TMPFILE_REPLACE :
+    GLNX_LINK_TMPFILE_NOREPLACE;
+
+  if (!glnx_link_tmpfile_at (&tmp_dest, replacemode, dest_dfd, dest_subpath, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+/**
+ * glnx_file_replace_contents_at:
+ * @dfd: Directory fd
+ * @subpath: Subpath
+ * @buf: (array len=len) (element-type guint8): File contents
+ * @len: Length (if `-1`, assume @buf is `NUL` terminated)
+ * @flags: Flags
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Create a new file, atomically replacing the contents of @subpath
+ * (relative to @dfd) with @buf.  By default, if the file already
+ * existed, fdatasync() will be used before rename() to ensure stable
+ * contents.  This and other behavior can be controlled via @flags.
+ *
+ * Note that no metadata from the existing file is preserved, such as
+ * uid/gid or extended attributes.  The default mode will be `0666`,
+ * modified by umask.
+ */ 
+gboolean
+glnx_file_replace_contents_at (int                   dfd,
+                               const char           *subpath,
+                               const guint8         *buf,
+                               gsize                 len,
+                               GLnxFileReplaceFlags  flags,
+                               GCancellable         *cancellable,
+                               GError              **error)
+{
+  return glnx_file_replace_contents_with_perms_at (dfd, subpath, buf, len,
+                                                   (mode_t) -1, (uid_t) -1, (gid_t) -1,
+                                                   flags, cancellable, error);
+}
+
+/**
+ * glnx_file_replace_contents_with_perms_at:
+ * @dfd: Directory fd
+ * @subpath: Subpath
+ * @buf: (array len=len) (element-type guint8): File contents
+ * @len: Length (if `-1`, assume @buf is `NUL` terminated)
+ * @mode: File mode; if `-1`, use `0666 - umask`
+ * @flags: Flags
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Like glnx_file_replace_contents_at(), but also supports
+ * setting mode, and uid/gid.
+ */ 
+gboolean
+glnx_file_replace_contents_with_perms_at (int                   dfd,
+                                          const char           *subpath,
+                                          const guint8         *buf,
+                                          gsize                 len,
+                                          mode_t                mode,
+                                          uid_t                 uid,
+                                          gid_t                 gid,
+                                          GLnxFileReplaceFlags  flags,
+                                          GCancellable         *cancellable,
+                                          GError              **error)
+{
+  char *dnbuf = strdupa (subpath);
+  const char *dn = dirname (dnbuf);
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  /* With O_TMPFILE we can't use umask, and we can't sanely query the
+   * umask...let's assume something relatively standard.
+   */
+  if (mode == (mode_t) -1)
+    mode = 0644;
+
+  g_auto(GLnxTmpfile) tmpf = { 0, };
+  if (!glnx_open_tmpfile_linkable_at (dfd, dn, O_WRONLY | O_CLOEXEC,
+                                      &tmpf, error))
+    return FALSE;
+
+  if (len == -1)
+    len = strlen ((char*)buf);
+
+  if (!glnx_try_fallocate (tmpf.fd, 0, len, error))
+    return FALSE;
+
+  if (glnx_loop_write (tmpf.fd, buf, len) < 0)
+    return glnx_throw_errno_prefix (error, "write");
+
+  if (!(flags & GLNX_FILE_REPLACE_NODATASYNC))
+    {
+      struct stat stbuf;
+      gboolean do_sync;
+
+      if (!glnx_fstatat_allow_noent (dfd, subpath, &stbuf, AT_SYMLINK_NOFOLLOW, error))
+        return FALSE;
+      if (errno == ENOENT)
+        do_sync = (flags & GLNX_FILE_REPLACE_DATASYNC_NEW) > 0;
+      else
+        do_sync = TRUE;
+
+      if (do_sync)
+        {
+          if (fdatasync (tmpf.fd) != 0)
+            return glnx_throw_errno_prefix (error, "fdatasync");
+        }
+    }
+
+  if (uid != (uid_t) -1)
+    {
+      if (fchown (tmpf.fd, uid, gid) != 0)
+        return glnx_throw_errno_prefix (error, "fchown");
+    }
+
+  if (fchmod (tmpf.fd, mode) != 0)
+    return glnx_throw_errno_prefix (error, "fchmod");
+
+  if (!glnx_link_tmpfile_at (&tmpf, GLNX_LINK_TMPFILE_REPLACE,
+                             dfd, subpath, error))
+    return FALSE;
+
+  return TRUE;
+}
diff --git a/libglnx/glnx-fdio.h b/libglnx/glnx-fdio.h
new file mode 100644 (file)
index 0000000..1aa0c43
--- /dev/null
@@ -0,0 +1,372 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-backport-autocleanups.h>
+#include <gio/gfiledescriptorbased.h>
+#include <limits.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/xattr.h>
+/* From systemd/src/shared/util.h */
+/* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the XDG
+ * version which is really broken. */
+#include <libgen.h>
+#undef basename
+
+#include <glnx-macros.h>
+#include <glnx-errors.h>
+
+G_BEGIN_DECLS
+
+/* Irritatingly, g_basename() which is what we want
+ * is deprecated.
+ */
+static inline
+const char *glnx_basename (const char *path)
+{
+  return (basename) (path);
+}
+
+/* Utilities for standard FILE* */
+static inline void
+glnx_stdio_file_cleanup (void *filep)
+{
+  FILE *f = filep;
+  if (f)
+    fclose (f);
+}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(FILE, glnx_stdio_file_cleanup)
+
+/**
+ * glnx_stdio_file_flush:
+ * Call fflush() and check ferror().
+ */
+gboolean
+glnx_stdio_file_flush (FILE *f, GError **error);
+
+typedef struct {
+  gboolean initialized;
+  gboolean anonymous;
+  int src_dfd;
+  int fd;
+  char *path;
+} GLnxTmpfile;
+void glnx_tmpfile_clear (GLnxTmpfile *tmpf);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxTmpfile, glnx_tmpfile_clear)
+
+gboolean
+glnx_open_anonymous_tmpfile (int flags,
+                             GLnxTmpfile *out_tmpf,
+                             GError **error);
+
+gboolean
+glnx_open_tmpfile_linkable_at (int dfd,
+                               const char *subpath,
+                               int flags,
+                               GLnxTmpfile *out_tmpf,
+                               GError **error);
+
+typedef enum {
+  GLNX_LINK_TMPFILE_REPLACE,
+  GLNX_LINK_TMPFILE_NOREPLACE,
+  GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST
+} GLnxLinkTmpfileReplaceMode;
+
+gboolean
+glnx_link_tmpfile_at (GLnxTmpfile *tmpf,
+                      GLnxLinkTmpfileReplaceMode flags,
+                      int target_dfd,
+                      const char *target,
+                      GError **error);
+
+gboolean
+glnx_openat_rdonly (int             dfd,
+                    const char     *path,
+                    gboolean        follow,
+                    int            *out_fd,
+                    GError        **error);
+
+GBytes *
+glnx_fd_readall_bytes (int               fd,
+                       GCancellable     *cancellable,
+                       GError          **error);
+
+char *
+glnx_fd_readall_utf8 (int               fd,
+                      gsize            *out_len,
+                      GCancellable     *cancellable,
+                      GError          **error);
+
+char *
+glnx_file_get_contents_utf8_at (int                   dfd,
+                                const char           *subpath,
+                                gsize                *out_len,
+                                GCancellable         *cancellable,
+                                GError              **error);
+
+/**
+ * GLnxFileReplaceFlags:
+ * @GLNX_FILE_REPLACE_DATASYNC_NEW: Call fdatasync() even if the file did not exist
+ * @GLNX_FILE_REPLACE_NODATASYNC: Never call fdatasync()
+ *
+ * Flags controlling file replacement.
+ */
+typedef enum {
+  GLNX_FILE_REPLACE_DATASYNC_NEW = (1 << 0),
+  GLNX_FILE_REPLACE_NODATASYNC = (1 << 1),
+} GLnxFileReplaceFlags;
+
+gboolean
+glnx_file_replace_contents_at (int                   dfd,
+                               const char           *subpath,
+                               const guint8         *buf,
+                               gsize                 len,
+                               GLnxFileReplaceFlags  flags,
+                               GCancellable         *cancellable,
+                               GError              **error);
+
+gboolean
+glnx_file_replace_contents_with_perms_at (int                   dfd,
+                                          const char           *subpath,
+                                          const guint8         *buf,
+                                          gsize                 len,
+                                          mode_t                mode,
+                                          uid_t                 uid,
+                                          gid_t                 gid,
+                                          GLnxFileReplaceFlags  flags,
+                                          GCancellable         *cancellable,
+                                          GError              **error);
+
+char *
+glnx_readlinkat_malloc (int            dfd,
+                        const char    *subpath,
+                        GCancellable  *cancellable,
+                        GError       **error);
+
+int
+glnx_loop_write (int fd, const void *buf, size_t nbytes);
+
+int
+glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes);
+
+typedef enum {
+  GLNX_FILE_COPY_OVERWRITE = (1 << 0),
+  GLNX_FILE_COPY_NOXATTRS = (1 << 1),
+  GLNX_FILE_COPY_DATASYNC = (1 << 2)
+} GLnxFileCopyFlags;
+
+gboolean
+glnx_file_copy_at (int                   src_dfd,
+                   const char           *src_subpath,
+                   struct stat          *src_stbuf,
+                   int                   dest_dfd,
+                   const char           *dest_subpath,
+                   GLnxFileCopyFlags     copyflags,
+                   GCancellable         *cancellable,
+                   GError              **error);
+
+int glnx_renameat2_noreplace (int olddirfd, const char *oldpath,
+                              int newdirfd, const char *newpath);
+int glnx_renameat2_exchange (int olddirfd, const char *oldpath,
+                             int newdirfd, const char *newpath);
+
+/**
+ * glnx_try_fallocate:
+ * @fd: File descriptor
+ * @size: Size
+ * @error: Error
+ *
+ * Wrapper for Linux fallocate().  Explicitly ignores a @size of zero.
+ * Also, will silently do nothing if the underlying filesystem doesn't
+ * support it.  Use this instead of posix_fallocate(), since the glibc fallback
+ * is bad: https://sourceware.org/bugzilla/show_bug.cgi?id=18515
+ */
+static inline gboolean
+glnx_try_fallocate (int      fd,
+                    off_t    offset,
+                    off_t    size,
+                    GError **error)
+{
+  /* This is just nicer than throwing an error */
+  if (size == 0)
+    return TRUE;
+
+  if (fallocate (fd, 0, offset, size) < 0)
+    {
+      if (G_IN_SET(errno, ENOSYS, EOPNOTSUPP))
+        ; /* Ignore */
+      else
+        return glnx_throw_errno_prefix (error, "fallocate");
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_fstat:
+ * @fd: FD to stat
+ * @buf: (out caller-allocates): Return location for stat details
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Wrapper around fstat() which adds #GError support and ensures that it retries
+ * on %EINTR.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+static inline gboolean
+glnx_fstat (int           fd,
+            struct stat  *buf,
+            GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (fstat (fd, buf)) != 0)
+    return glnx_throw_errno_prefix (error, "fstat");
+  return TRUE;
+}
+
+/**
+ * glnx_fchmod:
+ * @fd: FD
+ * @mode: Mode
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Wrapper around fchmod() which adds #GError support and ensures that it
+ * retries on %EINTR.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+static inline gboolean
+glnx_fchmod (int           fd,
+             mode_t        mode,
+             GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (fchmod (fd, mode)) != 0)
+    return glnx_throw_errno_prefix (error, "fchmod");
+  return TRUE;
+}
+
+/**
+ * glnx_fstatat:
+ * @dfd: Directory FD to stat beneath
+ * @path: Path to stat beneath @dfd
+ * @buf: (out caller-allocates): Return location for stat details
+ * @flags: Flags to pass to fstatat()
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Wrapper around fstatat() which adds #GError support and ensures that it
+ * retries on %EINTR.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+static inline gboolean
+glnx_fstatat (int           dfd,
+              const gchar  *path,
+              struct stat  *buf,
+              int           flags,
+              GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (fstatat (dfd, path, buf, flags)) != 0)
+    return glnx_throw_errno_prefix (error, "fstatat(%s)", path);
+  return TRUE;
+}
+
+/**
+ * glnx_fstatat_allow_noent:
+ * @dfd: Directory FD to stat beneath
+ * @path: Path to stat beneath @dfd
+ * @buf: (out caller-allocates) (allow-none): Return location for stat details
+ * @flags: Flags to pass to fstatat()
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Like glnx_fstatat(), but handles `ENOENT` in a non-error way.  Instead,
+ * on success `errno` will be zero, otherwise it will be preserved.  Hence
+ * you can test `if (errno == 0)` to conditionalize on the file existing,
+ * or `if (errno == ENOENT)` for non-existence.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (errno is preserved)
+ * Since: UNRELEASED
+ */
+static inline gboolean
+glnx_fstatat_allow_noent (int               dfd,
+                          const char       *path,
+                          struct stat      *out_buf,
+                          int               flags,
+                          GError          **error)
+{
+  struct stat stbuf;
+  if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf ?: &stbuf, flags)) != 0)
+    {
+      if (errno != ENOENT)
+        {
+          int errsv = errno;
+          (void) glnx_throw_errno_prefix (error, "fstatat(%s)", path);
+          errno = errsv;
+          return FALSE;
+        }
+    }
+  else
+    errno = 0;
+  return TRUE;
+}
+
+/**
+ * glnx_renameat:
+ *
+ * Wrapper around renameat() which adds #GError support and ensures that it
+ * retries on %EINTR.
+ */
+static inline gboolean
+glnx_renameat (int           src_dfd,
+               const gchar  *src_path,
+               int           dest_dfd,
+               const gchar  *dest_path,
+               GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (renameat (src_dfd, src_path, dest_dfd, dest_path)) != 0)
+    return glnx_throw_errno_prefix (error, "renameat(%s, %s)", src_path, dest_path);
+  return TRUE;
+}
+
+/**
+ * glnx_unlinkat:
+ *
+ * Wrapper around unlinkat() which adds #GError support and ensures that it
+ * retries on %EINTR.
+ */
+static inline gboolean
+glnx_unlinkat (int           dfd,
+               const gchar  *path,
+               int           flags,
+               GError      **error)
+{
+  if (TEMP_FAILURE_RETRY (unlinkat (dfd, path, flags)) != 0)
+    return glnx_throw_errno_prefix (error, "unlinkat(%s)", path);
+  return TRUE;
+}
+
+G_END_DECLS
diff --git a/libglnx/glnx-local-alloc.c b/libglnx/glnx-local-alloc.c
new file mode 100644 (file)
index 0000000..692f0de
--- /dev/null
@@ -0,0 +1,72 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012,2015 Colin Walters <walters@verbum.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "glnx-local-alloc.h"
+
+/**
+ * SECTION:glnxlocalalloc
+ * @title: GLnx local allocation
+ * @short_description: Release local variables automatically when they go out of scope
+ *
+ * These macros leverage the GCC extension __attribute__ ((cleanup))
+ * to allow calling a cleanup function such as g_free() when a
+ * variable goes out of scope.  See <ulink
+ * url="http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html">
+ * for more information on the attribute.
+ *
+ * The provided macros make it easy to use the cleanup attribute for
+ * types that come with GLib.  The primary two are #glnx_free and
+ * #glnx_unref_object, which correspond to g_free() and
+ * g_object_unref(), respectively.
+ *
+ * The rationale behind this is that particularly when handling error
+ * paths, it can be very tricky to ensure the right variables are
+ * freed.  With this, one simply applies glnx_unref_object to a
+ * locally-allocated #GFile for example, and it will be automatically
+ * unreferenced when it goes out of scope.
+ *
+ * Note - you should only use these macros for <emphasis>stack
+ * allocated</emphasis> variables.  They don't provide garbage
+ * collection or let you avoid freeing things.  They're simply a
+ * compiler assisted deterministic mechanism for calling a cleanup
+ * function when a stack frame ends.
+ *
+ * <example id="gs-lfree"><title>Calling g_free automatically</title>
+ * <programlisting>
+ *
+ * GFile *
+ * create_file (GError **error)
+ * {
+ *   glnx_free char *random_id = NULL;
+ *
+ *   if (!prepare_file (error))
+ *     return NULL;
+ *
+ *   random_id = alloc_random_id ();
+ *
+ *   return create_file_real (error);
+ *   // Note that random_id is freed here automatically
+ * }
+ * </programlisting>
+ * </example>
+ *
+ */
diff --git a/libglnx/glnx-local-alloc.h b/libglnx/glnx-local-alloc.h
new file mode 100644 (file)
index 0000000..3be1fa4
--- /dev/null
@@ -0,0 +1,91 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+#include <errno.h>
+
+G_BEGIN_DECLS
+
+/**
+ * glnx_unref_object:
+ *
+ * Call g_object_unref() on a variable location when it goes out of
+ * scope.  Note that unlike g_object_unref(), the variable may be
+ * %NULL.
+ */
+#define glnx_unref_object __attribute__ ((cleanup(glnx_local_obj_unref)))
+static inline void
+glnx_local_obj_unref (void *v)
+{
+  GObject *o = *(GObject **)v;
+  if (o)
+    g_object_unref (o);
+}
+#define glnx_unref_object __attribute__ ((cleanup(glnx_local_obj_unref)))
+
+static inline int
+glnx_steal_fd (int *fdp)
+{
+  int fd = *fdp;
+  *fdp = -1;
+  return fd;
+}
+
+/**
+ * glnx_close_fd:
+ * @fdp: Pointer to fd
+ *
+ * Effectively `close (glnx_steal_fd (&fd))`.  Also
+ * asserts that `close()` did not raise `EBADF` - encountering
+ * that error is usually a critical bug in the program.
+ */
+static inline void
+glnx_close_fd (int *fdp)
+{
+  int errsv;
+
+  g_assert (fdp);
+
+  int fd = glnx_steal_fd (fdp);
+  if (fd >= 0)
+    {
+      errsv = errno;
+      if (close (fd) < 0)
+        g_assert (errno != EBADF);
+      errno = errsv;
+    }
+}
+
+/**
+ * glnx_fd_close:
+ *
+ * Deprecated in favor of `glnx_autofd`.
+ */
+#define glnx_fd_close __attribute__((cleanup(glnx_close_fd)))
+/**
+ * glnx_autofd:
+ *
+ * Call close() on a variable location when it goes out of scope.
+ */
+#define glnx_autofd __attribute__((cleanup(glnx_close_fd)))
+
+G_END_DECLS
diff --git a/libglnx/glnx-lockfile.c b/libglnx/glnx-lockfile.c
new file mode 100644 (file)
index 0000000..2956eda
--- /dev/null
@@ -0,0 +1,179 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+  Now copied into libglnx:
+    - Use GError
+
+  Copyright 2010 Lennart Poettering
+  Copyright 2015 Colin Walters <walters@verbum.org>
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <limits.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "glnx-lockfile.h"
+#include "glnx-errors.h"
+#include "glnx-fdio.h"
+#include "glnx-backport-autocleanups.h"
+#include "glnx-local-alloc.h"
+
+#define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
+
+/**
+ * glnx_make_lock_file:
+ * @dfd: Directory file descriptor (if not `AT_FDCWD`, must have lifetime `>=` @out_lock)
+ * @p: Path
+ * @operation: one of `LOCK_SH`, `LOCK_EX`, `LOCK_UN`, as passed to flock()
+ * @out_lock: (out) (caller allocates): Return location for lock
+ * @error: Error
+ *
+ * Block until a lock file named @p (relative to @dfd) can be created,
+ * using the flags in @operation, returning the lock data in the
+ * caller-allocated location @out_lock.
+ *
+ * This API wraps new-style process locking if available, otherwise
+ * falls back to BSD locks.
+ */
+gboolean
+glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_lock, GError **error) {
+        glnx_fd_close int fd = -1;
+        g_autofree char *t = NULL;
+        int r;
+
+        /*
+         * We use UNPOSIX locks if they are available. They have nice
+         * semantics, and are mostly compatible with NFS. However,
+         * they are only available on new kernels. When we detect we
+         * are running on an older kernel, then we fall back to good
+         * old BSD locks. They also have nice semantics, but are
+         * slightly problematic on NFS, where they are upgraded to
+         * POSIX locks, even though locally they are orthogonal to
+         * POSIX locks.
+         */
+
+        t = g_strdup(p);
+
+        for (;;) {
+#ifdef F_OFD_SETLK
+                struct flock fl = {
+                        .l_type = (operation & ~LOCK_NB) == LOCK_EX ? F_WRLCK : F_RDLCK,
+                        .l_whence = SEEK_SET,
+                };
+#endif
+                struct stat st;
+
+                fd = openat(dfd, p, O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY, 0600);
+                if (fd < 0)
+                        return glnx_throw_errno(error);
+
+                /* Unfortunately, new locks are not in RHEL 7.1 glibc */
+#ifdef F_OFD_SETLK
+                r = fcntl(fd, (operation & LOCK_NB) ? F_OFD_SETLK : F_OFD_SETLKW, &fl);
+#else
+                r = -1;
+                errno = EINVAL;
+#endif
+                if (r < 0) {
+
+                        /* If the kernel is too old, use good old BSD locks */
+                        if (errno == EINVAL)
+                                r = flock(fd, operation);
+
+                        if (r < 0)
+                                return glnx_throw_errno_prefix (error, "flock");
+                }
+
+                /* If we acquired the lock, let's check if the file
+                 * still exists in the file system. If not, then the
+                 * previous exclusive owner removed it and then closed
+                 * it. In such a case our acquired lock is worthless,
+                 * hence try again. */
+
+                if (!glnx_fstat (fd, &st, error))
+                        return FALSE;
+                if (st.st_nlink > 0)
+                        break;
+
+                glnx_close_fd (&fd);
+        }
+
+        /* Note that if this is not AT_FDCWD, the caller takes responsibility
+         * for the fd's lifetime being >= that of the lock.
+         */
+        out_lock->initialized = TRUE;
+        out_lock->dfd = dfd;
+        out_lock->path = g_steal_pointer (&t);
+        out_lock->fd = glnx_steal_fd (&fd);
+        out_lock->operation = operation;
+        return TRUE;
+}
+
+void glnx_release_lock_file(GLnxLockFile *f) {
+        int r;
+
+        if (!(f && f->initialized))
+                return;
+
+        if (f->path) {
+
+                /* If we are the exclusive owner we can safely delete
+                 * the lock file itself. If we are not the exclusive
+                 * owner, we can try becoming it. */
+
+                if (f->fd >= 0 &&
+                    (f->operation & ~LOCK_NB) == LOCK_SH) {
+#ifdef F_OFD_SETLK
+                        static const struct flock fl = {
+                                .l_type = F_WRLCK,
+                                .l_whence = SEEK_SET,
+                        };
+
+                        r = fcntl(f->fd, F_OFD_SETLK, &fl);
+#else
+                        r = -1;
+                        errno = EINVAL;
+#endif
+                        if (r < 0 && errno == EINVAL)
+                                r = flock(f->fd, LOCK_EX|LOCK_NB);
+
+                        if (r >= 0)
+                                f->operation = LOCK_EX|LOCK_NB;
+                }
+
+                if ((f->operation & ~LOCK_NB) == LOCK_EX) {
+                        (void) unlinkat(f->dfd, f->path, 0);
+                }
+
+                g_free(f->path);
+                f->path = NULL;
+        }
+
+        glnx_close_fd (&f->fd);
+        f->operation = 0;
+        f->initialized = FALSE;
+}
diff --git a/libglnx/glnx-lockfile.h b/libglnx/glnx-lockfile.h
new file mode 100644 (file)
index 0000000..b346508
--- /dev/null
@@ -0,0 +1,40 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2011 Lennart Poettering
+  Copyright 2015 Colin Walters <walters@verbum.org>
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "config.h"
+
+#include "glnx-backport-autoptr.h"
+
+typedef struct GLnxLockFile {
+        gboolean initialized;
+        int dfd;
+        char *path;
+        int fd;
+        int operation;
+} GLnxLockFile;
+
+gboolean glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *ret, GError **error);
+void glnx_release_lock_file(GLnxLockFile *f);
+
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxLockFile, glnx_release_lock_file)
diff --git a/libglnx/glnx-macros.h b/libglnx/glnx-macros.h
new file mode 100644 (file)
index 0000000..6d8aca9
--- /dev/null
@@ -0,0 +1,189 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Colin Walters <walters@verbum.org>
+ * With original source from systemd:
+ * Copyright 2010 Lennart Poettering
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+/* All of these are for C only. */
+#ifndef __GI_SCANNER__
+
+/* Taken from https://github.com/systemd/systemd/src/basic/string-util.h
+ * at revision v228-666-gcf6c8c4
+ */
+#define glnx_strjoina(a, ...)                                           \
+        ({                                                              \
+                const char *_appendees_[] = { a, __VA_ARGS__ };         \
+                char *_d_, *_p_;                                        \
+                size_t _len_ = 0;                                       \
+                unsigned _i_;                                           \
+                for (_i_ = 0; _i_ < G_N_ELEMENTS(_appendees_) && _appendees_[_i_]; _i_++) \
+                        _len_ += strlen(_appendees_[_i_]);              \
+                _p_ = _d_ = alloca(_len_ + 1);                          \
+                for (_i_ = 0; _i_ < G_N_ELEMENTS(_appendees_) && _appendees_[_i_]; _i_++) \
+                        _p_ = stpcpy(_p_, _appendees_[_i_]);            \
+                *_p_ = 0;                                               \
+                _d_;                                                    \
+        })
+
+#ifndef G_IN_SET
+
+/* Infrastructure for `G_IN_SET`; this code is copied from
+ * systemd's macro.h - please treat that version as canonical
+ * and submit patches first to systemd.
+ */
+#define _G_INSET_CASE_F(X) case X:
+#define _G_INSET_CASE_F_1(CASE, X) _G_INSET_CASE_F(X)
+#define _G_INSET_CASE_F_2(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_1(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_3(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_2(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_4(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_3(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_5(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_4(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_6(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_5(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_7(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_6(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_8(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_7(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_9(CASE, X, ...)  CASE(X) _G_INSET_CASE_F_8(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_10(CASE, X, ...) CASE(X) _G_INSET_CASE_F_9(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_11(CASE, X, ...) CASE(X) _G_INSET_CASE_F_10(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_12(CASE, X, ...) CASE(X) _G_INSET_CASE_F_11(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_13(CASE, X, ...) CASE(X) _G_INSET_CASE_F_12(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_14(CASE, X, ...) CASE(X) _G_INSET_CASE_F_13(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_15(CASE, X, ...) CASE(X) _G_INSET_CASE_F_14(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_16(CASE, X, ...) CASE(X) _G_INSET_CASE_F_15(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_17(CASE, X, ...) CASE(X) _G_INSET_CASE_F_16(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_18(CASE, X, ...) CASE(X) _G_INSET_CASE_F_17(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_19(CASE, X, ...) CASE(X) _G_INSET_CASE_F_18(CASE, __VA_ARGS__)
+#define _G_INSET_CASE_F_20(CASE, X, ...) CASE(X) _G_INSET_CASE_F_19(CASE, __VA_ARGS__)
+
+#define _G_INSET_GET_CASE_F(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,NAME,...) NAME
+#define _G_INSET_FOR_EACH_MAKE_CASE(...) \
+  _G_INSET_GET_CASE_F(__VA_ARGS__,_G_INSET_CASE_F_20,_G_INSET_CASE_F_19,_G_INSET_CASE_F_18,_G_INSET_CASE_F_17,_G_INSET_CASE_F_16,_G_INSET_CASE_F_15,_G_INSET_CASE_F_14,_G_INSET_CASE_F_13,_G_INSET_CASE_F_12,_G_INSET_CASE_F_11, \
+                               _G_INSET_CASE_F_10,_G_INSET_CASE_F_9,_G_INSET_CASE_F_8,_G_INSET_CASE_F_7,_G_INSET_CASE_F_6,_G_INSET_CASE_F_5,_G_INSET_CASE_F_4,_G_INSET_CASE_F_3,_G_INSET_CASE_F_2,_G_INSET_CASE_F_1) \
+                   (_G_INSET_CASE_F,__VA_ARGS__)
+
+/* Note: claiming the name here even though it isn't upstream yet
+ * https://bugzilla.gnome.org/show_bug.cgi?id=783751
+ */
+/**
+ * G_IN_SET:
+ * @x: Integer (or smaller) sized value
+ * @...: Elements to compare
+ *
+ * It's quite common to test whether or not `char` values or Unix @errno (among) others
+ * are members of a small set.  Normally one has to choose to either use `if (x == val || x == otherval ...)`
+ * or a `switch` statement.  This macro is useful to reduce duplication in the first case,
+ * where one can write simply `if (G_IN_SET (x, val, otherval))`, and avoid the verbosity
+ * that the `switch` statement requires.
+ */
+#define G_IN_SET(x, ...)                          \
+        ({                                      \
+                gboolean _g_inset_found = FALSE;            \
+                /* If the build breaks in the line below, you need to extend the case macros */ \
+                static G_GNUC_UNUSED char _static_assert__macros_need_to_be_extended[20 - sizeof((int[]){__VA_ARGS__})/sizeof(int)]; \
+                switch(x) {                     \
+                _G_INSET_FOR_EACH_MAKE_CASE(__VA_ARGS__) \
+                        _g_inset_found = TRUE;          \
+                        break;                  \
+                default:                        \
+                        break;                  \
+                }                               \
+                _g_inset_found;                 \
+        })
+
+#endif /* ifndef G_IN_SET */
+
+#define _GLNX_CONCAT(a, b)  a##b
+#define _GLNX_CONCAT_INDIRECT(a, b) _GLNX_CONCAT(a, b)
+#define _GLNX_MAKE_ANONYMOUS(a) _GLNX_CONCAT_INDIRECT(a, __COUNTER__)
+
+#define _GLNX_HASH_TABLE_FOREACH_IMPL_KV(guard, ht, it, kt, k, vt, v)          \
+    gboolean guard = TRUE;                                                     \
+    G_STATIC_ASSERT (sizeof (kt) == sizeof (void*));                           \
+    G_STATIC_ASSERT (sizeof (vt) == sizeof (void*));                           \
+    for (GHashTableIter it;                                                    \
+         guard && ({ g_hash_table_iter_init (&it, ht), TRUE; });               \
+         guard = FALSE)                                                        \
+            for (kt k; guard; guard = FALSE)                                   \
+                for (vt v; g_hash_table_iter_next (&it, (gpointer)&k, (gpointer)&v);)
+
+
+/* Cleaner method to iterate over a GHashTable. I.e. rather than
+ *
+ *   gpointer k, v;
+ *   GHashTableIter it;
+ *   g_hash_table_iter_init (&it, table);
+ *   while (g_hash_table_iter_next (&it, &k, &v))
+ *     {
+ *       const char *str = k;
+ *       GPtrArray *arr = v;
+ *       ...
+ *     }
+ *
+ * you can simply do
+ *
+ *   GLNX_HASH_TABLE_FOREACH_IT (table, it, const char*, str, GPtrArray*, arr)
+ *     {
+ *       ...
+ *     }
+ *
+ * All variables are scoped within the loop. You may use the `it` variable as
+ * usual, e.g. to remove an element using g_hash_table_iter_remove(&it). There
+ * are shorter variants for the more common cases where you do not need access
+ * to the iterator or to keys/values:
+ *
+ *   GLNX_HASH_TABLE_FOREACH (table, const char*, str) { ... }
+ *   GLNX_HASH_TABLE_FOREACH_V (table, MyData*, data) { ... }
+ *   GLNX_HASH_TABLE_FOREACH_KV (table, const char*, str, MyData*, data) { ... }
+ *
+ */
+#define GLNX_HASH_TABLE_FOREACH_IT(ht, it, kt, k, vt, v) \
+    _GLNX_HASH_TABLE_FOREACH_IMPL_KV( \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_guard_), ht, it, kt, k, vt, v)
+
+/* Variant of GLNX_HASH_TABLE_FOREACH without having to specify an iterator. An
+ * anonymous iterator will be created. */
+#define GLNX_HASH_TABLE_FOREACH_KV(ht, kt, k, vt, v) \
+    _GLNX_HASH_TABLE_FOREACH_IMPL_KV( \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_guard_), ht, \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_it_), kt, k, vt, v)
+
+/* Variant of GLNX_HASH_TABLE_FOREACH_KV which omits unpacking keys. */
+#define GLNX_HASH_TABLE_FOREACH_V(ht, vt, v) \
+    _GLNX_HASH_TABLE_FOREACH_IMPL_KV( \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_guard_), ht, \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_it_), \
+         gpointer, _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_v_), \
+         vt, v)
+
+/* Variant of GLNX_HASH_TABLE_FOREACH_KV which omits unpacking vals. */
+#define GLNX_HASH_TABLE_FOREACH(ht, kt, k) \
+    _GLNX_HASH_TABLE_FOREACH_IMPL_KV( \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_guard_), ht, \
+         _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_it_), kt, k, \
+         gpointer, _GLNX_MAKE_ANONYMOUS(_glnx_ht_iter_v_))
+
+#endif /* GI_SCANNER */
+
+G_END_DECLS
diff --git a/libglnx/glnx-missing-syscall.h b/libglnx/glnx-missing-syscall.h
new file mode 100644 (file)
index 0000000..fef6e60
--- /dev/null
@@ -0,0 +1,153 @@
+/***
+  This file was originally part of systemd.
+
+  Copyright 2010 Lennart Poettering
+  Copyright 2016 Zbigniew Jędrzejewski-Szmek
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+/* Missing glibc definitions to access certain kernel APIs.
+   This file is last updated from systemd git:
+
+   commit 71e5200f94b22589922704aa4abdf95d4fe2e528
+   Author:     Daniel Mack <daniel@zonque.org>
+   AuthorDate: Tue Oct 18 17:57:10 2016 +0200
+   Commit:     Lennart Poettering <lennart@poettering.net>
+   CommitDate: Fri Sep 22 15:24:54 2017 +0200
+
+   Add abstraction model for BPF programs
+*/
+
+
+#if !HAVE_DECL_RENAMEAT2
+#  ifndef __NR_renameat2
+#    if defined __x86_64__
+#      define __NR_renameat2 316
+#    elif defined __arm__
+#      define __NR_renameat2 382
+#    elif defined __aarch64__
+#      define __NR_renameat2 276
+#    elif defined _MIPS_SIM
+#      if _MIPS_SIM == _MIPS_SIM_ABI32
+#        define __NR_renameat2 4351
+#      endif
+#      if _MIPS_SIM == _MIPS_SIM_NABI32
+#        define __NR_renameat2 6315
+#      endif
+#      if _MIPS_SIM == _MIPS_SIM_ABI64
+#        define __NR_renameat2 5311
+#      endif
+#    elif defined __i386__
+#      define __NR_renameat2 353
+#    elif defined __powerpc64__
+#      define __NR_renameat2 357
+#    elif defined __s390__ || defined __s390x__
+#      define __NR_renameat2 347
+#    elif defined __arc__
+#      define __NR_renameat2 276
+#    else
+#      warning "__NR_renameat2 unknown for your architecture"
+#    endif
+#  endif
+
+static inline int renameat2(int oldfd, const char *oldname, int newfd, const char *newname, unsigned flags) {
+#  ifdef __NR_renameat2
+        return syscall(__NR_renameat2, oldfd, oldname, newfd, newname, flags);
+#  else
+        errno = ENOSYS;
+        return -1;
+#  endif
+}
+#endif
+
+#if !HAVE_DECL_MEMFD_CREATE
+#  ifndef __NR_memfd_create
+#    if defined __x86_64__
+#      define __NR_memfd_create 319
+#    elif defined __arm__
+#      define __NR_memfd_create 385
+#    elif defined __aarch64__
+#      define __NR_memfd_create 279
+#    elif defined __s390__
+#      define __NR_memfd_create 350
+#    elif defined _MIPS_SIM
+#      if _MIPS_SIM == _MIPS_SIM_ABI32
+#        define __NR_memfd_create 4354
+#      endif
+#      if _MIPS_SIM == _MIPS_SIM_NABI32
+#        define __NR_memfd_create 6318
+#      endif
+#      if _MIPS_SIM == _MIPS_SIM_ABI64
+#        define __NR_memfd_create 5314
+#      endif
+#    elif defined __i386__
+#      define __NR_memfd_create 356
+#    elif defined __arc__
+#      define __NR_memfd_create 279
+#    else
+#      warning "__NR_memfd_create unknown for your architecture"
+#    endif
+#  endif
+
+static inline int memfd_create(const char *name, unsigned int flags) {
+#  ifdef __NR_memfd_create
+        return syscall(__NR_memfd_create, name, flags);
+#  else
+        errno = ENOSYS;
+        return -1;
+#  endif
+}
+#endif
+
+/* Copied from systemd git:
+   commit 6bda23dd6aaba50cf8e3e6024248cf736cc443ca
+   Author:     Yu Watanabe <watanabe.yu+github@gmail.com>
+   AuthorDate: Thu Jul 27 20:22:54 2017 +0900
+   Commit:     Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
+   CommitDate: Thu Jul 27 07:22:54 2017 -0400
+*/
+#if !HAVE_DECL_COPY_FILE_RANGE
+#  ifndef __NR_copy_file_range
+#    if defined(__x86_64__)
+#      define __NR_copy_file_range 326
+#    elif defined(__i386__)
+#      define __NR_copy_file_range 377
+#    elif defined __s390__
+#      define __NR_copy_file_range 375
+#    elif defined __arm__
+#      define __NR_copy_file_range 391
+#    elif defined __aarch64__
+#      define __NR_copy_file_range 285
+#    elif defined __powerpc__
+#      define __NR_copy_file_range 379
+#    elif defined __arc__
+#      define __NR_copy_file_range 285
+#    else
+#      warning "__NR_copy_file_range not defined for your architecture"
+#    endif
+#  endif
+
+static inline ssize_t copy_file_range(int fd_in, loff_t *off_in,
+                                      int fd_out, loff_t *off_out,
+                                      size_t len,
+                                      unsigned int flags) {
+#  ifdef __NR_copy_file_range
+        return syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags);
+#  else
+        errno = ENOSYS;
+        return -1;
+#  endif
+}
+#endif
diff --git a/libglnx/glnx-missing.h b/libglnx/glnx-missing.h
new file mode 100644 (file)
index 0000000..0eba07b
--- /dev/null
@@ -0,0 +1,95 @@
+#pragma once
+
+/***
+  This file was originally part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+/* Missing glibc definitions to access certain kernel APIs.
+   This file is last updated from systemd git:
+
+   commit 71e5200f94b22589922704aa4abdf95d4fe2e528
+   Author:     Daniel Mack <daniel@zonque.org>
+   AuthorDate: Tue Oct 18 17:57:10 2016 +0200
+   Commit:     Lennart Poettering <lennart@poettering.net>
+   CommitDate: Fri Sep 22 15:24:54 2017 +0200
+
+   Add abstraction model for BPF programs
+*/
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <uchar.h>
+#include <unistd.h>
+
+/* The precise definition of __O_TMPFILE is arch specific; use the
+ * values defined by the kernel (note: some are hexa, some are octal,
+ * duplicated as-is from the kernel definitions):
+ * - alpha, parisc, sparc: each has a specific value;
+ * - others: they use the "generic" value.
+ */
+
+#ifndef __O_TMPFILE
+#if defined(__alpha__)
+#define __O_TMPFILE     0100000000
+#elif defined(__parisc__) || defined(__hppa__)
+#define __O_TMPFILE     0400000000
+#elif defined(__sparc__) || defined(__sparc64__)
+#define __O_TMPFILE     0x2000000
+#else
+#define __O_TMPFILE     020000000
+#endif
+#endif
+
+/* a horrid kludge trying to make sure that this will fail on old kernels */
+#ifndef O_TMPFILE
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+
+#ifndef RENAME_NOREPLACE
+#define RENAME_NOREPLACE (1 << 0)
+#endif
+#ifndef RENAME_EXCHANGE
+#define RENAME_EXCHANGE (1 << 1)
+#endif
+
+#ifndef F_LINUX_SPECIFIC_BASE
+#define F_LINUX_SPECIFIC_BASE 1024
+#endif
+
+#ifndef F_ADD_SEALS
+#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
+#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
+
+#define F_SEAL_SEAL     0x0001  /* prevent further seals from being set */
+#define F_SEAL_SHRINK   0x0002  /* prevent file from shrinking */
+#define F_SEAL_GROW     0x0004  /* prevent file from growing */
+#define F_SEAL_WRITE    0x0008  /* prevent writes */
+#endif
+
+#ifndef MFD_ALLOW_SEALING
+#define MFD_ALLOW_SEALING 0x0002U
+#endif
+
+#ifndef MFD_CLOEXEC
+#define MFD_CLOEXEC 0x0001U
+#endif
+
+#include "glnx-missing-syscall.h"
diff --git a/libglnx/glnx-shutil.c b/libglnx/glnx-shutil.c
new file mode 100644 (file)
index 0000000..8438b5d
--- /dev/null
@@ -0,0 +1,261 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glnx-shutil.h>
+#include <glnx-errors.h>
+#include <glnx-local-alloc.h>
+
+static gboolean
+glnx_shutil_rm_rf_children (GLnxDirFdIterator    *dfd_iter,
+                            GCancellable       *cancellable,
+                            GError            **error)
+{
+  struct dirent *dent;
+
+  while (TRUE)
+    {
+      if (!glnx_dirfd_iterator_next_dent_ensure_dtype (dfd_iter, &dent, cancellable, error))
+        return FALSE;
+      if (dent == NULL)
+        break;
+
+      if (dent->d_type == DT_DIR)
+        {
+          g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
+
+          if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, dent->d_name, FALSE,
+                                            &child_dfd_iter, error))
+            return FALSE;
+
+          if (!glnx_shutil_rm_rf_children (&child_dfd_iter, cancellable, error))
+            return FALSE;
+
+          if (unlinkat (dfd_iter->fd, dent->d_name, AT_REMOVEDIR) == -1)
+            return glnx_throw_errno_prefix (error, "unlinkat");
+        }
+      else
+        {
+          if (unlinkat (dfd_iter->fd, dent->d_name, 0) == -1)
+            {
+              if (errno != ENOENT)
+                return glnx_throw_errno_prefix (error, "unlinkat");
+            }
+        }
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_shutil_rm_rf_at:
+ * @dfd: A directory file descriptor, or `AT_FDCWD` or `-1` for current
+ * @path: Path
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Recursively delete the filename referenced by the combination of
+ * the directory fd @dfd and @path; it may be a file or directory.  No
+ * error is thrown if @path does not exist.
+ */
+gboolean
+glnx_shutil_rm_rf_at (int                   dfd,
+                      const char           *path,
+                      GCancellable         *cancellable,
+                      GError              **error)
+{
+  glnx_fd_close int target_dfd = -1;
+  g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
+
+  dfd = glnx_dirfd_canonicalize (dfd);
+
+  /* With O_NOFOLLOW first */
+  target_dfd = openat (dfd, path,
+                       O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
+
+  if (target_dfd == -1)
+    {
+      int errsv = errno;
+      if (errsv == ENOENT)
+        {
+          ;
+        }
+      else if (errsv == ENOTDIR || errsv == ELOOP)
+        {
+          if (unlinkat (dfd, path, 0) != 0)
+            return glnx_throw_errno_prefix (error, "unlinkat");
+        }
+      else
+        return glnx_throw_errno_prefix (error, "open(%s)", path);
+    }
+  else
+    {
+      if (!glnx_dirfd_iterator_init_take_fd (&target_dfd, &dfd_iter, error))
+        return FALSE;
+
+      if (!glnx_shutil_rm_rf_children (&dfd_iter, cancellable, error))
+        return FALSE;
+
+      if (unlinkat (dfd, path, AT_REMOVEDIR) == -1)
+        {
+          if (errno != ENOENT)
+            return glnx_throw_errno_prefix (error, "unlinkat");
+        }
+    }
+
+  return TRUE;
+}
+
+static gboolean
+mkdir_p_at_internal (int              dfd,
+                     char            *path,
+                     int              mode,
+                     GCancellable    *cancellable,
+                     GError         **error)
+{
+  gboolean did_recurse = FALSE;
+
+  if (g_cancellable_set_error_if_cancelled (cancellable, error))
+    return FALSE;
+
+ again:
+  if (mkdirat (dfd, path, mode) == -1)
+    {
+      if (errno == ENOENT)
+        {
+          char *lastslash;
+
+          g_assert (!did_recurse);
+
+          lastslash = strrchr (path, '/');
+          if (lastslash == NULL)
+            {
+              /* This can happen if @dfd was deleted between being opened and
+               * passed to mkdir_p_at_internal(). */
+              return glnx_throw_errno_prefix (error, "mkdir(%s)", path);
+            }
+
+          /* Note we can mutate the buffer as we dup'd it */
+          *lastslash = '\0';
+
+          if (!glnx_shutil_mkdir_p_at (dfd, path, mode,
+                                       cancellable, error))
+            return FALSE;
+
+          /* Now restore it for another mkdir attempt */
+          *lastslash = '/';
+
+          did_recurse = TRUE;
+          goto again;
+        }
+      else if (errno == EEXIST)
+        {
+          /* Fall through; it may not have been a directory,
+           * but we'll find that out on the next call up.
+           */
+        }
+      else
+        return glnx_throw_errno_prefix (error, "mkdir(%s)", path);
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_shutil_mkdir_p_at:
+ * @dfd: Directory fd
+ * @path: Directory path to be created
+ * @mode: Mode for newly created directories
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Similar to g_mkdir_with_parents(), except operates relative to the
+ * directory fd @dfd.
+ *
+ * See also glnx_ensure_dir() for a non-recursive version.
+ *
+ * This will return %G_IO_ERROR_NOT_FOUND if @dfd has been deleted since being
+ * opened. It may return other errors from mkdirat() in other situations.
+ */
+gboolean
+glnx_shutil_mkdir_p_at (int                   dfd,
+                        const char           *path,
+                        int                   mode,
+                        GCancellable         *cancellable,
+                        GError              **error)
+{
+  struct stat stbuf;
+  char *buf;
+
+  /* Fast path stat to see whether it already exists */
+  if (fstatat (dfd, path, &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
+    {
+      /* Note early return */
+      if (S_ISDIR (stbuf.st_mode))
+        return TRUE;
+    }
+
+  buf = strdupa (path);
+
+  if (!mkdir_p_at_internal (dfd, buf, mode, cancellable, error))
+    return FALSE;
+
+  return TRUE;
+}
+
+/**
+ * glnx_shutil_mkdir_p_at_open:
+ * @dfd: Directory fd
+ * @path: Directory path to be created
+ * @mode: Mode for newly created directories
+ * @out_dfd: (out caller-allocates): Return location for an FD to @dfd/@path,
+ *    or `-1` on error
+ * @cancellable: (nullable): Cancellable, or %NULL
+ * @error: Return location for a #GError, or %NULL
+ *
+ * Similar to glnx_shutil_mkdir_p_at(), except it opens the resulting directory
+ * and returns a directory FD to it. Currently, this is not guaranteed to be
+ * race-free.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ * Since: UNRELEASED
+ */
+gboolean
+glnx_shutil_mkdir_p_at_open (int            dfd,
+                             const char    *path,
+                             int            mode,
+                             int           *out_dfd,
+                             GCancellable  *cancellable,
+                             GError       **error)
+{
+  /* FIXME: It’s not possible to eliminate the race here until
+   * openat(O_DIRECTORY | O_CREAT) works (and returns a directory rather than a
+   * file). It appears to be not supported in current kernels. (Tested with
+   * 4.10.10-200.fc25.x86_64.) */
+  *out_dfd = -1;
+
+  if (!glnx_shutil_mkdir_p_at (dfd, path, mode, cancellable, error))
+    return FALSE;
+
+  return glnx_opendirat (dfd, path, TRUE, out_dfd, error);
+}
diff --git a/libglnx/glnx-shutil.h b/libglnx/glnx-shutil.h
new file mode 100644 (file)
index 0000000..56a99fa
--- /dev/null
@@ -0,0 +1,48 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-dirfd.h>
+
+G_BEGIN_DECLS
+
+gboolean
+glnx_shutil_rm_rf_at (int                   dfd,
+                      const char           *path,
+                      GCancellable         *cancellable,
+                      GError              **error);
+
+gboolean
+glnx_shutil_mkdir_p_at (int                   dfd,
+                        const char           *path,
+                        int                   mode,
+                        GCancellable         *cancellable,
+                        GError              **error);
+
+gboolean
+glnx_shutil_mkdir_p_at_open (int            dfd,
+                             const char    *path,
+                             int            mode,
+                             int           *out_dfd,
+                             GCancellable  *cancellable,
+                             GError       **error);
+
+G_END_DECLS
diff --git a/libglnx/glnx-xattrs.c b/libglnx/glnx-xattrs.c
new file mode 100644 (file)
index 0000000..79a14cd
--- /dev/null
@@ -0,0 +1,444 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+
+#include <glnx-macros.h>
+#include <glnx-xattrs.h>
+#include <glnx-errors.h>
+#include <glnx-local-alloc.h>
+
+static GVariant *
+variant_new_ay_bytes (GBytes *bytes)
+{
+  gsize size;
+  gconstpointer data;
+  data = g_bytes_get_data (bytes, &size);
+  g_bytes_ref (bytes);
+  return g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data, size,
+                                  TRUE, (GDestroyNotify)g_bytes_unref, bytes);
+}
+
+static char *
+canonicalize_xattrs (char    *xattr_string,
+                     size_t   len)
+{
+  char *p;
+  GSList *xattrs = NULL;
+  GSList *iter;
+  GString *result;
+
+  result = g_string_new (0);
+
+  p = xattr_string;
+  while (p < xattr_string+len)
+    {
+      xattrs = g_slist_prepend (xattrs, p);
+      p += strlen (p) + 1;
+    }
+
+  xattrs = g_slist_sort (xattrs, (GCompareFunc) strcmp);
+  for (iter = xattrs; iter; iter = iter->next) {
+    g_string_append (result, iter->data);
+    g_string_append_c (result, '\0');
+  }
+
+  g_slist_free (xattrs);
+  return g_string_free (result, FALSE);
+}
+
+static gboolean
+read_xattr_name_array (const char *path,
+                       int         fd,
+                       const char *xattrs,
+                       size_t      len,
+                       GVariantBuilder *builder,
+                       GError  **error)
+{
+  gboolean ret = FALSE;
+  const char *p;
+  int r;
+  const char *funcstr;
+
+  g_assert (path != NULL || fd != -1);
+
+  funcstr = fd != -1 ? "fgetxattr" : "lgetxattr";
+
+  for (p = xattrs; p < xattrs+len; p = p + strlen (p) + 1)
+    {
+      ssize_t bytes_read;
+      g_autofree char *buf = NULL;
+      g_autoptr(GBytes) bytes = NULL;
+
+    again:
+      if (fd != -1)
+        bytes_read = fgetxattr (fd, p, NULL, 0);
+      else
+        bytes_read = lgetxattr (path, p, NULL, 0);
+      if (bytes_read < 0)
+        {
+          if (errno == ENODATA)
+            continue;
+
+          glnx_set_prefix_error_from_errno (error, "%s", funcstr);
+          goto out;
+        }
+      if (bytes_read == 0)
+        continue;
+
+      buf = g_malloc (bytes_read);
+      if (fd != -1)
+        r = fgetxattr (fd, p, buf, bytes_read);
+      else
+        r = lgetxattr (path, p, buf, bytes_read);
+      if (r < 0)
+        {
+          if (errno == ERANGE)
+            {
+              g_free (g_steal_pointer (&buf));
+              goto again;
+            }
+          else if (errno == ENODATA)
+            continue;
+
+          glnx_set_prefix_error_from_errno (error, "%s", funcstr);
+          goto out;
+        }
+
+      bytes = g_bytes_new_take (g_steal_pointer (&buf), bytes_read);
+      g_variant_builder_add (builder, "(@ay@ay)",
+                             g_variant_new_bytestring (p),
+                             variant_new_ay_bytes (bytes));
+    }
+
+  ret = TRUE;
+ out:
+  return ret;
+}
+
+static gboolean
+get_xattrs_impl (const char      *path,
+                 int              fd,
+                 GVariant       **out_xattrs,
+                 GCancellable    *cancellable,
+                 GError         **error)
+{
+  gboolean ret = FALSE;
+  ssize_t bytes_read, real_size;
+  g_autofree char *xattr_names = NULL;
+  g_autofree char *xattr_names_canonical = NULL;
+  GVariantBuilder builder;
+  gboolean builder_initialized = FALSE;
+  g_autoptr(GVariant) ret_xattrs = NULL;
+
+  g_assert (path != NULL || fd != -1);
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)"));
+  builder_initialized = TRUE;
+
+ again:
+  if (path)
+    bytes_read = llistxattr (path, NULL, 0);
+  else
+    bytes_read = flistxattr (fd, NULL, 0);
+
+  if (bytes_read < 0)
+    {
+      if (errno != ENOTSUP)
+        {
+          glnx_set_prefix_error_from_errno (error, "%s", "llistxattr");
+          goto out;
+        }
+    }
+  else if (bytes_read > 0)
+    {
+      xattr_names = g_malloc (bytes_read);
+      if (path)
+        real_size = llistxattr (path, xattr_names, bytes_read);
+      else
+        real_size = flistxattr (fd, xattr_names, bytes_read);
+      if (real_size < 0)
+        {
+          if (errno == ERANGE)
+            {
+              g_free (xattr_names);
+              goto again;
+            }
+          glnx_set_prefix_error_from_errno (error, "%s", "llistxattr");
+          goto out;
+        }
+      else if (real_size > 0)
+        {
+          xattr_names_canonical = canonicalize_xattrs (xattr_names, real_size);
+
+          if (!read_xattr_name_array (path, fd, xattr_names_canonical, real_size, &builder, error))
+            goto out;
+        }
+    }
+
+  ret_xattrs = g_variant_builder_end (&builder);
+  builder_initialized = FALSE;
+  g_variant_ref_sink (ret_xattrs);
+  
+  ret = TRUE;
+  if (out_xattrs)
+    *out_xattrs = g_steal_pointer (&ret_xattrs);
+ out:
+  if (!builder_initialized)
+    g_variant_builder_clear (&builder);
+  return ret;
+}
+
+/**
+ * glnx_fd_get_all_xattrs:
+ * @fd: a file descriptor
+ * @out_xattrs: (out): A new #GVariant containing the extended attributes
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Read all extended attributes from @fd in a canonical sorted order, and
+ * set @out_xattrs with the result.
+ *
+ * If the filesystem does not support extended attributes, @out_xattrs
+ * will have 0 elements, and this function will return successfully.
+ */
+gboolean
+glnx_fd_get_all_xattrs (int            fd,
+                        GVariant     **out_xattrs,
+                        GCancellable  *cancellable,
+                        GError       **error)
+{
+  return get_xattrs_impl (NULL, fd, out_xattrs,
+                          cancellable, error);
+}
+
+/**
+ * glnx_dfd_name_get_all_xattrs:
+ * @dfd: Parent directory file descriptor
+ * @name: File name
+ * @out_xattrs: (out): Extended attribute set
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Load all extended attributes for the file named @name residing in
+ * directory @dfd.
+ */
+gboolean
+glnx_dfd_name_get_all_xattrs (int            dfd,
+                              const char    *name,
+                              GVariant     **out_xattrs,
+                              GCancellable  *cancellable,
+                              GError       **error)
+{
+  if (G_IN_SET(dfd, AT_FDCWD, -1))
+    {
+      return get_xattrs_impl (name, -1, out_xattrs, cancellable, error);
+    }
+  else
+    {
+      char buf[PATH_MAX];
+      /* A workaround for the lack of lgetxattrat(), thanks to Florian Weimer:
+       * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
+       */
+      snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", dfd, name);
+      return get_xattrs_impl (buf, -1, out_xattrs, cancellable, error);
+    }
+}
+
+static gboolean
+set_all_xattrs_for_path (const char    *path,
+                         GVariant      *xattrs,
+                         GCancellable  *cancellable,
+                         GError       **error)
+{
+  const guint n = g_variant_n_children (xattrs);
+  for (guint i = 0; i < n; i++)
+    {
+      const guint8* name;
+      g_autoptr(GVariant) value = NULL;
+      g_variant_get_child (xattrs, i, "(^&ay@ay)",
+                           &name, &value);
+
+      gsize value_len;
+      const guint8* value_data = g_variant_get_fixed_array (value, &value_len, 1);
+
+      if (lsetxattr (path, (char*)name, (char*)value_data, value_len, 0) < 0)
+        return glnx_throw_errno_prefix (error, "lsetxattr");
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_dfd_name_set_all_xattrs:
+ * @dfd: Parent directory file descriptor
+ * @name: File name
+ * @xattrs: Extended attribute set
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Set all extended attributes for the file named @name residing in
+ * directory @dfd.
+ */
+gboolean
+glnx_dfd_name_set_all_xattrs (int            dfd,
+                              const char    *name,
+                              GVariant      *xattrs,
+                              GCancellable  *cancellable,
+                              GError       **error)
+{
+  if (G_IN_SET(dfd, AT_FDCWD, -1))
+    {
+      return set_all_xattrs_for_path (name, xattrs, cancellable, error);
+    }
+  else
+    {
+      char buf[PATH_MAX];
+      /* A workaround for the lack of lsetxattrat(), thanks to Florian Weimer:
+       * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
+       */
+      snprintf (buf, sizeof (buf), "/proc/self/fd/%d/%s", dfd, name);
+      return set_all_xattrs_for_path (buf, xattrs, cancellable, error);
+    }
+}
+
+/**
+ * glnx_fd_set_all_xattrs:
+ * @fd: File descriptor
+ * @xattrs: Extended attributes
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * For each attribute in @xattrs, set its value on the file or
+ * directory referred to by @fd.  This function does not remove any
+ * attributes not in @xattrs.
+ */
+gboolean
+glnx_fd_set_all_xattrs (int            fd,
+                        GVariant      *xattrs,
+                        GCancellable  *cancellable,
+                        GError       **error)
+{
+  const guint n = g_variant_n_children (xattrs);
+  for (guint i = 0; i < n; i++)
+    {
+      const guint8* name;
+      g_autoptr(GVariant) value = NULL;
+      g_variant_get_child (xattrs, i, "(^&ay@ay)",
+                           &name, &value);
+
+      gsize value_len;
+      const guint8* value_data = g_variant_get_fixed_array (value, &value_len, 1);
+
+      if (TEMP_FAILURE_RETRY (fsetxattr (fd, (char*)name, (char*)value_data, value_len, 0)) < 0)
+        return glnx_throw_errno_prefix (error, "fsetxattr");
+    }
+
+  return TRUE;
+}
+
+/**
+ * glnx_lgetxattrat:
+ * @dfd: Directory file descriptor
+ * @subpath: Subpath
+ * @attribute: Extended attribute to retrieve
+ * @error: Error
+ *
+ * Retrieve an extended attribute value, relative to a directory file
+ * descriptor.
+ */
+GBytes *
+glnx_lgetxattrat (int            dfd,
+                  const char    *subpath,
+                  const char    *attribute,
+                  GError       **error)
+{
+  char pathbuf[PATH_MAX];
+  snprintf (pathbuf, sizeof (pathbuf), "/proc/self/fd/%d/%s", dfd, subpath);
+
+  ssize_t bytes_read, real_size;
+  if (TEMP_FAILURE_RETRY (bytes_read = lgetxattr (pathbuf, attribute, NULL, 0)) < 0)
+    return glnx_null_throw_errno_prefix (error, "lgetxattr");
+
+  g_autofree guint8 *buf = g_malloc (bytes_read);
+  if (TEMP_FAILURE_RETRY (real_size = lgetxattr (pathbuf, attribute, buf, bytes_read)) < 0)
+    return glnx_null_throw_errno_prefix (error, "lgetxattr");
+
+  return g_bytes_new_take (g_steal_pointer (&buf), real_size);
+}
+
+/**
+ * glnx_fgetxattr_bytes:
+ * @fd: Directory file descriptor
+ * @attribute: Extended attribute to retrieve
+ * @error: Error
+ *
+ * Returns: (transfer full): An extended attribute value, or %NULL on error
+ */
+GBytes *
+glnx_fgetxattr_bytes (int            fd,
+                      const char    *attribute,
+                      GError       **error)
+{
+  ssize_t bytes_read, real_size;
+
+  if (TEMP_FAILURE_RETRY (bytes_read = fgetxattr (fd, attribute, NULL, 0)) < 0)
+    return glnx_null_throw_errno_prefix (error, "fgetxattr");
+
+  g_autofree guint8 *buf = g_malloc (bytes_read);
+  if (TEMP_FAILURE_RETRY (real_size = fgetxattr (fd, attribute, buf, bytes_read)) < 0)
+    return glnx_null_throw_errno_prefix (error, "fgetxattr");
+
+  return g_bytes_new_take (g_steal_pointer (&buf), real_size);
+}
+
+/**
+ * glnx_lsetxattrat:
+ * @dfd: Directory file descriptor
+ * @subpath: Path
+ * @attribute: An attribute name
+ * @value: (array length=len) (element-type guint8): Attribute value
+ * @len: Length of @value
+ * @flags: Flags, containing either XATTR_CREATE or XATTR_REPLACE
+ * @error: Error
+ *
+ * Set an extended attribute, relative to a directory file descriptor.
+ */
+gboolean
+glnx_lsetxattrat (int            dfd,
+                  const char    *subpath,
+                  const char    *attribute,
+                  const guint8  *value,
+                  gsize          len,
+                  int            flags,
+                  GError       **error)
+{
+  char pathbuf[PATH_MAX];
+  snprintf (pathbuf, sizeof (pathbuf), "/proc/self/fd/%d/%s", dfd, subpath);
+
+  if (TEMP_FAILURE_RETRY (lsetxattr (subpath, attribute, value, len, flags)) < 0)
+    return glnx_throw_errno_prefix (error, "lsetxattr");
+
+  return TRUE;
+}
+
diff --git a/libglnx/glnx-xattrs.h b/libglnx/glnx-xattrs.h
new file mode 100644 (file)
index 0000000..a566a22
--- /dev/null
@@ -0,0 +1,78 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2014,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glnx-backport-autocleanups.h>
+#include <limits.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/xattr.h>
+
+G_BEGIN_DECLS
+
+gboolean
+glnx_dfd_name_get_all_xattrs (int                    dfd,
+                              const char            *name,
+                              GVariant             **out_xattrs,
+                              GCancellable          *cancellable,
+                              GError               **error);
+
+gboolean
+glnx_fd_get_all_xattrs (int                    fd,
+                        GVariant             **out_xattrs,
+                        GCancellable          *cancellable,
+                        GError               **error);
+
+gboolean
+glnx_dfd_name_set_all_xattrs (int            dfd,
+                              const char    *name,
+                              GVariant      *xattrs,
+                              GCancellable  *cancellable,
+                              GError       **error);
+
+gboolean
+glnx_fd_set_all_xattrs (int            fd,
+                        GVariant      *xattrs,
+                        GCancellable  *cancellable,
+                        GError       **error);
+
+GBytes *
+glnx_lgetxattrat (int            dfd,
+                  const char    *subpath,
+                  const char    *attribute,
+                  GError       **error);
+
+GBytes *
+glnx_fgetxattr_bytes (int            fd,
+                      const char    *attribute,
+                      GError       **error);
+
+gboolean
+glnx_lsetxattrat (int            dfd,
+                  const char    *subpath,
+                  const char    *attribute,
+                  const guint8  *value,
+                  gsize          len,
+                  int            flags,
+                  GError       **error);
+
+G_END_DECLS
diff --git a/libglnx/libglnx.h b/libglnx/libglnx.h
new file mode 100644 (file)
index 0000000..411d4fa
--- /dev/null
@@ -0,0 +1,40 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012,2013,2015 Colin Walters <walters@verbum.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#include <glnx-macros.h>
+#include <glnx-missing.h>
+#include <glnx-local-alloc.h>
+#include <glnx-backport-autocleanups.h>
+#include <glnx-backports.h>
+#include <glnx-lockfile.h>
+#include <glnx-errors.h>
+#include <glnx-dirfd.h>
+#include <glnx-shutil.h>
+#include <glnx-xattrs.h>
+#include <glnx-console.h>
+#include <glnx-fdio.h>
+
+G_END_DECLS
diff --git a/libglnx/libglnx.m4 b/libglnx/libglnx.m4
new file mode 100644 (file)
index 0000000..770f117
--- /dev/null
@@ -0,0 +1,29 @@
+AC_DEFUN([LIBGLNX_CONFIGURE],
+[
+AC_CHECK_DECLS([renameat2, memfd_create],
+        [], [], [[
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/mount.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <linux/loop.h>
+#include <linux/random.h>
+]])
+
+AC_ARG_ENABLE(otmpfile,
+              [AS_HELP_STRING([--disable-otmpfile],
+                              [Disable use of O_TMPFILE [default=no]])],,
+              [enable_otmpfile=yes])
+AS_IF([test $enable_otmpfile = yes], [], [
+  AC_DEFINE([DISABLE_OTMPFILE], 1, [Define if we should avoid using O_TMPFILE])])
+
+AC_ARG_ENABLE(wrpseudo-compat,
+              [AS_HELP_STRING([--enable-wrpseudo-compat],
+                              [Disable use syscall() and filesystem calls to for compatibility with wrpseudo [default=no]])],,
+              [enable_wrpseudo_compat=no])
+AS_IF([test $enable_wrpseudo_compat = no], [], [
+  AC_DEFINE([ENABLE_WRPSEUDO_COMPAT], 1, [Define if we should be compatible with wrpseudo])])
+
+dnl end LIBGLNX_CONFIGURE
+])
diff --git a/libglnx/tests/libglnx-testlib.h b/libglnx/tests/libglnx-testlib.h
new file mode 100644 (file)
index 0000000..ee750e4
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+typedef GError _GLnxTestAutoError;
+static inline void
+_glnx_test_auto_error_cleanup (_GLnxTestAutoError *autoerror)
+{
+  g_assert_no_error (autoerror);
+  /* We could add a clear call here, but no point...we'll have aborted */
+}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(_GLnxTestAutoError, _glnx_test_auto_error_cleanup);
+
+#define _GLNX_TEST_DECLARE_ERROR(local_error, error)      \
+  g_autoptr(_GLnxTestAutoError) local_error = NULL; \
+  GError **error = &local_error
diff --git a/libglnx/tests/test-libglnx-errors.c b/libglnx/tests/test-libglnx-errors.c
new file mode 100644 (file)
index 0000000..4e91e02
--- /dev/null
@@ -0,0 +1,183 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <string.h>
+
+static void
+test_error_throw (void)
+{
+  g_autoptr(GError) error = NULL;
+
+  g_assert (!glnx_throw (&error, "foo: %s %d", "hello", 42));
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_assert_cmpstr (error->message, ==, "foo: hello 42");
+  g_clear_error (&error);
+
+  gpointer dummy = glnx_null_throw (&error, "literal foo");
+  g_assert (dummy == NULL);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_assert_cmpstr (error->message, ==, "literal foo");
+  g_clear_error (&error);
+
+  gpointer dummy2 = glnx_null_throw (&error, "foo: %s %d", "hola", 24);
+  g_assert (dummy2 == NULL);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_assert_cmpstr (error->message, ==, "foo: hola 24");
+  g_clear_error (&error);
+}
+
+static void
+test_error_errno (void)
+{
+  g_autoptr(GError) error = NULL;
+  const char noent_path[] = "/enoent-this-should-not-exist";
+  int fd;
+
+  fd = open (noent_path, O_RDONLY);
+  if (fd < 0)
+    {
+      g_assert (!glnx_throw_errno (&error));
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (!glnx_prefix_error (&error, "myprefix"));
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, "myprefix: "));
+      g_clear_error (&error);
+    }
+  else
+    g_assert_cmpint (fd, ==, -1);
+
+  fd = open (noent_path, O_RDONLY);
+  if (fd < 0)
+    {
+      gpointer dummy = glnx_null_throw_errno (&error);
+      g_assert (dummy == NULL);
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      dummy = glnx_prefix_error_null (&error, "myprefix");
+      g_assert (dummy == NULL);
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, "myprefix: "));
+      g_clear_error (&error);
+    }
+  else
+    g_assert_cmpint (fd, ==, -1);
+
+  fd = open (noent_path, O_RDONLY);
+  if (fd < 0)
+    {
+      g_autofree char *expected_prefix = g_strdup_printf ("Failed to open %s", noent_path);
+      g_assert (!glnx_throw_errno_prefix (&error, "Failed to open %s", noent_path));
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, expected_prefix));
+      g_clear_error (&error);
+      /* And test the legacy wrapper */
+      glnx_set_prefix_error_from_errno (&error, "Failed to open %s", noent_path);
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, expected_prefix));
+      g_clear_error (&error);
+    }
+  else
+    g_assert_cmpint (fd, ==, -1);
+
+  fd = open (noent_path, O_RDONLY);
+  if (fd < 0)
+    {
+      gpointer dummy = glnx_null_throw_errno_prefix (&error, "Failed to open file");
+      g_assert (dummy == NULL);
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, "Failed to open file"));
+      g_clear_error (&error);
+    }
+  else
+    g_assert_cmpint (fd, ==, -1);
+
+  fd = open (noent_path, O_RDONLY);
+  if (fd < 0)
+    {
+      gpointer dummy = glnx_null_throw_errno_prefix (&error, "Failed to open %s", noent_path);
+      g_assert (dummy == NULL);
+      g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+      g_assert (g_str_has_prefix (error->message, glnx_strjoina ("Failed to open ", noent_path)));
+      g_clear_error (&error);
+    }
+  else
+    g_assert_cmpint (fd, ==, -1);
+}
+
+static void
+test_error_auto_nothrow (GError **error)
+{
+  GLNX_AUTO_PREFIX_ERROR("foo", error);
+  /* Side effect to avoid otherwise empty function */
+  g_assert_no_error (*error);
+}
+
+static void
+test_error_auto_throw (GError **error)
+{
+  GLNX_AUTO_PREFIX_ERROR("foo", error);
+  (void) glnx_throw (error, "oops");
+}
+
+static void
+test_error_auto_throw_recurse (GError **error)
+{
+  GLNX_AUTO_PREFIX_ERROR("foo", error);
+
+  if (TRUE)
+    {
+      GLNX_AUTO_PREFIX_ERROR("bar", error);
+      (void) glnx_throw (error, "oops");
+    }
+}
+
+static void
+test_error_auto (void)
+{
+  g_autoptr(GError) error = NULL;
+  test_error_auto_nothrow (&error);
+  g_assert_no_error (error);
+  test_error_auto_throw (&error);
+  g_assert_nonnull (error);
+  g_assert_cmpstr (error->message, ==, "foo: oops");
+  g_clear_error (&error);
+  test_error_auto_throw_recurse (&error);
+  g_assert_nonnull (error);
+  g_assert_cmpstr (error->message, ==, "foo: bar: oops");
+}
+
+int main (int argc, char **argv)
+{
+  int ret;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/error-throw", test_error_throw);
+  g_test_add_func ("/error-errno", test_error_errno);
+  g_test_add_func ("/error-auto", test_error_auto);
+
+  ret = g_test_run();
+
+  return ret;
+}
diff --git a/libglnx/tests/test-libglnx-fdio.c b/libglnx/tests/test-libglnx-fdio.c
new file mode 100644 (file)
index 0000000..350294c
--- /dev/null
@@ -0,0 +1,255 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <err.h>
+#include <string.h>
+
+#include "libglnx-testlib.h"
+
+static gboolean
+renameat_test_setup (int *out_srcfd, int *out_destfd,
+                     GError **error)
+{
+  glnx_fd_close int srcfd = -1;
+  glnx_fd_close int destfd = -1;
+
+  (void) glnx_shutil_rm_rf_at (AT_FDCWD, "srcdir", NULL, NULL);
+  if (mkdir ("srcdir", 0755) < 0)
+    err (1, "mkdir");
+  if (!glnx_opendirat (AT_FDCWD, "srcdir", TRUE, &srcfd, error))
+    return FALSE;
+  (void) glnx_shutil_rm_rf_at (AT_FDCWD, "destdir", NULL, NULL);
+  if (mkdir ("destdir", 0755) < 0)
+    err (1, "mkdir");
+  if (!glnx_opendirat (AT_FDCWD, "destdir", TRUE, &destfd, error))
+    return FALSE;
+
+  if (!glnx_file_replace_contents_at (srcfd, "foo", (guint8*)"foo contents", strlen ("foo contents"),
+                                      GLNX_FILE_REPLACE_NODATASYNC, NULL, error))
+    return FALSE;
+  if (!glnx_file_replace_contents_at (destfd, "bar", (guint8*)"bar contents", strlen ("bar contents"),
+                                      GLNX_FILE_REPLACE_NODATASYNC, NULL, error))
+    return FALSE;
+
+  *out_srcfd = srcfd; srcfd = -1;
+  *out_destfd = destfd; destfd = -1;
+  return TRUE;
+}
+
+static void
+test_renameat2_noreplace (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+  glnx_fd_close int srcfd = -1;
+  glnx_fd_close int destfd = -1;
+  struct stat stbuf;
+
+  if (!renameat_test_setup (&srcfd, &destfd, error))
+    return;
+
+  if (glnx_renameat2_noreplace (srcfd, "foo", destfd, "bar") == 0)
+    g_assert_not_reached ();
+  else
+    {
+      g_assert_cmpint (errno, ==, EEXIST);
+    }
+
+  if (glnx_renameat2_noreplace (srcfd, "foo", destfd, "baz") < 0)
+    return (void)glnx_throw_errno_prefix (error, "renameat");
+  if (!glnx_fstatat (destfd, "bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+
+  if (fstatat (srcfd, "foo", &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
+    g_assert_not_reached ();
+  else
+    g_assert_cmpint (errno, ==, ENOENT);
+}
+
+static void
+test_renameat2_exchange (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+
+  glnx_fd_close int srcfd = -1;
+  glnx_fd_close int destfd = -1;
+  if (!renameat_test_setup (&srcfd, &destfd, error))
+    return;
+
+  if (glnx_renameat2_exchange (AT_FDCWD, "srcdir", AT_FDCWD, "destdir") < 0)
+    return (void)glnx_throw_errno_prefix (error, "renameat");
+
+  /* Ensure the dir fds are the same */
+  struct stat stbuf;
+  if (!glnx_fstatat (srcfd, "foo", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+  if (!glnx_fstatat (destfd, "bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+  /* But the dirs should be swapped */
+  if (!glnx_fstatat (AT_FDCWD, "destdir/foo", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+  if (!glnx_fstatat (AT_FDCWD, "srcdir/bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+}
+
+static void
+test_tmpfile (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+
+  g_auto(GLnxTmpfile) tmpf = { 0, };
+  if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, ".", O_WRONLY|O_CLOEXEC, &tmpf, error))
+    return;
+  if (glnx_loop_write (tmpf.fd, "foo", strlen ("foo")) < 0)
+    return (void)glnx_throw_errno_prefix (error, "write");
+  if (glnx_link_tmpfile_at (&tmpf, GLNX_LINK_TMPFILE_NOREPLACE, AT_FDCWD, "foo", error))
+    return;
+}
+
+static void
+test_stdio_file (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+  g_auto(GLnxTmpfile) tmpf = { 0, };
+  g_autoptr(FILE) f = NULL;
+
+  if (!glnx_open_anonymous_tmpfile (O_RDWR|O_CLOEXEC, &tmpf, error))
+    return;
+  f = fdopen (tmpf.fd, "w");
+  tmpf.fd = -1; /* Ownership was transferred via fdopen() */
+  if (!f)
+    return (void)glnx_throw_errno_prefix (error, "fdopen");
+  if (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello"))
+    return (void)glnx_throw_errno_prefix (error, "fwrite");
+  if (!glnx_stdio_file_flush (f, error))
+    return;
+}
+
+static void
+test_fstatat (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+  struct stat stbuf = { 0, };
+
+  if (!glnx_fstatat_allow_noent (AT_FDCWD, ".", &stbuf, 0, error))
+    return;
+  g_assert_cmpint (errno, ==, 0);
+  g_assert_no_error (local_error);
+  g_assert (S_ISDIR (stbuf.st_mode));
+  if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchfile", &stbuf, 0, error))
+    return;
+  g_assert_cmpint (errno, ==, ENOENT);
+  g_assert_no_error (local_error);
+
+  /* test NULL parameter for stat */
+  if (!glnx_fstatat_allow_noent (AT_FDCWD, ".", NULL, 0, error))
+    return;
+  g_assert_cmpint (errno, ==, 0);
+  g_assert_no_error (local_error);
+  if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchfile", NULL, 0, error))
+    return;
+  g_assert_cmpint (errno, ==, ENOENT);
+  g_assert_no_error (local_error);
+}
+
+static void
+test_filecopy (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+  g_auto(GLnxTmpfile) tmpf = { 0, };
+  const char foo[] = "foo";
+  struct stat stbuf;
+
+  if (!glnx_ensure_dir (AT_FDCWD, "subdir", 0755, error))
+    return;
+
+  if (!glnx_file_replace_contents_at (AT_FDCWD, foo, (guint8*)foo, sizeof (foo),
+                                      GLNX_FILE_REPLACE_NODATASYNC, NULL, error))
+    return;
+
+  /* Copy it into both the same dir and a subdir */
+  if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
+                          GLNX_FILE_COPY_NOXATTRS, NULL, error))
+    return;
+  if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "subdir/bar",
+                          GLNX_FILE_COPY_NOXATTRS, NULL, error))
+    return;
+  if (!glnx_fstatat (AT_FDCWD, "subdir/bar", &stbuf, 0, error))
+    return;
+
+  if (glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
+                         GLNX_FILE_COPY_NOXATTRS, NULL, error))
+    g_assert_not_reached ();
+  g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS);
+  g_clear_error (&local_error);
+
+  if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
+                          GLNX_FILE_COPY_NOXATTRS | GLNX_FILE_COPY_OVERWRITE,
+                          NULL, error))
+    return;
+
+  if (symlinkat ("nosuchtarget", AT_FDCWD, "link") < 0)
+    return (void) glnx_throw_errno_prefix (error, "symlinkat");
+
+  /* Shouldn't be able to overwrite a symlink without GLNX_FILE_COPY_OVERWRITE */
+  if (glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "link",
+                         GLNX_FILE_COPY_NOXATTRS,
+                         NULL, error))
+    g_assert_not_reached ();
+  g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS);
+  g_clear_error (&local_error);
+
+  /* Test overwriting symlink */
+  if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "link",
+                          GLNX_FILE_COPY_NOXATTRS | GLNX_FILE_COPY_OVERWRITE,
+                          NULL, error))
+    return;
+
+  if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchtarget", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+  g_assert_cmpint (errno, ==, ENOENT);
+  g_assert_no_error (local_error);
+
+  if (!glnx_fstatat (AT_FDCWD, "link", &stbuf, AT_SYMLINK_NOFOLLOW, error))
+    return;
+  g_assert (S_ISREG (stbuf.st_mode));
+}
+
+int main (int argc, char **argv)
+{
+  int ret;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/tmpfile", test_tmpfile);
+  g_test_add_func ("/stdio-file", test_stdio_file);
+  g_test_add_func ("/filecopy", test_filecopy);
+  g_test_add_func ("/renameat2-noreplace", test_renameat2_noreplace);
+  g_test_add_func ("/renameat2-exchange", test_renameat2_exchange);
+  g_test_add_func ("/fstat", test_fstatat);
+
+  ret = g_test_run();
+
+  return ret;
+}
diff --git a/libglnx/tests/test-libglnx-macros.c b/libglnx/tests/test-libglnx-macros.c
new file mode 100644 (file)
index 0000000..ffde8fa
--- /dev/null
@@ -0,0 +1,109 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <string.h>
+
+static void
+test_inset (void)
+{
+  g_assert (G_IN_SET (7, 7));
+  g_assert (G_IN_SET (7, 42, 7));
+  g_assert (G_IN_SET (7, 7,42,3,9));
+  g_assert (G_IN_SET (42, 7,42,3,9));
+  g_assert (G_IN_SET (3, 7,42,3,9));
+  g_assert (G_IN_SET (9, 7,42,3,9));
+  g_assert (!G_IN_SET (8, 7,42,3,9));
+  g_assert (!G_IN_SET (-1, 7,42,3,9));
+  g_assert (G_IN_SET ('x', 'a', 'x', 'c'));
+  g_assert (!G_IN_SET ('y', 'a', 'x', 'c'));
+}
+
+static void
+test_hash_table_foreach (void)
+{
+  /* use var names all different from the macro metavars to ensure proper
+   * substitution */
+  g_autoptr(GHashTable) table = g_hash_table_new (g_str_hash, g_str_equal);
+  const char *keys[] = {"key1", "key2"};
+  const char *vals[] = {"val1", "val2"};
+  g_hash_table_insert (table, (gpointer)keys[0], (gpointer)vals[0]);
+  g_hash_table_insert (table, (gpointer)keys[1], (gpointer)vals[1]);
+
+  guint i = 0;
+  GLNX_HASH_TABLE_FOREACH_IT (table, it, const char*, key, const char*, val)
+    {
+      g_assert_cmpstr (key, ==, keys[i]);
+      g_assert_cmpstr (val, ==, vals[i]);
+      i++;
+    }
+  g_assert_cmpuint (i, ==, 2);
+
+  i = 0;
+  GLNX_HASH_TABLE_FOREACH_IT (table, it, const char*, key, const char*, val)
+    {
+      g_hash_table_iter_remove (&it);
+      break;
+    }
+  g_assert_cmpuint (g_hash_table_size (table), ==, 1);
+
+  g_hash_table_insert (table, (gpointer)keys[1], (gpointer)vals[1]);
+  g_assert_cmpuint (g_hash_table_size (table), ==, 1);
+
+  g_hash_table_insert (table, (gpointer)keys[0], (gpointer)vals[0]);
+  g_assert_cmpuint (g_hash_table_size (table), ==, 2);
+
+  i = 0;
+  GLNX_HASH_TABLE_FOREACH_KV (table, const char*, key, const char*, val)
+    {
+      g_assert_cmpstr (key, ==, keys[i]);
+      g_assert_cmpstr (val, ==, vals[i]);
+      i++;
+    }
+  g_assert_cmpuint (i, ==, 2);
+
+  i = 0;
+  GLNX_HASH_TABLE_FOREACH (table, const char*, key)
+    {
+      g_assert_cmpstr (key, ==, keys[i]);
+      i++;
+    }
+  g_assert_cmpuint (i, ==, 2);
+
+  i = 0;
+  GLNX_HASH_TABLE_FOREACH_V (table, const char*, val)
+    {
+      g_assert_cmpstr (val, ==, vals[i]);
+      i++;
+    }
+  g_assert_cmpuint (i, ==, 2);
+}
+
+int main (int argc, char **argv)
+{
+  g_test_init (&argc, &argv, NULL);
+  g_test_add_func ("/inset", test_inset);
+  g_test_add_func ("/hash_table_foreach", test_hash_table_foreach);
+  return g_test_run();
+}
diff --git a/libglnx/tests/test-libglnx-shutil.c b/libglnx/tests/test-libglnx-shutil.c
new file mode 100644 (file)
index 0000000..39f261b
--- /dev/null
@@ -0,0 +1,63 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright © 2017 Endless Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <err.h>
+#include <string.h>
+
+#include "libglnx-testlib.h"
+
+static void
+test_mkdir_p_enoent (void)
+{
+  _GLNX_TEST_DECLARE_ERROR(local_error, error);
+  glnx_fd_close int dfd = -1;
+
+  if (!glnx_ensure_dir (AT_FDCWD, "test", 0755, error))
+    return;
+  if (!glnx_opendirat (AT_FDCWD, "test", FALSE, &dfd, error))
+    return;
+  if (rmdir ("test") < 0)
+    return (void) glnx_throw_errno_prefix (error, "rmdir(%s)", "test");
+
+  /* This should fail with ENOENT. */
+  glnx_shutil_mkdir_p_at (dfd, "blah/baz", 0755, NULL, error);
+  g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+  g_clear_error (&local_error);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  int ret;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/mkdir-p/enoent", test_mkdir_p_enoent);
+
+  ret = g_test_run();
+
+  return ret;
+}
diff --git a/libglnx/tests/test-libglnx-xattrs.c b/libglnx/tests/test-libglnx-xattrs.c
new file mode 100644 (file)
index 0000000..0076b71
--- /dev/null
@@ -0,0 +1,283 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <string.h>
+
+#define XATTR_THREAD_RUN_TIME_USECS (5 * G_USEC_PER_SEC)
+
+struct XattrWorker {
+  int dfd;
+  gboolean is_writer;
+  guint n_attrs_read;
+};
+
+typedef enum {
+  WRITE_RUN_MUTATE,
+  WRITE_RUN_CREATE,
+} WriteType;
+
+static gboolean
+set_random_xattr_value (int fd, const char *name, GError **error)
+{
+  const guint8 randxattrbyte = g_random_int_range (0, 256);
+  const guint32 randxattrvalue_len = (g_random_int () % 256) + 1; /* Picked to be not too small or large */
+  g_autofree char *randxattrvalue = g_malloc (randxattrvalue_len);
+
+  memset (randxattrvalue, randxattrbyte, randxattrvalue_len);
+
+  if (fsetxattr (fd, name, randxattrvalue, randxattrvalue_len, 0) < 0)
+    {
+      glnx_set_error_from_errno (error);
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+add_random_xattrs (int fd, GError **error)
+{
+  const guint nattrs = MIN (2, g_random_int () % 16);
+
+  for (guint i = 0; i < nattrs; i++)
+    {
+      guint32 randxattrname_v = g_random_int ();
+      g_autofree char *randxattrname = g_strdup_printf ("user.test%u", randxattrname_v);
+
+      if (!set_random_xattr_value (fd, randxattrname, error))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+do_write_run (GLnxDirFdIterator *dfd_iter, GError **error)
+{
+  WriteType wtype = g_random_int () % 2;
+
+  if (wtype == WRITE_RUN_CREATE)
+    {
+      guint32 randname_v = g_random_int ();
+      g_autofree char *randname = g_strdup_printf ("file%u", randname_v);
+      glnx_fd_close int fd = -1;
+
+    again:
+      fd = openat (dfd_iter->fd, randname, O_CREAT | O_EXCL, 0644);
+      if (fd < 0)
+        {
+          if (errno == EEXIST)
+            {
+              g_printerr ("Congratulations!  I suggest purchasing a lottery ticket today!\n");
+              goto again;
+            }
+          else
+            {
+              glnx_set_error_from_errno (error);
+              return FALSE;
+            }
+        }
+
+      if (!add_random_xattrs (fd, error))
+        return FALSE;
+      }
+  else if (wtype == WRITE_RUN_MUTATE)
+    {
+      while (TRUE)
+        {
+          struct dirent *dent;
+          if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error))
+            return FALSE;
+          if (!dent)
+            break;
+
+          glnx_fd_close int fd = -1;
+          if (!glnx_openat_rdonly (dfd_iter->fd, dent->d_name, FALSE, &fd, error))
+            return FALSE;
+
+          g_autoptr(GVariant) current_xattrs = NULL;
+          if (!glnx_fd_get_all_xattrs (fd, &current_xattrs, NULL, error))
+            return FALSE;
+
+          for (int i = 0; i < g_variant_n_children (current_xattrs); i++)
+            {
+              const char *name, *value;
+              g_variant_get_child (current_xattrs, i, "(^&ay^&ay)", &name, &value);
+
+              /* We don't want to potentially test/change xattrs like security.selinux
+               * that were injected by the system.
+               */
+              if (!g_str_has_prefix (name, "user.test"))
+                continue;
+
+              if (!set_random_xattr_value (fd, name, error))
+                return FALSE;
+            }
+        }
+    }
+  else
+    g_assert_not_reached ();
+
+  return TRUE;
+}
+
+static gboolean
+do_read_run (GLnxDirFdIterator *dfd_iter,
+             guint *out_n_read,
+             GError **error)
+{
+  guint nattrs = 0;
+  while (TRUE)
+    {
+      struct dirent *dent;
+      if (!glnx_dirfd_iterator_next_dent (dfd_iter, &dent, NULL, error))
+        return FALSE;
+      if (!dent)
+        break;
+
+      glnx_fd_close int fd = -1;
+      if (!glnx_openat_rdonly (dfd_iter->fd, dent->d_name, FALSE, &fd, error))
+        return FALSE;
+
+      g_autoptr(GVariant) current_xattrs = NULL;
+      if (!glnx_fd_get_all_xattrs (fd, &current_xattrs, NULL, error))
+        return FALSE;
+
+      /* We don't actually care about the values, just use the variable
+       * to avoid compiler warnings.
+       */
+      nattrs += g_variant_n_children (current_xattrs);
+    }
+
+  *out_n_read = nattrs;
+  return TRUE;
+}
+
+static gpointer
+xattr_thread (gpointer data)
+{
+  g_autoptr(GError) local_error = NULL;
+  GError **error = &local_error;
+  struct XattrWorker *worker = data;
+  guint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS;
+  guint n_read = 0;
+
+  while (g_get_monotonic_time () < end_time)
+    {
+      g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
+
+      if (!glnx_dirfd_iterator_init_at (worker->dfd, ".", TRUE, &dfd_iter, error))
+        goto out;
+
+      if (worker->is_writer)
+        {
+          if (!do_write_run (&dfd_iter, error))
+            goto out;
+        }
+      else
+        {
+          if (!do_read_run (&dfd_iter, &n_read, error))
+            goto out;
+        }
+    }
+
+ out:
+  g_assert_no_error (local_error);
+
+  return GINT_TO_POINTER (n_read);
+}
+
+static void
+test_xattr_races (void)
+{
+  /* If for some reason we're built in a VM which only has one vcpu, let's still
+   * at least make the test do something.
+   */
+  /* FIXME - this deadlocks for me on 4.9.4-201.fc25.x86_64, whether
+   * using overlayfs or xfs as source/dest.
+   */
+  const guint nprocs = MAX (4, g_get_num_processors ());
+  struct XattrWorker wdata[nprocs];
+  GThread *threads[nprocs];
+  g_autoptr(GError) local_error = NULL;
+  GError **error = &local_error;
+  g_auto(GLnxTmpDir) tmpdir = { 0, };
+  g_autofree char *tmpdir_path = g_strdup_printf ("%s/libglnx-xattrs-XXXXXX",
+                                                  getenv ("TMPDIR") ?: "/var/tmp");
+  guint nread = 0;
+
+  if (!glnx_mkdtempat (AT_FDCWD, tmpdir_path, 0700,
+                       &tmpdir, error))
+    goto out;
+
+  /* Support people building/testing on tmpfs https://github.com/flatpak/flatpak/issues/686 */
+  if (fsetxattr (tmpdir.fd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
+    {
+      if (errno == EOPNOTSUPP)
+        {
+          g_test_skip ("no xattr support");
+          return;
+        }
+      else
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
+    }
+
+  for (guint i = 0; i < nprocs; i++)
+    {
+      struct XattrWorker *worker = &wdata[i];
+      worker->dfd = tmpdir.fd;
+      worker->is_writer = i % 2 == 0;
+      threads[i] = g_thread_new (NULL, xattr_thread, worker);
+    }
+
+  for (guint i = 0; i < nprocs; i++)
+    {
+      if (wdata[i].is_writer)
+        (void) g_thread_join (threads[i]);
+      else
+        nread += GPOINTER_TO_UINT (g_thread_join (threads[i]));
+    }
+
+  g_print ("Read %u xattrs race free!\n", nread);
+
+ out:
+  g_assert_no_error (local_error);
+}
+
+int main (int argc, char **argv)
+{
+  int ret;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/xattr-races", test_xattr_races);
+
+  ret = g_test_run();
+
+  return ret;
+}
diff --git a/ltmain.sh b/ltmain.sh
new file mode 100644 (file)
index 0000000..0f0a2da
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,11147 @@
+#! /bin/sh
+## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
+##               by inline-source v2014-01-03.01
+
+# libtool (GNU libtool) 2.4.6
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4.6
+package_revision=2.4.6
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Run './libtool --help' for help with using this script from the
+# command line.
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# After configure completes, it has a better idea of some of the
+# shell tools we need than the defaults used by the functions shared
+# with bootstrap, so set those here where they can still be over-
+# ridden by the user, but otherwise take precedence.
+
+: ${AUTOCONF="autoconf"}
+: ${AUTOMAKE="automake"}
+
+
+## -------------------------- ##
+## Source external libraries. ##
+## -------------------------- ##
+
+# Much of our low-level functionality needs to be sourced from external
+# libraries, which are installed to $pkgauxdir.
+
+# Set a version string for this script.
+scriptversion=2015-01-20.17; # UTC
+
+# General shell script boiler plate, and helper functions.
+# Written by Gary V. Vaughan, 2004
+
+# Copyright (C) 2004-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# As a special exception to the GNU General Public License, if you distribute
+# this file as part of a program or library that is built using GNU Libtool,
+# you may include this file under the same distribution terms that you use
+# for the rest of that program.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary@gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Evaluate this file near the top of your script to gain access to
+# the functions and variables defined here:
+#
+#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
+#
+# If you need to override any of the default environment variable
+# settings, do that before evaluating this file.
+
+
+## -------------------- ##
+## Shell normalisation. ##
+## -------------------- ##
+
+# Some shells need a little help to be as Bourne compatible as possible.
+# Before doing anything else, make sure all that help has been provided!
+
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
+fi
+
+# NLS nuisances: We save the old values in case they are required later.
+_G_user_locale=
+_G_safe_locale=
+for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test set = \"\${$_G_var+set}\"; then
+          save_$_G_var=\$$_G_var
+          $_G_var=C
+         export $_G_var
+         _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
+         _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
+       fi"
+done
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Make sure IFS has a sensible default
+sp=' '
+nl='
+'
+IFS="$sp       $nl"
+
+# There are apparently some retarded systems that use ';' as a PATH separator!
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+
+## ------------------------- ##
+## Locate command utilities. ##
+## ------------------------- ##
+
+
+# func_executable_p FILE
+# ----------------------
+# Check that FILE is an executable regular file.
+func_executable_p ()
+{
+    test -f "$1" && test -x "$1"
+}
+
+
+# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
+# --------------------------------------------
+# Search for either a program that responds to --version with output
+# containing "GNU", or else returned by CHECK_FUNC otherwise, by
+# trying all the directories in PATH with each of the elements of
+# PROGS_LIST.
+#
+# CHECK_FUNC should accept the path to a candidate program, and
+# set $func_check_prog_result if it truncates its output less than
+# $_G_path_prog_max characters.
+func_path_progs ()
+{
+    _G_progs_list=$1
+    _G_check_func=$2
+    _G_PATH=${3-"$PATH"}
+
+    _G_path_prog_max=0
+    _G_path_prog_found=false
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
+    for _G_dir in $_G_PATH; do
+      IFS=$_G_save_IFS
+      test -z "$_G_dir" && _G_dir=.
+      for _G_prog_name in $_G_progs_list; do
+        for _exeext in '' .EXE; do
+          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
+          func_executable_p "$_G_path_prog" || continue
+          case `"$_G_path_prog" --version 2>&1` in
+            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
+            *)     $_G_check_func $_G_path_prog
+                  func_path_progs_result=$func_check_prog_result
+                  ;;
+          esac
+          $_G_path_prog_found && break 3
+        done
+      done
+    done
+    IFS=$_G_save_IFS
+    test -z "$func_path_progs_result" && {
+      echo "no acceptable sed could be found in \$PATH" >&2
+      exit 1
+    }
+}
+
+
+# We want to be able to use the functions in this file before configure
+# has figured out where the best binaries are kept, which means we have
+# to search for them ourselves - except when the results are already set
+# where we skip the searches.
+
+# Unless the user overrides by setting SED, search the path for either GNU
+# sed, or the sed that truncates its output the least.
+test -z "$SED" && {
+  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+  for _G_i in 1 2 3 4 5 6 7; do
+    _G_sed_script=$_G_sed_script$nl$_G_sed_script
+  done
+  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
+  _G_sed_script=
+
+  func_check_prog_sed ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo '' >> conftest.nl
+      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
+  rm -f conftest.sed
+  SED=$func_path_progs_result
+}
+
+
+# Unless the user overrides by setting GREP, search the path for either GNU
+# grep, or the grep that truncates its output the least.
+test -z "$GREP" && {
+  func_check_prog_grep ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    _G_path_prog_max=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo 'GREP' >> conftest.nl
+      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
+  GREP=$func_path_progs_result
+}
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# All uppercase variable names are used for environment variables.  These
+# variables can be overridden by the user before calling a script that
+# uses them if a suitable command of that name is not already available
+# in the command search PATH.
+
+: ${CP="cp -f"}
+: ${ECHO="printf %s\n"}
+: ${EGREP="$GREP -E"}
+: ${FGREP="$GREP -F"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+
+
+## -------------------- ##
+## Useful sed snippets. ##
+## -------------------- ##
+
+sed_dirname='s|/[^/]*$||'
+sed_basename='s|^.*/||'
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
+
+# Same as above, but do not quote variable references.
+sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
+
+# Sed substitution that converts a w32 file name or path
+# that contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-'\' parameter expansions in output of sed_double_quote_subst that
+# were '\'-ed in input to the same.  If an odd number of '\' preceded a
+# '$' in input to sed_double_quote_subst, that '$' was protected from
+# expansion.  Since each input '\' is now two '\'s, look for any number
+# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
+_G_bs='\\'
+_G_bs2='\\\\'
+_G_bs4='\\\\\\\\'
+_G_dollar='\$'
+sed_double_backslash="\
+  s/$_G_bs4/&\\
+/g
+  s/^$_G_bs2$_G_dollar/$_G_bs&/
+  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
+  s/\n//g"
+
+
+## ----------------- ##
+## Global variables. ##
+## ----------------- ##
+
+# Except for the global variables explicitly listed below, the following
+# functions in the '^func_' namespace, and the '^require_' namespace
+# variables initialised in the 'Resource management' section, sourcing
+# this file will not pollute your global namespace with anything
+# else. There's no portable way to scope variables in Bourne shell
+# though, so actually running these functions will sometimes place
+# results into a variable named after the function, and often use
+# temporary variables in the '^_G_' namespace. If you are careful to
+# avoid using those namespaces casually in your sourcing script, things
+# should continue to work as you expect. And, of course, you can freely
+# overwrite any of the functions or variables defined here before
+# calling anything to customize them.
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
+
+# Allow overriding, eg assuming that you follow the convention of
+# putting '$debug_cmd' at the start of all your functions, you can get
+# bash to show function call trace with:
+#
+#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
+debug_cmd=${debug_cmd-":"}
+exit_cmd=:
+
+# By convention, finish your script with:
+#
+#    exit $exit_status
+#
+# so that you can set exit_status to non-zero if you want to indicate
+# something went wrong during execution without actually bailing out at
+# the point of failure.
+exit_status=$EXIT_SUCCESS
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath=$0
+
+# The name of this program.
+progname=`$ECHO "$progpath" |$SED "$sed_basename"`
+
+# Make sure we have an absolute progpath for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
+     progdir=`cd "$progdir" && pwd`
+     progpath=$progdir/$progname
+     ;;
+  *)
+     _G_IFS=$IFS
+     IFS=${PATH_SEPARATOR-:}
+     for progdir in $PATH; do
+       IFS=$_G_IFS
+       test -x "$progdir/$progname" && break
+     done
+     IFS=$_G_IFS
+     test -n "$progdir" || progdir=`pwd`
+     progpath=$progdir/$progname
+     ;;
+esac
+
+
+## ----------------- ##
+## Standard options. ##
+## ----------------- ##
+
+# The following options affect the operation of the functions defined
+# below, and should be set appropriately depending on run-time para-
+# meters passed on the command line.
+
+opt_dry_run=false
+opt_quiet=false
+opt_verbose=false
+
+# Categories 'all' and 'none' are always available.  Append any others
+# you will pass as the first argument to func_warning from your own
+# code.
+warning_categories=
+
+# By default, display warnings according to 'opt_warning_types'.  Set
+# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
+# treat the next displayed warning as a fatal error.
+warning_func=func_warn_and_continue
+
+# Set to 'all' to display all warnings, 'none' to suppress all
+# warnings, or a space delimited list of some subset of
+# 'warning_categories' to display only the listed warnings.
+opt_warning_types=all
+
+
+## -------------------- ##
+## Resource management. ##
+## -------------------- ##
+
+# This section contains definitions for functions that each ensure a
+# particular resource (a file, or a non-empty configuration variable for
+# example) is available, and if appropriate to extract default values
+# from pertinent package files. Call them using their associated
+# 'require_*' variable to ensure that they are executed, at most, once.
+#
+# It's entirely deliberate that calling these functions can set
+# variables that don't obey the namespace limitations obeyed by the rest
+# of this file, in order that that they be as useful as possible to
+# callers.
+
+
+# require_term_colors
+# -------------------
+# Allow display of bold text on terminals that support it.
+require_term_colors=func_require_term_colors
+func_require_term_colors ()
+{
+    $debug_cmd
+
+    test -t 1 && {
+      # COLORTERM and USE_ANSI_COLORS environment variables take
+      # precedence, because most terminfo databases neglect to describe
+      # whether color sequences are supported.
+      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
+
+      if test 1 = "$USE_ANSI_COLORS"; then
+        # Standard ANSI escape sequences
+        tc_reset='\e[0m'
+        tc_bold='\e[1m';   tc_standout='\e[7m'
+        tc_red='\e[31m';   tc_green='\e[32m'
+        tc_blue='\e[34m';  tc_cyan='\e[36m'
+      else
+        # Otherwise trust the terminfo database after all.
+        test -n "`tput sgr0 2>/dev/null`" && {
+          tc_reset=`tput sgr0`
+          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
+          tc_standout=$tc_bold
+          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
+          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
+          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
+          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
+          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
+        }
+      fi
+    }
+
+    require_term_colors=:
+}
+
+
+## ----------------- ##
+## Function library. ##
+## ----------------- ##
+
+# This section contains a variety of useful functions to call in your
+# scripts. Take note of the portable wrappers for features provided by
+# some modern shells, which will fall back to slower equivalents on
+# less featureful shells.
+
+
+# func_append VAR VALUE
+# ---------------------
+# Append VALUE onto the existing contents of VAR.
+
+  # We should try to minimise forks, especially on Windows where they are
+  # unreasonably slow, so skip the feature probes when bash or zsh are
+  # being used:
+  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
+    : ${_G_HAVE_ARITH_OP="yes"}
+    : ${_G_HAVE_XSI_OPS="yes"}
+    # The += operator was introduced in bash 3.1
+    case $BASH_VERSION in
+      [12].* | 3.0 | 3.0*) ;;
+      *)
+        : ${_G_HAVE_PLUSEQ_OP="yes"}
+        ;;
+    esac
+  fi
+
+  # _G_HAVE_PLUSEQ_OP
+  # Can be empty, in which case the shell is probed, "yes" if += is
+  # useable or anything else if it does not work.
+  test -z "$_G_HAVE_PLUSEQ_OP" \
+    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
+    && _G_HAVE_PLUSEQ_OP=yes
+
+if test yes = "$_G_HAVE_PLUSEQ_OP"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_append ()
+  {
+    $debug_cmd
+
+    eval "$1+=\$2"
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_append ()
+  {
+    $debug_cmd
+
+    eval "$1=\$$1\$2"
+  }
+fi
+
+
+# func_append_quoted VAR VALUE
+# ----------------------------
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+if test yes = "$_G_HAVE_PLUSEQ_OP"; then
+  eval 'func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1+=\\ \$func_quote_for_eval_result"
+  }'
+else
+  func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1=\$$1\\ \$func_quote_for_eval_result"
+  }
+fi
+
+
+# func_append_uniq VAR VALUE
+# --------------------------
+# Append unique VALUE onto the existing contents of VAR, assuming
+# entries are delimited by the first character of VALUE.  For example:
+#
+#   func_append_uniq options " --another-option option-argument"
+#
+# will only append to $options if " --another-option option-argument "
+# is not already present somewhere in $options already (note spaces at
+# each end implied by leading space in second argument).
+func_append_uniq ()
+{
+    $debug_cmd
+
+    eval _G_current_value='`$ECHO $'$1'`'
+    _G_delim=`expr "$2" : '\(.\)'`
+
+    case $_G_delim$_G_current_value$_G_delim in
+      *"$2$_G_delim"*) ;;
+      *) func_append "$@" ;;
+    esac
+}
+
+
+# func_arith TERM...
+# ------------------
+# Set func_arith_result to the result of evaluating TERMs.
+  test -z "$_G_HAVE_ARITH_OP" \
+    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
+    && _G_HAVE_ARITH_OP=yes
+
+if test yes = "$_G_HAVE_ARITH_OP"; then
+  eval 'func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=$(( $* ))
+  }'
+else
+  func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=`expr "$@"`
+  }
+fi
+
+
+# func_basename FILE
+# ------------------
+# Set func_basename_result to FILE with everything up to and including
+# the last / stripped.
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  # If this shell supports suffix pattern removal, then use it to avoid
+  # forking. Hide the definitions single quotes in case the shell chokes
+  # on unsupported syntax...
+  _b='func_basename_result=${1##*/}'
+  _d='case $1 in
+        */*) func_dirname_result=${1%/*}$2 ;;
+        *  ) func_dirname_result=$3        ;;
+      esac'
+
+else
+  # ...otherwise fall back to using sed.
+  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
+  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
+      if test "X$func_dirname_result" = "X$1"; then
+        func_dirname_result=$3
+      else
+        func_append func_dirname_result "$2"
+      fi'
+fi
+
+eval 'func_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+}'
+
+
+# func_dirname FILE APPEND NONDIR_REPLACEMENT
+# -------------------------------------------
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+eval 'func_dirname ()
+{
+    $debug_cmd
+
+    '"$_d"'
+}'
+
+
+# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
+# --------------------------------------------------------
+# Perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# For efficiency, we do not delegate to the functions above but instead
+# duplicate the functionality here.
+eval 'func_dirname_and_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+    '"$_d"'
+}'
+
+
+# func_echo ARG...
+# ----------------
+# Echo program name prefixed message.
+func_echo ()
+{
+    $debug_cmd
+
+    _G_message=$*
+
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
+
+
+# func_echo_all ARG...
+# --------------------
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+
+# func_echo_infix_1 INFIX ARG...
+# ------------------------------
+# Echo program name, followed by INFIX on the first line, with any
+# additional lines not showing INFIX.
+func_echo_infix_1 ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    _G_infix=$1; shift
+    _G_indent=$_G_infix
+    _G_prefix="$progname: $_G_infix: "
+    _G_message=$*
+
+    # Strip color escape sequences before counting printable length
+    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
+    do
+      test -n "$_G_tc" && {
+        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
+      }
+    done
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+
+    func_echo_infix_1_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_infix_1_IFS
+      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
+      _G_prefix=$_G_indent
+    done
+    IFS=$func_echo_infix_1_IFS
+}
+
+
+# func_error ARG...
+# -----------------
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
+}
+
+
+# func_fatal_error ARG...
+# -----------------------
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    $debug_cmd
+
+    func_error "$*"
+    exit $EXIT_FAILURE
+}
+
+
+# func_grep EXPRESSION FILENAME
+# -----------------------------
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $debug_cmd
+
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_len STRING
+# ---------------
+# Set func_len_result to the length of STRING. STRING may not
+# start with a hyphen.
+  test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=${#1}
+  }'
+else
+  func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+  }
+fi
+
+
+# func_mkdir_p DIRECTORY-PATH
+# ---------------------------
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    $debug_cmd
+
+    _G_directory_path=$1
+    _G_dir_list=
+
+    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
+
+      # Protect directory names starting with '-'
+      case $_G_directory_path in
+        -*) _G_directory_path=./$_G_directory_path ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$_G_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+       # list incase some portion of path contains whitespace.
+        _G_dir_list=$_G_directory_path:$_G_dir_list
+
+        # If the last portion added has no slash in it, the list is done
+        case $_G_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
+      done
+      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
+
+      func_mkdir_p_IFS=$IFS; IFS=:
+      for _G_dir in $_G_dir_list; do
+       IFS=$func_mkdir_p_IFS
+        # mkdir can fail with a 'File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$_G_dir" 2>/dev/null || :
+      done
+      IFS=$func_mkdir_p_IFS
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$_G_directory_path" || \
+        func_fatal_error "Failed to create '$1'"
+    fi
+}
+
+
+# func_mktempdir [BASENAME]
+# -------------------------
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, BASENAME is the basename for that directory.
+func_mktempdir ()
+{
+    $debug_cmd
+
+    _G_template=${TMPDIR-/tmp}/${1-$progname}
+
+    if test : = "$opt_dry_run"; then
+      # Return a directory name, but don't create it in dry-run mode
+      _G_tmpdir=$_G_template-$$
+    else
+
+      # If mktemp works, use that first and foremost
+      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$_G_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        _G_tmpdir=$_G_template-${RANDOM-0}$$
+
+        func_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$_G_tmpdir"
+        umask $func_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$_G_tmpdir" || \
+        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
+    fi
+
+    $ECHO "$_G_tmpdir"
+}
+
+
+# func_normal_abspath PATH
+# ------------------------
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+func_normal_abspath ()
+{
+    $debug_cmd
+
+    # These SED scripts presuppose an absolute path with a trailing slash.
+    _G_pathcar='s|^/\([^/]*\).*$|\1|'
+    _G_pathcdr='s|^/[^/]*||'
+    _G_removedotparts=':dotsl
+               s|/\./|/|g
+               t dotsl
+               s|/\.$|/|'
+    _G_collapseslashes='s|/\{1,\}|/|g'
+    _G_finalslash='s|/*$|/|'
+
+    # Start from root dir and reassemble the path.
+    func_normal_abspath_result=
+    func_normal_abspath_tpath=$1
+    func_normal_abspath_altnamespace=
+    case $func_normal_abspath_tpath in
+      "")
+        # Empty path, that just means $cwd.
+        func_stripname '' '/' "`pwd`"
+        func_normal_abspath_result=$func_stripname_result
+        return
+        ;;
+      # The next three entries are used to spot a run of precisely
+      # two leading slashes without using negated character classes;
+      # we take advantage of case's first-match behaviour.
+      ///*)
+        # Unusual form of absolute path, do nothing.
+        ;;
+      //*)
+        # Not necessarily an ordinary path; POSIX reserves leading '//'
+        # and for example Cygwin uses it to access remote file shares
+        # over CIFS/SMB, so we conserve a leading double slash if found.
+        func_normal_abspath_altnamespace=/
+        ;;
+      /*)
+        # Absolute path, do nothing.
+        ;;
+      *)
+        # Relative path, prepend $cwd.
+        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+        ;;
+    esac
+
+    # Cancel out all the simple stuff to save iterations.  We also want
+    # the path to end with a slash for ease of parsing, so make sure
+    # there is one (and only one) here.
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
+    while :; do
+      # Processed it all yet?
+      if test / = "$func_normal_abspath_tpath"; then
+        # If we ascended to the root using ".." the result may be empty now.
+        if test -z "$func_normal_abspath_result"; then
+          func_normal_abspath_result=/
+        fi
+        break
+      fi
+      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcar"`
+      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcdr"`
+      # Figure out what to do with it
+      case $func_normal_abspath_tcomponent in
+        "")
+          # Trailing empty path component, ignore it.
+          ;;
+        ..)
+          # Parent dir; strip last assembled component from result.
+          func_dirname "$func_normal_abspath_result"
+          func_normal_abspath_result=$func_dirname_result
+          ;;
+        *)
+          # Actual path component, append it.
+          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
+          ;;
+      esac
+    done
+    # Restore leading double-slash if one was found on entry.
+    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+
+# func_notquiet ARG...
+# --------------------
+# Echo program name prefixed message only when not in quiet mode.
+func_notquiet ()
+{
+    $debug_cmd
+
+    $opt_quiet || func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+
+# func_relative_path SRCDIR DSTDIR
+# --------------------------------
+# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
+func_relative_path ()
+{
+    $debug_cmd
+
+    func_relative_path_result=
+    func_normal_abspath "$1"
+    func_relative_path_tlibdir=$func_normal_abspath_result
+    func_normal_abspath "$2"
+    func_relative_path_tbindir=$func_normal_abspath_result
+
+    # Ascend the tree starting from libdir
+    while :; do
+      # check if we have found a prefix of bindir
+      case $func_relative_path_tbindir in
+        $func_relative_path_tlibdir)
+          # found an exact match
+          func_relative_path_tcancelled=
+          break
+          ;;
+        $func_relative_path_tlibdir*)
+          # found a matching prefix
+          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+          func_relative_path_tcancelled=$func_stripname_result
+          if test -z "$func_relative_path_result"; then
+            func_relative_path_result=.
+          fi
+          break
+          ;;
+        *)
+          func_dirname $func_relative_path_tlibdir
+          func_relative_path_tlibdir=$func_dirname_result
+          if test -z "$func_relative_path_tlibdir"; then
+            # Have to descend all the way to the root!
+            func_relative_path_result=../$func_relative_path_result
+            func_relative_path_tcancelled=$func_relative_path_tbindir
+            break
+          fi
+          func_relative_path_result=../$func_relative_path_result
+          ;;
+      esac
+    done
+
+    # Now calculate path; take care to avoid doubling-up slashes.
+    func_stripname '' '/' "$func_relative_path_result"
+    func_relative_path_result=$func_stripname_result
+    func_stripname '/' '/' "$func_relative_path_tcancelled"
+    if test -n "$func_stripname_result"; then
+      func_append func_relative_path_result "/$func_stripname_result"
+    fi
+
+    # Normalisation. If bindir is libdir, return '.' else relative path.
+    if test -n "$func_relative_path_result"; then
+      func_stripname './' '' "$func_relative_path_result"
+      func_relative_path_result=$func_stripname_result
+    fi
+
+    test -n "$func_relative_path_result" || func_relative_path_result=.
+
+    :
+}
+
+
+# func_quote_for_eval ARG...
+# --------------------------
+# Aesthetically quote ARGs to be evaled later.
+# This function returns two values:
+#   i) func_quote_for_eval_result
+#      double-quoted, suitable for a subsequent eval
+#  ii) func_quote_for_eval_unquoted_result
+#      has all characters that are still active within double
+#      quotes backslashified.
+func_quote_for_eval ()
+{
+    $debug_cmd
+
+    func_quote_for_eval_unquoted_result=
+    func_quote_for_eval_result=
+    while test 0 -lt $#; do
+      case $1 in
+        *[\\\`\"\$]*)
+         _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
+        *)
+          _G_unquoted_arg=$1 ;;
+      esac
+      if test -n "$func_quote_for_eval_unquoted_result"; then
+       func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
+      else
+        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
+      fi
+
+      case $_G_unquoted_arg in
+        # Double-quote args containing shell metacharacters to delay
+        # word splitting, command substitution and variable expansion
+        # for a subsequent eval.
+        # Many Bourne shells cannot handle close brackets correctly
+        # in scan sets, so we specify it separately.
+        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \  ]*|*]*|"")
+          _G_quoted_arg=\"$_G_unquoted_arg\"
+          ;;
+        *)
+          _G_quoted_arg=$_G_unquoted_arg
+         ;;
+      esac
+
+      if test -n "$func_quote_for_eval_result"; then
+       func_append func_quote_for_eval_result " $_G_quoted_arg"
+      else
+        func_append func_quote_for_eval_result "$_G_quoted_arg"
+      fi
+      shift
+    done
+}
+
+
+# func_quote_for_expand ARG
+# -------------------------
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    $debug_cmd
+
+    case $1 in
+      *[\\\`\"]*)
+       _G_arg=`$ECHO "$1" | $SED \
+           -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        _G_arg=$1 ;;
+    esac
+
+    case $_G_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        _G_arg=\"$_G_arg\"
+        ;;
+    esac
+
+    func_quote_for_expand_result=$_G_arg
+}
+
+
+# func_stripname PREFIX SUFFIX NAME
+# ---------------------------------
+# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_stripname ()
+  {
+    $debug_cmd
+
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary variable first.
+    func_stripname_result=$3
+    func_stripname_result=${func_stripname_result#"$1"}
+    func_stripname_result=${func_stripname_result%"$2"}
+  }'
+else
+  func_stripname ()
+  {
+    $debug_cmd
+
+    case $2 in
+      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
+      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
+    esac
+  }
+fi
+
+
+# func_show_eval CMD [FAIL_EXP]
+# -----------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    func_quote_for_expand "$_G_cmd"
+    eval "func_notquiet $func_quote_for_expand_result"
+
+    $opt_dry_run || {
+      eval "$_G_cmd"
+      _G_status=$?
+      if test 0 -ne "$_G_status"; then
+       eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_show_eval_locale CMD [FAIL_EXP]
+# ------------------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    $opt_quiet || {
+      func_quote_for_expand "$_G_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    $opt_dry_run || {
+      eval "$_G_user_locale
+           $_G_cmd"
+      _G_status=$?
+      eval "$_G_safe_locale"
+      if test 0 -ne "$_G_status"; then
+       eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_tr_sh
+# ----------
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+    $debug_cmd
+
+    case $1 in
+    [0-9]* | *[!a-zA-Z0-9_]*)
+      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
+      ;;
+    * )
+      func_tr_sh_result=$1
+      ;;
+    esac
+}
+
+
+# func_verbose ARG...
+# -------------------
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $debug_cmd
+
+    $opt_verbose && func_echo "$*"
+
+    :
+}
+
+
+# func_warn_and_continue ARG...
+# -----------------------------
+# Echo program name prefixed warning message to standard error.
+func_warn_and_continue ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
+}
+
+
+# func_warning CATEGORY ARG...
+# ----------------------------
+# Echo program name prefixed warning message to standard error. Warning
+# messages can be filtered according to CATEGORY, where this function
+# elides messages where CATEGORY is not listed in the global variable
+# 'opt_warning_types'.
+func_warning ()
+{
+    $debug_cmd
+
+    # CATEGORY must be in the warning_categories list!
+    case " $warning_categories " in
+      *" $1 "*) ;;
+      *) func_internal_error "invalid warning category '$1'" ;;
+    esac
+
+    _G_category=$1
+    shift
+
+    case " $opt_warning_types " in
+      *" $_G_category "*) $warning_func ${1+"$@"} ;;
+    esac
+}
+
+
+# func_sort_ver VER1 VER2
+# -----------------------
+# 'sort -V' is not generally available.
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+func_sort_ver ()
+{
+    $debug_cmd
+
+    printf '%s\n%s\n' "$1" "$2" \
+      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
+}
+
+# func_lt_ver PREV CURR
+# ---------------------
+# Return true if PREV and CURR are in the correct order according to
+# func_sort_ver, otherwise false.  Use it like this:
+#
+#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
+func_lt_ver ()
+{
+    $debug_cmd
+
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
+}
+
+
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
+#! /bin/sh
+
+# Set a version string for this script.
+scriptversion=2014-01-07.03; # UTC
+
+# A portable, pluggable option parser for Bourne shell.
+# Written by Gary V. Vaughan, 2010
+
+# Copyright (C) 2010-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary@gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# This file is a library for parsing options in your shell scripts along
+# with assorted other useful supporting features that you can make use
+# of too.
+#
+# For the simplest scripts you might need only:
+#
+#   #!/bin/sh
+#   . relative/path/to/funclib.sh
+#   . relative/path/to/options-parser
+#   scriptversion=1.0
+#   func_options ${1+"$@"}
+#   eval set dummy "$func_options_result"; shift
+#   ...rest of your script...
+#
+# In order for the '--version' option to work, you will need to have a
+# suitably formatted comment like the one at the top of this file
+# starting with '# Written by ' and ending with '# warranty; '.
+#
+# For '-h' and '--help' to work, you will also need a one line
+# description of your script's purpose in a comment directly above the
+# '# Written by ' line, like the one at the top of this file.
+#
+# The default options also support '--debug', which will turn on shell
+# execution tracing (see the comment above debug_cmd below for another
+# use), and '--verbose' and the func_verbose function to allow your script
+# to display verbose messages only when your user has specified
+# '--verbose'.
+#
+# After sourcing this file, you can plug processing for additional
+# options by amending the variables from the 'Configuration' section
+# below, and following the instructions in the 'Option parsing'
+# section further down.
+
+## -------------- ##
+## Configuration. ##
+## -------------- ##
+
+# You should override these variables in your script after sourcing this
+# file so that they reflect the customisations you have added to the
+# option parser.
+
+# The usage line for option parsing errors and the start of '-h' and
+# '--help' output messages. You can embed shell variables for delayed
+# expansion at the time the message is displayed, but you will need to
+# quote other shell meta-characters carefully to prevent them being
+# expanded when the contents are evaled.
+usage='$progpath [OPTION]...'
+
+# Short help message in response to '-h' and '--help'.  Add to this or
+# override it after sourcing this library to reflect the full set of
+# options your script accepts.
+usage_message="\
+       --debug        enable verbose shell tracing
+   -W, --warnings=CATEGORY
+                      report the warnings falling in CATEGORY [all]
+   -v, --verbose      verbosely report processing
+       --version      print version information and exit
+   -h, --help         print short or long help message and exit
+"
+
+# Additional text appended to 'usage_message' in response to '--help'.
+long_help_message="
+Warning categories include:
+       'all'          show all warnings
+       'none'         turn off all the warnings
+       'error'        warnings are treated as fatal errors"
+
+# Help message printed before fatal option parsing errors.
+fatal_help="Try '\$progname --help' for more information."
+
+
+
+## ------------------------- ##
+## Hook function management. ##
+## ------------------------- ##
+
+# This section contains functions for adding, removing, and running hooks
+# to the main code.  A hook is just a named list of of function, that can
+# be run in order later on.
+
+# func_hookable FUNC_NAME
+# -----------------------
+# Declare that FUNC_NAME will run hooks added with
+# 'func_add_hook FUNC_NAME ...'.
+func_hookable ()
+{
+    $debug_cmd
+
+    func_append hookable_fns " $1"
+}
+
+
+# func_add_hook FUNC_NAME HOOK_FUNC
+# ---------------------------------
+# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
+# first have been declared "hookable" by a call to 'func_hookable'.
+func_add_hook ()
+{
+    $debug_cmd
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not accept hook functions." ;;
+    esac
+
+    eval func_append ${1}_hooks '" $2"'
+}
+
+
+# func_remove_hook FUNC_NAME HOOK_FUNC
+# ------------------------------------
+# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
+func_remove_hook ()
+{
+    $debug_cmd
+
+    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
+}
+
+
+# func_run_hooks FUNC_NAME [ARG]...
+# ---------------------------------
+# Run all hook functions registered to FUNC_NAME.
+# It is assumed that the list of hook functions contains nothing more
+# than a whitespace-delimited list of legal shell function names, and
+# no effort is wasted trying to catch shell meta-characters or preserve
+# whitespace.
+func_run_hooks ()
+{
+    $debug_cmd
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
+    esac
+
+    eval _G_hook_fns=\$$1_hooks; shift
+
+    for _G_hook in $_G_hook_fns; do
+      eval $_G_hook '"$@"'
+
+      # store returned options list back into positional
+      # parameters for next 'cmd' execution.
+      eval _G_hook_result=\$${_G_hook}_result
+      eval set dummy "$_G_hook_result"; shift
+    done
+
+    func_quote_for_eval ${1+"$@"}
+    func_run_hooks_result=$func_quote_for_eval_result
+}
+
+
+
+## --------------- ##
+## Option parsing. ##
+## --------------- ##
+
+# In order to add your own option parsing hooks, you must accept the
+# full positional parameter list in your hook function, remove any
+# options that you action, and then pass back the remaining unprocessed
+# options in '<hooked_function_name>_result', escaped suitably for
+# 'eval'.  Like this:
+#
+#    my_options_prep ()
+#    {
+#        $debug_cmd
+#
+#        # Extend the existing usage message.
+#        usage_message=$usage_message'
+#      -s, --silent       don'\''t print informational messages
+#    '
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_options_prep_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_options_prep my_options_prep
+#
+#
+#    my_silent_option ()
+#    {
+#        $debug_cmd
+#
+#        # Note that for efficiency, we parse as many options as we can
+#        # recognise in a loop before passing the remainder back to the
+#        # caller on the first unrecognised argument we encounter.
+#        while test $# -gt 0; do
+#          opt=$1; shift
+#          case $opt in
+#            --silent|-s) opt_silent=: ;;
+#            # Separate non-argument short options:
+#            -s*)         func_split_short_opt "$_G_opt"
+#                         set dummy "$func_split_short_opt_name" \
+#                             "-$func_split_short_opt_arg" ${1+"$@"}
+#                         shift
+#                         ;;
+#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
+#          esac
+#        done
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_silent_option_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_parse_options my_silent_option
+#
+#
+#    my_option_validation ()
+#    {
+#        $debug_cmd
+#
+#        $opt_silent && $opt_verbose && func_fatal_help "\
+#    '--silent' and '--verbose' options are mutually exclusive."
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_option_validation_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_validate_options my_option_validation
+#
+# You'll alse need to manually amend $usage_message to reflect the extra
+# options you parse.  It's preferable to append if you can, so that
+# multiple option parsing hooks can be added safely.
+
+
+# func_options [ARG]...
+# ---------------------
+# All the functions called inside func_options are hookable. See the
+# individual implementations for details.
+func_hookable func_options
+func_options ()
+{
+    $debug_cmd
+
+    func_options_prep ${1+"$@"}
+    eval func_parse_options \
+        ${func_options_prep_result+"$func_options_prep_result"}
+    eval func_validate_options \
+        ${func_parse_options_result+"$func_parse_options_result"}
+
+    eval func_run_hooks func_options \
+        ${func_validate_options_result+"$func_validate_options_result"}
+
+    # save modified positional parameters for caller
+    func_options_result=$func_run_hooks_result
+}
+
+
+# func_options_prep [ARG]...
+# --------------------------
+# All initialisations required before starting the option parse loop.
+# Note that when calling hook functions, we pass through the list of
+# positional parameters.  If a hook function modifies that list, and
+# needs to propogate that back to rest of this script, then the complete
+# modified list must be put in 'func_run_hooks_result' before
+# returning.
+func_hookable func_options_prep
+func_options_prep ()
+{
+    $debug_cmd
+
+    # Option defaults:
+    opt_verbose=false
+    opt_warning_types=
+
+    func_run_hooks func_options_prep ${1+"$@"}
+
+    # save modified positional parameters for caller
+    func_options_prep_result=$func_run_hooks_result
+}
+
+
+# func_parse_options [ARG]...
+# ---------------------------
+# The main option parsing loop.
+func_hookable func_parse_options
+func_parse_options ()
+{
+    $debug_cmd
+
+    func_parse_options_result=
+
+    # this just eases exit handling
+    while test $# -gt 0; do
+      # Defer to hook functions for initial option parsing, so they
+      # get priority in the event of reusing an option name.
+      func_run_hooks func_parse_options ${1+"$@"}
+
+      # Adjust func_parse_options positional parameters to match
+      eval set dummy "$func_run_hooks_result"; shift
+
+      # Break out of the loop if we already parsed every option.
+      test $# -gt 0 || break
+
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --debug|-x)   debug_cmd='set -x'
+                      func_echo "enabling shell trace mode"
+                      $debug_cmd
+                      ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                      set dummy --warnings none ${1+"$@"}
+                      shift
+                     ;;
+
+        --warnings|--warning|-W)
+                      test $# = 0 && func_missing_arg $_G_opt && break
+                      case " $warning_categories $1" in
+                        *" $1 "*)
+                          # trailing space prevents matching last $1 above
+                          func_append_uniq opt_warning_types " $1"
+                          ;;
+                        *all)
+                          opt_warning_types=$warning_categories
+                          ;;
+                        *none)
+                          opt_warning_types=none
+                          warning_func=:
+                          ;;
+                        *error)
+                          opt_warning_types=$warning_categories
+                          warning_func=func_fatal_error
+                          ;;
+                        *)
+                          func_fatal_error \
+                             "unsupported warning category: '$1'"
+                          ;;
+                      esac
+                      shift
+                      ;;
+
+        --verbose|-v) opt_verbose=: ;;
+        --version)    func_version ;;
+        -\?|-h)       func_usage ;;
+        --help)       func_help ;;
+
+       # Separate optargs to long options (plugins may need this):
+       --*=*)        func_split_equals "$_G_opt"
+                     set dummy "$func_split_equals_lhs" \
+                          "$func_split_equals_rhs" ${1+"$@"}
+                      shift
+                      ;;
+
+       # Separate optargs to short options:
+        -W*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        # Separate non-argument short options:
+        -\?*|-h*|-v*|-x*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "-$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        --)           break ;;
+        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
+        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
+      esac
+    done
+
+    # save modified positional parameters for caller
+    func_quote_for_eval ${1+"$@"}
+    func_parse_options_result=$func_quote_for_eval_result
+}
+
+
+# func_validate_options [ARG]...
+# ------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+func_hookable func_validate_options
+func_validate_options ()
+{
+    $debug_cmd
+
+    # Display all warnings if -W was not given.
+    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
+
+    func_run_hooks func_validate_options ${1+"$@"}
+
+    # Bail if the options were screwed!
+    $exit_cmd $EXIT_FAILURE
+
+    # save modified positional parameters for caller
+    func_validate_options_result=$func_run_hooks_result
+}
+
+
+
+## ----------------- ##
+## Helper functions. ##
+## ----------------- ##
+
+# This section contains the helper functions used by the rest of the
+# hookable option parser framework in ascii-betical order.
+
+
+# func_fatal_help ARG...
+# ----------------------
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    $debug_cmd
+
+    eval \$ECHO \""Usage: $usage"\"
+    eval \$ECHO \""$fatal_help"\"
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+
+# func_help
+# ---------
+# Echo long help message to standard output and exit.
+func_help ()
+{
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message"
+    exit 0
+}
+
+
+# func_missing_arg ARGNAME
+# ------------------------
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    $debug_cmd
+
+    func_error "Missing argument for '$1'."
+    exit_cmd=exit
+}
+
+
+# func_split_equals STRING
+# ------------------------
+# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
+# splitting STRING at the '=' sign.
+test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=${1%%=*}
+      func_split_equals_rhs=${1#*=}
+      test "x$func_split_equals_lhs" = "x$1" \
+        && func_split_equals_rhs=
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
+      func_split_equals_rhs=
+      test "x$func_split_equals_lhs" = "x$1" \
+        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
+  }
+fi #func_split_equals
+
+
+# func_split_short_opt SHORTOPT
+# -----------------------------
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_arg=${1#??}
+      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
+      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
+  }
+fi #func_split_short_opt
+
+
+# func_usage
+# ----------
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
+    exit 0
+}
+
+
+# func_usage_message
+# ------------------
+# Echo short help message to standard output.
+func_usage_message ()
+{
+    $debug_cmd
+
+    eval \$ECHO \""Usage: $usage"\"
+    echo
+    $SED -n 's|^# ||
+        /^Written by/{
+          x;p;x
+        }
+       h
+       /^Written by/q' < "$progpath"
+    echo
+    eval \$ECHO \""$usage_message"\"
+}
+
+
+# func_version
+# ------------
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $debug_cmd
+
+    printf '%s\n' "$progname $scriptversion"
+    $SED -n '
+        /(C)/!b go
+        :more
+        /\./!{
+          N
+          s|\n# | |
+          b more
+        }
+        :go
+        /^# Written by /,/# warranty; / {
+          s|^# ||
+          s|^# *$||
+          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
+          p
+        }
+        /^# Written by / {
+          s|^# ||
+          p
+        }
+        /^warranty; /q' < "$progpath"
+
+    exit $?
+}
+
+
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
+
+# Set a version string.
+scriptversion='(GNU libtool) 2.4.6'
+
+
+# func_echo ARG...
+# ----------------
+# Libtool also displays the current mode in messages, so override
+# funclib.sh func_echo with this custom definition.
+func_echo ()
+{
+    $debug_cmd
+
+    _G_message=$*
+
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
+
+
+# func_warning ARG...
+# -------------------
+# Libtool warnings are not categorized, so override funclib.sh
+# func_warning with this simpler definition.
+func_warning ()
+{
+    $debug_cmd
+
+    $warning_func ${1+"$@"}
+}
+
+
+## ---------------- ##
+## Options parsing. ##
+## ---------------- ##
+
+# Hook in the functions to make sure our own options are parsed during
+# the option parsing loop.
+
+usage='$progpath [OPTION]... [MODE-ARG]...'
+
+# Short help message in response to '-h'.
+usage_message="Options:
+       --config             show all configuration variables
+       --debug              enable verbose shell tracing
+   -n, --dry-run            display commands without modifying any files
+       --features           display basic configuration information and exit
+       --mode=MODE          use operation mode MODE
+       --no-warnings        equivalent to '-Wnone'
+       --preserve-dup-deps  don't remove duplicate dependency libraries
+       --quiet, --silent    don't print informational messages
+       --tag=TAG            use configuration variables from tag TAG
+   -v, --verbose            print more informational messages than default
+       --version            print version information
+   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
+   -h, --help, --help-all   print short, long, or detailed help message
+"
+
+# Additional text appended to 'usage_message' in response to '--help'.
+func_help ()
+{
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message
+
+MODE must be one of the following:
+
+       clean           remove files from the build directory
+       compile         compile a source file into a libtool object
+       execute         automatically set library path, then run a program
+       finish          complete the installation of libtool libraries
+       install         install libraries or executables
+       link            create a library or an executable
+       uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  When passed as first option,
+'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
+Try '$progname --help --mode=MODE' for a more detailed description of MODE.
+
+When reporting a bug, please describe a test case to reproduce it and
+include the following information:
+
+       host-triplet:   $host
+       shell:          $SHELL
+       compiler:       $LTCC
+       compiler flags: $LTCFLAGS
+       linker:         $LD (gnu? $with_gnu_ld)
+       version:        $progname (GNU libtool) 2.4.6
+       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
+       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
+
+Report bugs to <bug-libtool@gnu.org>.
+GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+    exit 0
+}
+
+
+# func_lo2o OBJECT-NAME
+# ---------------------
+# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
+# object suffix.
+
+lo2o=s/\\.lo\$/.$objext/
+o2lo=s/\\.$objext\$/.lo/
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_lo2o ()
+  {
+    case $1 in
+      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
+      *   ) func_lo2o_result=$1               ;;
+    esac
+  }'
+
+  # func_xform LIBOBJ-OR-SOURCE
+  # ---------------------------
+  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
+  # suffix to a '.lo' libtool-object suffix.
+  eval 'func_xform ()
+  {
+    func_xform_result=${1%.*}.lo
+  }'
+else
+  # ...otherwise fall back to using sed.
+  func_lo2o ()
+  {
+    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
+  }
+
+  func_xform ()
+  {
+    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
+  }
+fi
+
+
+# func_fatal_configuration ARG...
+# -------------------------------
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func__fatal_error ${1+"$@"} \
+      "See the $PACKAGE documentation for more information." \
+      "Fatal configuration error."
+}
+
+
+# func_config
+# -----------
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+
+# func_features
+# -------------
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test yes = "$build_libtool_libs"; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test yes = "$build_old_libs"; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+
+# func_enable_tag TAGNAME
+# -----------------------
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+    # Global variable:
+    tagname=$1
+
+    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+    sed_extractcf=/$re_begincf/,/$re_endcf/p
+
+    # Validate tagname.
+    case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+        func_fatal_error "invalid tag name: $tagname"
+        ;;
+    esac
+
+    # Don't test for the "default" C tag, as we know it's
+    # there but not specially marked.
+    case $tagname in
+        CC) ;;
+    *)
+        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+         taglist="$taglist $tagname"
+
+         # Evaluate the configuration.  Be careful to quote the path
+         # and the sed script, to avoid splitting on whitespace, but
+         # also don't use non-portable quotes within backquotes within
+         # quotes we have to do it in 2 steps:
+         extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+         eval "$extractedcf"
+        else
+         func_error "ignoring unknown tag $tagname"
+        fi
+        ;;
+    esac
+}
+
+
+# func_check_version_match
+# ------------------------
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+    if test "$package_revision" != "$macro_revision"; then
+      if test "$VERSION" != "$macro_version"; then
+        if test -z "$macro_version"; then
+          cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+        else
+          cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+        fi
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+      fi
+
+      exit $EXIT_MISMATCH
+    fi
+}
+
+
+# libtool_options_prep [ARG]...
+# -----------------------------
+# Preparation for options parsed by libtool.
+libtool_options_prep ()
+{
+    $debug_mode
+
+    # Option defaults:
+    opt_config=false
+    opt_dlopen=
+    opt_dry_run=false
+    opt_help=false
+    opt_mode=
+    opt_preserve_dup_deps=false
+    opt_quiet=false
+
+    nonopt=
+    preserve_args=
+
+    # Shorthand for --mode=foo, only valid as the first argument
+    case $1 in
+    clean|clea|cle|cl)
+      shift; set dummy --mode clean ${1+"$@"}; shift
+      ;;
+    compile|compil|compi|comp|com|co|c)
+      shift; set dummy --mode compile ${1+"$@"}; shift
+      ;;
+    execute|execut|execu|exec|exe|ex|e)
+      shift; set dummy --mode execute ${1+"$@"}; shift
+      ;;
+    finish|finis|fini|fin|fi|f)
+      shift; set dummy --mode finish ${1+"$@"}; shift
+      ;;
+    install|instal|insta|inst|ins|in|i)
+      shift; set dummy --mode install ${1+"$@"}; shift
+      ;;
+    link|lin|li|l)
+      shift; set dummy --mode link ${1+"$@"}; shift
+      ;;
+    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+      shift; set dummy --mode uninstall ${1+"$@"}; shift
+      ;;
+    esac
+
+    # Pass back the list of options.
+    func_quote_for_eval ${1+"$@"}
+    libtool_options_prep_result=$func_quote_for_eval_result
+}
+func_add_hook func_options_prep libtool_options_prep
+
+
+# libtool_parse_options [ARG]...
+# ---------------------------------
+# Provide handling for libtool specific options.
+libtool_parse_options ()
+{
+    $debug_cmd
+
+    # Perform our own loop to consume as many options as possible in
+    # each iteration.
+    while test $# -gt 0; do
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --dry-run|--dryrun|-n)
+                        opt_dry_run=:
+                        ;;
+
+        --config)       func_config ;;
+
+        --dlopen|-dlopen)
+                        opt_dlopen="${opt_dlopen+$opt_dlopen
+}$1"
+                        shift
+                        ;;
+
+        --preserve-dup-deps)
+                        opt_preserve_dup_deps=: ;;
+
+        --features)     func_features ;;
+
+        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
+
+        --help)         opt_help=: ;;
+
+        --help-all)     opt_help=': help-all' ;;
+
+        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_mode=$1
+                        case $1 in
+                          # Valid mode arguments:
+                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+                          # Catch anything else as an error
+                          *) func_error "invalid argument for $_G_opt"
+                             exit_cmd=exit
+                             break
+                             ;;
+                        esac
+                        shift
+                        ;;
+
+        --no-silent|--no-quiet)
+                        opt_quiet=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                        opt_warning=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-verbose)
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --silent|--quiet)
+                        opt_quiet=:
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_tag=$1
+                        func_append preserve_args " $_G_opt $1"
+                        func_enable_tag "$1"
+                        shift
+                        ;;
+
+        --verbose|-v)   opt_quiet=false
+                        opt_verbose=:
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+       # An option not handled by this hook function:
+        *)             set dummy "$_G_opt" ${1+"$@"};  shift; break  ;;
+      esac
+    done
+
+
+    # save modified positional parameters for caller
+    func_quote_for_eval ${1+"$@"}
+    libtool_parse_options_result=$func_quote_for_eval_result
+}
+func_add_hook func_parse_options libtool_parse_options
+
+
+
+# libtool_validate_options [ARG]...
+# ---------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+libtool_validate_options ()
+{
+    # save first non-option argument
+    if test 0 -lt $#; then
+      nonopt=$1
+      shift
+    fi
+
+    # preserve --debug
+    test : = "$debug_cmd" || func_append preserve_args " --debug"
+
+    case $host in
+      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
+      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
+      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
+        # don't eliminate duplications in $postdeps and $predeps
+        opt_duplicate_compiler_generated_deps=:
+        ;;
+      *)
+        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+        ;;
+    esac
+
+    $opt_help || {
+      # Sanity checks first:
+      func_check_version_match
+
+      test yes != "$build_libtool_libs" \
+        && test yes != "$build_old_libs" \
+        && func_fatal_configuration "not configured to build any kind of library"
+
+      # Darwin sucks
+      eval std_shrext=\"$shrext_cmds\"
+
+      # Only execute mode is allowed to have -dlopen flags.
+      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
+        func_error "unrecognized option '-dlopen'"
+        $ECHO "$help" 1>&2
+        exit $EXIT_FAILURE
+      fi
+
+      # Change the help message to a mode-specific one.
+      generic_help=$help
+      help="Try '$progname --help --mode=$opt_mode' for more information."
+    }
+
+    # Pass back the unparsed argument list
+    func_quote_for_eval ${1+"$@"}
+    libtool_validate_options_result=$func_quote_for_eval_result
+}
+func_add_hook func_validate_options libtool_validate_options
+
+
+# Process options as early as possible so that --help and --version
+# can return quickly.
+func_options ${1+"$@"}
+eval set dummy "$func_options_result"; shift
+
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+magic='%%%MAGIC variable%%%'
+magic_exe='%%%MAGIC EXE variable%%%'
+
+# Global variables.
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# func_generated_by_libtool
+# True iff stdin has been generated by Libtool. This function is only
+# a basic sanity check; it will hardly flush out determined imposters.
+func_generated_by_libtool_p ()
+{
+  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_p file
+# True iff FILE is a libtool '.la' library or '.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool '.la' library or '.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if 'file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+       for lalib_p_l in 1 2 3 4
+       do
+           read lalib_p_line
+           case $lalib_p_line in
+               \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+           esac
+       done
+       exec 0<&5 5<&-
+    fi
+    test yes = "$lalib_p"
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    test -f "$1" &&
+      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $debug_cmd
+
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$sp$nl
+      eval cmd=\"$cmd\"
+      IFS=$save_ifs
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# 'FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $debug_cmd
+
+    case $1 in
+    */* | *\\*)        . "$1" ;;
+    *)         . "./$1" ;;
+    esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case $lt_sysroot:$1 in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result='='$func_stripname_result
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $debug_cmd
+
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+       func_append_quoted CC_quoted "$arg"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+             # Double-quote args containing other shell metacharacters.
+             func_append_quoted CC_quoted "$arg"
+           done
+           CC_expanded=`func_echo_all $CC`
+           CC_quoted_expanded=`func_echo_all $CC_quoted`
+           case "$@ " in
+           " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+           " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         func_echo "unable to infer tagged configuration"
+         func_fatal_error "specify a tag with '--tag'"
+#      else
+#        func_verbose "using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=$1
+    if test yes = "$build_libtool_libs"; then
+      write_lobj=\'$2\'
+    else
+      write_lobj=none
+    fi
+
+    if test yes = "$build_old_libs"; then
+      write_oldobj=\'$3\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "$write_libobj"
+    }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $debug_cmd
+
+  func_convert_core_file_wine_to_w32_result=$1
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $debug_cmd
+
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result"; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $debug_cmd
+
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $debug_cmd
+
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $debug_cmd
+
+  if test -z "$2" && test -n "$1"; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  '$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result=$1
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $debug_cmd
+
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  '$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result=$3
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $debug_cmd
+
+  case $4 in
+  $1 ) func_to_host_path_result=$3$func_to_host_path_result
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via '$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $debug_cmd
+
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $debug_cmd
+
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result=$1
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_file_result=$1
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result=$func_convert_core_msys_to_w32_result
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_file_result=$1
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_file_result=$1
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $debug_cmd
+
+  func_to_host_file_result=$1
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result=$func_cygpath_result
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $debug_cmd
+
+  func_to_host_file_result=$1
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result=$func_cygpath_result
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via '$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $debug_cmd
+
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd=func_convert_path_$func_stripname_result
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $debug_cmd
+
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result=$1
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_path_result=$1
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result=$func_convert_core_msys_to_w32_result
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_path_result=$1
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $debug_cmd
+
+  func_to_host_path_result=$1
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $debug_cmd
+
+  func_to_host_path_result=$1
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result=$func_cygpath_result
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $debug_cmd
+
+  func_to_host_path_result=$1
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result=$func_cygpath_result
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_dll_def_p FILE
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with _LT_DLL_DEF_P in libtool.m4
+func_dll_def_p ()
+{
+  $debug_cmd
+
+  func_dll_def_p_tmp=`$SED -n \
+    -e 's/^[    ]*//' \
+    -e '/^\(;.*\)*$/d' \
+    -e 's/^\(EXPORTS\|LIBRARY\)\([      ].*\)*$/DEF/p' \
+    -e q \
+    "$1"`
+  test DEF = "$func_dll_def_p_tmp"
+}
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $debug_cmd
+
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg=$arg
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj=$arg
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         test -n "$libobj" && \
+           func_fatal_error "you cannot specify '-o' more than once"
+         arg_mode=target
+         continue
+         ;;
+
+       -pie | -fpie | -fPIE)
+          func_append pie_flag " $arg"
+         continue
+         ;;
+
+       -shared | -static | -prefer-pic | -prefer-non-pic)
+         func_append later " $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         func_stripname '-Wc,' '' "$arg"
+         args=$func_stripname_result
+         lastarg=
+         save_ifs=$IFS; IFS=,
+         for arg in $args; do
+           IFS=$save_ifs
+           func_append_quoted lastarg "$arg"
+         done
+         IFS=$save_ifs
+         func_stripname ' ' '' "$lastarg"
+         lastarg=$func_stripname_result
+
+         # Add the arguments to base_compile.
+         func_append base_compile " $lastarg"
+         continue
+         ;;
+
+       *)
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg=$srcfile
+         srcfile=$arg
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_append_quoted base_compile "$lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with '-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+       func_basename "$srcfile"
+       libobj=$func_basename_result
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from '$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+       test yes = "$build_libtool_libs" \
+         || func_fatal_configuration "cannot build a shared library"
+       build_old_libs=no
+       continue
+       ;;
+
+      -static)
+       build_libtool_libs=no
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
+      && func_warning "libobj name '$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname=$func_basename_result
+    xdir=$func_dirname_result
+    lobj=$xdir$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test yes = "$build_old_libs"; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test no = "$compiler_c_o"; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
+      lockfile=$output_obj.lock
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test yes = "$need_locks"; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test warn = "$need_locks"; then
+      if test -f "$lockfile"; then
+       $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support '-c' and '-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+      func_append removelist " $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    func_append removelist " $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test yes = "$build_libtool_libs"; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test no != "$pic_mode"; then
+       command="$base_compile $qsrcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       func_append command " -o $lobj"
+      fi
+
+      func_show_eval_locale "$command" \
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test warn = "$need_locks" &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support '-c' and '-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       func_show_eval '$MV "$output_obj" "$lobj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test yes = "$suppress_opt"; then
+       suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test yes = "$build_old_libs"; then
+      if test yes != "$pic_mode"; then
+       # Don't build PIC code
+       command="$base_compile $qsrcfile$pie_flag"
+      else
+       command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test yes = "$compiler_c_o"; then
+       func_append command " -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      func_append command "$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test warn = "$need_locks" &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support '-c' and '-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       func_show_eval '$MV "$output_obj" "$obj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test no != "$need_locks"; then
+       removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $opt_mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
+  -shared           do not build a '.o' file suitable for static linking
+  -static           only build a '.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a 'standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix '.c' with the
+library object suffix, '.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to '-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the '--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the 'install' or 'cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  use a list of object files found in FILE to specify objects
+  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with '-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in '.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in '.la', then a libtool library is created,
+only library objects ('.lo' files) may be specified, and '-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
+using 'ar' and 'ranlib', or on Windows using 'lib'.
+
+If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode '$opt_mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try '$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test : = "$opt_help"; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+       func_mode_help
+      done
+    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+       echo
+       func_mode_help
+      done
+    } |
+    $SED '1d
+      /^When reporting/,/^Report/{
+       H
+       d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $debug_cmd
+
+    # The first argument is the command name.
+    cmd=$nonopt
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $opt_dlopen; do
+      test -f "$file" \
+       || func_fatal_help "'$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "'$lib' is not a valid libtool archive"
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+       func_source "$file"
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && \
+           func_warning "'$file' was not linked with '-export-dynamic'"
+         continue
+       fi
+
+       func_dirname "$file" "" "."
+       dir=$func_dirname_result
+
+       if test -f "$dir/$objdir/$dlname"; then
+         func_append dir "/$objdir"
+       else
+         if test ! -f "$dir/$dlname"; then
+           func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
+         fi
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       func_dirname "$file" "" "."
+       dir=$func_dirname_result
+       ;;
+
+      *)
+       func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir=$absdir
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic=$magic
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if func_ltwrapper_script_p "$file"; then
+         func_source "$file"
+         # Transform arg to wrapped name.
+         file=$progdir/$program
+       elif func_ltwrapper_executable_p "$file"; then
+         func_ltwrapper_scriptname "$file"
+         func_source "$func_ltwrapper_scriptname_result"
+         # Transform arg to wrapped name.
+         file=$progdir/$program
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_append_quoted args "$file"
+    done
+
+    if $opt_dry_run; then
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+       echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    else
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+       eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+             else
+               $lt_unset $lt_var
+             fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd=\$cmd$args
+    fi
+}
+
+test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $debug_cmd
+
+    libs=
+    libdirs=
+    admincmds=
+
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+       func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+       if func_lalib_unsafe_p "$opt"; then
+         func_append libs " $opt"
+       else
+         func_warning "'$opt' is not a valid libtool archive"
+       fi
+
+      else
+       func_fatal_error "invalid argument '$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+         $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+           > $tmpdir/tmp-la
+         mv -f $tmpdir/tmp-la $lib
+       done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $opt_dry_run || eval "$cmds" || func_append admincmds "
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_quiet && exit $EXIT_SUCCESS
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+       $ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+       echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
+       echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+       echo "   - add LIBDIR to the '$runpath_var' environment variable"
+       echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+       libdir=LIBDIR
+       eval flag=\"$hardcode_libdir_flag_spec\"
+
+       $ECHO "   - use the '$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+       $ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+       echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
+      fi
+      echo
+
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+       solaris2.[6789]|solaris2.1[0-9])
+         echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+         echo "pages."
+         ;;
+       *)
+         echo "more information, such as the ld(1) and ld.so(8) manual pages."
+         ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
+    exit $EXIT_SUCCESS
+}
+
+test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $debug_cmd
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac
+    then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=false
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+       func_append files " $dest"
+       dest=$arg
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=: ;;
+      -f)
+       if $install_cp; then :; else
+         prev=$arg
+       fi
+       ;;
+      -g | -m | -o)
+       prev=$arg
+       ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*)
+       ;;
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         if test X-m = "X$prev" && test -n "$install_override_mode"; then
+           arg2=$install_override_mode
+           no_mode=false
+         fi
+         prev=
+       else
+         dest=$arg
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+       func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the '$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+       func_quote_for_eval "$install_override_mode"
+       func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       func_fatal_help "no file or destination specified"
+      else
+       func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=:
+    if $isdir; then
+      destdir=$dest
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir=$func_dirname_result
+      destname=$func_basename_result
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+       func_fatal_help "'$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         func_fatal_help "'$destdir' must be an absolute directory name"
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic=$magic
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       func_append staticlibs " $file"
+       ;;
+
+      *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "'$file' is not a valid libtool archive"
+
+       library_names=
+       old_library=
+       relink_command=
+       func_source "$file"
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) func_append current_libdirs " $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) func_append future_libdirs " $libdir" ;;
+         esac
+       fi
+
+       func_dirname "$file" "/" ""
+       dir=$func_dirname_result
+       func_append dir "$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         test "$inst_prefix_dir" = "$destdir" && \
+           func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+         fi
+
+         func_warning "relinking '$file'"
+         func_show_eval "$relink_command" \
+           'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names; shift
+       if test -n "$1"; then
+         realname=$1
+         shift
+
+         srcname=$realname
+         test -n "$relink_command" && srcname=${realname}T
+
+         # Install the shared library and build the symlinks.
+         func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+             'exit $?'
+         tstripme=$stripme
+         case $host_os in
+         cygwin* | mingw* | pw32* | cegcc*)
+           case $realname in
+           *.dll.a)
+             tstripme=
+             ;;
+           esac
+           ;;
+         os2*)
+           case $realname in
+           *_dll.a)
+             tstripme=
+             ;;
+           esac
+           ;;
+         esac
+         if test -n "$tstripme" && test -n "$striplib"; then
+           func_show_eval "$striplib $destdir/$realname" 'exit $?'
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           # Try 'ln -sf' first, because the 'ln' binary might depend on
+           # the symlink we replace!  Solaris /bin/ln does not understand -f,
+           # so we also need to try rm && ln -s.
+           for linkname
+           do
+             test "$linkname" != "$realname" \
+               && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib=$destdir/$realname
+         func_execute_cmds "$postinstall_cmds" 'exit $?'
+       fi
+
+       # Install the pseudo-library for information purposes.
+       func_basename "$file"
+       name=$func_basename_result
+       instname=$dir/${name}i
+       func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile=$destdir/$destname
+       else
+         func_basename "$file"
+         destfile=$func_basename_result
+         destfile=$destdir/$destfile
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         func_lo2o "$destfile"
+         staticdest=$func_lo2o_result
+         ;;
+       *.$objext)
+         staticdest=$destfile
+         destfile=
+         ;;
+       *)
+         func_fatal_help "cannot copy a libtool object to '$destfile'"
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       test -n "$destfile" && \
+         func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+       # Install the old object if enabled.
+       if test yes = "$build_old_libs"; then
+         # Deduce the name of the old-style object file.
+         func_lo2o "$file"
+         staticobj=$func_lo2o_result
+         func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile=$destdir/$destname
+       else
+         func_basename "$file"
+         destfile=$func_basename_result
+         destfile=$destdir/$destfile
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             func_stripname '' '.exe' "$file"
+             file=$func_stripname_result
+             stripped_ext=.exe
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin* | *mingw*)
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             wrapper=$func_ltwrapper_scriptname_result
+           else
+             func_stripname '' '.exe' "$file"
+             wrapper=$func_stripname_result
+           fi
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if func_ltwrapper_script_p "$wrapper"; then
+         notinst_deplibs=
+         relink_command=
+
+         func_source "$wrapper"
+
+         # Check the variables that should have been set.
+         test -z "$generated_by_libtool_version" && \
+           func_fatal_error "invalid libtool wrapper script '$wrapper'"
+
+         finalize=:
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             func_source "$lib"
+           fi
+           libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             func_warning "'$lib' has not been installed in '$libdir'"
+             finalize=false
+           fi
+         done
+
+         relink_command=
+         func_source "$wrapper"
+
+         outputname=
+         if test no = "$fast_install" && test -n "$relink_command"; then
+           $opt_dry_run || {
+             if $finalize; then
+               tmpdir=`func_mktempdir`
+               func_basename "$file$stripped_ext"
+               file=$func_basename_result
+               outputname=$tmpdir/$file
+               # Replace the output file specification.
+               relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+               $opt_quiet || {
+                 func_quote_for_expand "$relink_command"
+                 eval "func_echo $func_quote_for_expand_result"
+               }
+               if eval "$relink_command"; then :
+                 else
+                 func_error "error: relink '$file' with the above command before installing it"
+                 $opt_dry_run || ${RM}r "$tmpdir"
+                 continue
+               fi
+               file=$outputname
+             else
+               func_warning "cannot relink '$file'"
+             fi
+           }
+         else
+           # Install the binary that we compiled earlier.
+           file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyway
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           func_stripname '' '.exe' "$destfile"
+           destfile=$func_stripname_result
+           ;;
+         esac
+         ;;
+       esac
+       func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+       $opt_dry_run || if test -n "$outputname"; then
+         ${RM}r "$tmpdir"
+       fi
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name=$func_basename_result
+
+      # Set up the ranlib parameters.
+      oldlib=$destdir/$name
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run '$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test install = "$opt_mode" && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $debug_cmd
+
+    my_outputname=$1
+    my_originator=$2
+    my_pic_p=${3-false}
+    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+       my_dlsyms=${my_outputname}S.c
+      else
+       func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+       # Discover the nlist of each of the dlfiles.
+       nlist=$output_objdir/$my_outputname.nm
+
+       func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+       # Parse the name list into a source file.
+       func_verbose "creating $output_objdir/$my_dlsyms"
+
+       $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined __osf__
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
+/* External symbol declarations for the compiler. */\
+"
+
+       if test yes = "$dlself"; then
+         func_verbose "generating symbol list for '$output'"
+
+         $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+         # Add our own program objects to the symbol list.
+         progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+         for progfile in $progfiles; do
+           func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+           func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
+           $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -n "$exclude_expsyms"; then
+           $opt_dry_run || {
+             eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         if test -n "$export_symbols_regex"; then
+           $opt_dry_run || {
+             eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         # Prepare the list of exported symbols
+         if test -z "$export_symbols"; then
+           export_symbols=$output_objdir/$outputname.exp
+           $opt_dry_run || {
+             $RM $export_symbols
+             eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             case $host in
+             *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+               ;;
+             esac
+           }
+         else
+           $opt_dry_run || {
+             eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+             case $host in
+               *cygwin* | *mingw* | *cegcc* )
+                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                 ;;
+             esac
+           }
+         fi
+       fi
+
+       for dlprefile in $dlprefiles; do
+         func_verbose "extracting global C symbols from '$dlprefile'"
+         func_basename "$dlprefile"
+         name=$func_basename_result
+          case $host in
+           *cygwin* | *mingw* | *cegcc* )
+             # if an import library, we need to obtain dlname
+             if func_win32_import_lib_p "$dlprefile"; then
+               func_tr_sh "$dlprefile"
+               eval "curr_lafile=\$libfile_$func_tr_sh_result"
+               dlprefile_dlbasename=
+               if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+                 # Use subshell, to avoid clobbering current variable values
+                 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+                 if test -n "$dlprefile_dlname"; then
+                   func_basename "$dlprefile_dlname"
+                   dlprefile_dlbasename=$func_basename_result
+                 else
+                   # no lafile. user explicitly requested -dlpreopen <import library>.
+                   $sharedlib_from_linklib_cmd "$dlprefile"
+                   dlprefile_dlbasename=$sharedlib_from_linklib_result
+                 fi
+               fi
+               $opt_dry_run || {
+                 if test -n "$dlprefile_dlbasename"; then
+                   eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+                 else
+                   func_warning "Could not compute DLL name from $name"
+                   eval '$ECHO ": $name " >> "$nlist"'
+                 fi
+                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+                   $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+               }
+             else # not an import lib
+               $opt_dry_run || {
+                 eval '$ECHO ": $name " >> "$nlist"'
+                 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+                 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+               }
+             fi
+           ;;
+           *)
+             $opt_dry_run || {
+               eval '$ECHO ": $name " >> "$nlist"'
+               func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+               eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+             }
+           ;;
+          esac
+       done
+
+       $opt_dry_run || {
+         # Make sure we have at least an empty file.
+         test -f "$nlist" || : > "$nlist"
+
+         if test -n "$exclude_expsyms"; then
+           $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+           $MV "$nlist"T "$nlist"
+         fi
+
+         # Try sorting and uniquifying the output.
+         if $GREP -v "^: " < "$nlist" |
+             if sort -k 3 </dev/null >/dev/null 2>&1; then
+               sort -k 3
+             else
+               sort +2
+             fi |
+             uniq > "$nlist"S; then
+           :
+         else
+           $GREP -v "^: " < "$nlist" > "$nlist"S
+         fi
+
+         if test -f "$nlist"S; then
+           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+         else
+           echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+         fi
+
+         func_show_eval '$RM "${nlist}I"'
+         if test -n "$global_symbol_to_import"; then
+           eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
+         fi
+
+         echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];\
+"
+
+         if test -s "$nlist"I; then
+           echo >> "$output_objdir/$my_dlsyms" "\
+static void lt_syminit(void)
+{
+  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
+  for (; symbol->name; ++symbol)
+    {"
+           $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
+           echo >> "$output_objdir/$my_dlsyms" "\
+    }
+}"
+         fi
+         echo >> "$output_objdir/$my_dlsyms" "\
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{ {\"$my_originator\", (void *) 0},"
+
+         if test -s "$nlist"I; then
+           echo >> "$output_objdir/$my_dlsyms" "\
+  {\"@INIT@\", (void *) &lt_syminit},"
+         fi
+
+         case $need_lib_prefix in
+         no)
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         *)
+           eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         esac
+         echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+       } # !$opt_dry_run
+
+       pic_flag_for_symtable=
+       case "$compile_command " in
+       *" -static "*) ;;
+       *)
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+         *-*-hpux*)
+           pic_flag_for_symtable=" $pic_flag"  ;;
+         *)
+           $my_pic_p && pic_flag_for_symtable=" $pic_flag"
+           ;;
+         esac
+         ;;
+       esac
+       symtab_cflags=
+       for arg in $LTCFLAGS; do
+         case $arg in
+         -pie | -fpie | -fPIE) ;;
+         *) func_append symtab_cflags " $arg" ;;
+         esac
+       done
+
+       # Now compile the dynamic symbol file.
+       func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+       # Clean up the generated files.
+       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
+
+       # Transform the symbol file into the correct name.
+       symfileobj=$output_objdir/${my_outputname}S.$objext
+       case $host in
+       *cygwin* | *mingw* | *cegcc* )
+         if test -f "$output_objdir/$my_outputname.def"; then
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+         else
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         fi
+         ;;
+       *)
+         compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         ;;
+       esac
+       ;;
+      *)
+       func_fatal_error "unknown suffix for '$my_dlsyms'"
+       ;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $debug_cmd
+
+  win32_libid_type=unknown
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      case $nm_interface in
+      "MS dumpbin")
+       if func_cygming_ms_implib_p "$1" ||
+          func_cygming_gnu_implib_p "$1"
+       then
+         win32_nmres=import
+       else
+         win32_nmres=
+       fi
+       ;;
+      *)
+       func_to_tool_file "$1" func_convert_file_msys_to_w32
+       win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+         $SED -n -e '
+           1,100{
+               / I /{
+                   s|.*|import|
+                   p
+                   q
+               }
+           }'`
+       ;;
+      esac
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $debug_cmd
+
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $debug_cmd
+
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[         ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive that possess that section. Heuristic: eliminate
+    # all those that have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $debug_cmd
+
+  if func_cygming_gnu_implib_p "$1"; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1"; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=
+  fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $debug_cmd
+
+    f_ex_an_ar_dir=$1; shift
+    f_ex_an_ar_oldlib=$1
+    if test yes = "$lock_old_archive_extraction"; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+                  'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test yes = "$lock_old_archive_extraction"; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $debug_cmd
+
+    my_gentop=$1; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=
+    my_xlib=
+    my_xabs=
+    my_xdir=
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
+       *) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib=$func_basename_result
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         func_arith $extracted_serial + 1
+         extracted_serial=$func_arith_result
+         my_xlib_u=lt$extracted_serial-$my_xlib ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir=$my_gentop/$my_xlib_u
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+       func_verbose "Extracting $my_xabs"
+       # Do not bother doing anything if just a dry run
+       $opt_dry_run || {
+         darwin_orig_dir=`pwd`
+         cd $my_xdir || exit $?
+         darwin_archive=$my_xabs
+         darwin_curdir=`pwd`
+         func_basename "$darwin_archive"
+         darwin_base_archive=$func_basename_result
+         darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+         if test -n "$darwin_arches"; then
+           darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+           darwin_arch=
+           func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+           for darwin_arch in  $darwin_arches; do
+             func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
+             $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
+             cd "unfat-$$/$darwin_base_archive-$darwin_arch"
+             func_extract_an_archive "`pwd`" "$darwin_base_archive"
+             cd "$darwin_curdir"
+             $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
+           done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
+           darwin_file=
+           darwin_files=
+           for darwin_file in $darwin_filelist; do
+             darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+             $LIPO -create -output "$darwin_file" $darwin_files
+           done # $darwin_filelist
+           $RM -rf unfat-$$
+           cd "$darwin_orig_dir"
+         else
+           cd $darwin_orig_dir
+           func_extract_an_archive "$my_xdir" "$my_xabs"
+         fi # $darwin_arches
+       } # !$opt_dry_run
+       ;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+       ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+    done
+
+    func_extract_archives_result=$my_oldobjs
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory where it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+       func_emit_wrapper_arg1=${1-no}
+
+       $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ that is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options that match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test yes = "$fast_install"; then
+         $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+         $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       \$ECHO \"\$relink_command_output\" >&2
+       $RM \"\$progdir/\$file\"
+       exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+       else
+         $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # fixup the dll searchpath if we need to.
+       #
+       # Fix the DLL searchpath if we need to.  Do this before prepending
+       # to shlibpath, because on Windows, both are PATH and uninstalled
+       # libraries must come first.
+       if test -n "$dllsearchpath"; then
+         $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       # Export our shlibpath_var if we have one.
+       if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       $ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+       cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+*/
+EOF
+           cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
+/* declarations of non-ANSI functions */
+#if defined __MINGW32__
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined __CYGWIN__
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined other_platform || defined ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined _MSC_VER
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+#elif defined __MINGW32__
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined __CYGWIN__
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined other platforms ... */
+#endif
+
+#if defined PATH_MAX
+# define LT_PATHMAX PATH_MAX
+#elif defined MAXPATHLEN
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
+  defined __OS2__
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+       (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free (stale); stale = 0; } \
+} while (0)
+
+#if defined LT_DEBUGWRAPPER
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+           cat <<EOF
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+# define externally_visible volatile
+#else
+# define externally_visible __attribute__((externally_visible)) volatile
+#endif
+externally_visible const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+           if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_path "$temp_rpath"
+             cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+           else
+             cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test -n "$dllsearchpath"; then
+              func_to_host_path "$dllsearchpath:"
+             cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+           else
+             cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test yes = "$fast_install"; then
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+           else
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+           fi
+
+
+           cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  int rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  newargz = XMALLOC (char *, (size_t) argc + 1);
+
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (STREQ (argv[i], dumpscript_opt))
+       {
+EOF
+           case $host in
+             *mingw* | *cygwin* )
+               # make stdout use "unix" line endings
+               echo "          setmode(1,_O_BINARY);"
+               ;;
+             esac
+
+           cat <<"EOF"
+         lt_dump_script (stdout);
+         return 0;
+       }
+      if (STREQ (argv[i], debug_opt))
+       {
+          lt_debug = 1;
+          continue;
+       }
+      if (STREQ (argv[i], ltwrapper_option_prefix))
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+                   "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+EOF
+           cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
+EOF
+           cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+                 tmp_pathspec);
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+                 actual_cwrapper_path);
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(main) libtool target name: %s\n",
+                 target_name);
+EOF
+
+           cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+                   strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+           cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+           case $host_os in
+             mingw*)
+           cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+       *p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+       *p = '/';
+      }
+  }
+EOF
+           ;;
+           esac
+
+           cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+                 nonnull (lt_argv_zero));
+  for (i = 0; i < newargc; i++)
+    {
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+                     i, nonnull (newargz[i]));
+    }
+
+EOF
+
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
+  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      lt_debugprintf (__FILE__, __LINE__,
+                     "(main) failed to launch target \"%s\": %s\n",
+                     lt_argv_zero, nonnull (strerror (errno)));
+      return 127;
+    }
+  return rval;
+EOF
+               ;;
+             *)
+               cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+               ;;
+           esac
+
+           cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+                         string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  size_t tmp_len;
+  char *concat_name;
+
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+       return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+       {
+         concat_name = xstrdup (wrapper);
+         if (check_executable (concat_name))
+           return concat_name;
+         XFREE (concat_name);
+       }
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+       has_slash = 1;
+       break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+       {
+         for (p = path; *p; p = p_next)
+           {
+             const char *q;
+             size_t p_len;
+             for (q = p; *q; q++)
+               if (IS_PATH_SEPARATOR (*q))
+                 break;
+             p_len = (size_t) (q - p);
+             p_next = (*q == '\0' ? q : q + 1);
+             if (p_len == 0)
+               {
+                 /* empty path: current directory */
+                 if (getcwd (tmp, LT_PATHMAX) == NULL)
+                   lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
+                 tmp_len = strlen (tmp);
+                 concat_name =
+                   XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, tmp, tmp_len);
+                 concat_name[tmp_len] = '/';
+                 strcpy (concat_name + tmp_len + 1, wrapper);
+               }
+             else
+               {
+                 concat_name =
+                   XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, p, p_len);
+                 concat_name[p_len] = '/';
+                 strcpy (concat_name + p_len + 1, wrapper);
+               }
+             if (check_executable (concat_name))
+               return concat_name;
+             XFREE (concat_name);
+           }
+       }
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      lt_debugprintf (__FILE__, __LINE__,
+                     "checking path component for symlinks: %s\n",
+                     tmp_pathspec);
+      if (lstat (tmp_pathspec, &s) == 0)
+       {
+         if (S_ISLNK (s.st_mode) != 0)
+           {
+             has_symlinks = 1;
+             break;
+           }
+
+         /* search backwards for last DIR_SEPARATOR */
+         p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+         while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           p--;
+         if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           {
+             /* no more DIR_SEPARATORS left */
+             break;
+           }
+         *p = '\0';
+       }
+      else
+       {
+         lt_fatal (__FILE__, __LINE__,
+                   "error accessing file \"%s\": %s",
+                   tmp_pathspec, nonnull (strerror (errno)));
+       }
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal (__FILE__, __LINE__,
+               "could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (STREQ (str, pat))
+       *str = '\0';
+    }
+  return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+              int line, const char *mode,
+              const char *message, va_list ap)
+{
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    size_t len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      size_t orig_value_len = strlen (orig_value);
+      size_t add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      size_t len = strlen (new_value);
+      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[--len] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+       new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+       {
+         int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+         size_t length;
+         unsigned int backslashes;
+         const char *s;
+         char *quoted_string;
+         char *p;
+
+         length = 0;
+         backslashes = 0;
+         if (quote_around)
+           length++;
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               length += backslashes + 1;
+             length++;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           length += backslashes + 1;
+
+         quoted_string = XMALLOC (char, length + 1);
+
+         p = quoted_string;
+         backslashes = 0;
+         if (quote_around)
+           *p++ = '"';
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               {
+                 unsigned int j;
+                 for (j = backslashes + 1; j > 0; j--)
+                   *p++ = '\\';
+               }
+             *p++ = c;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           {
+             unsigned int j;
+             for (j = backslashes; j > 0; j--)
+               *p++ = '\\';
+             *p++ = '"';
+           }
+         *p = '\0';
+
+         new_argv[i] = quoted_string;
+       }
+      else
+       new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+               ;;
+           esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+           func_emit_wrapper yes |
+             $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $debug_cmd
+
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_suncc_cstd_abi
+# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
+# Several compiler flags select an ABI that is incompatible with the
+# Cstd library. Avoid specifying it if any are in CXXFLAGS.
+func_suncc_cstd_abi ()
+{
+    $debug_cmd
+
+    case " $compile_command " in
+    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
+      suncc_use_cstd_abi=no
+      ;;
+    *)
+      suncc_use_cstd_abi=yes
+      ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $debug_cmd
+
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # what system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll that has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    os2dllname=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=false
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module=$wl-single_module
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+       test yes != "$build_libtool_libs" \
+         && func_fatal_configuration "cannot build a shared library"
+       build_old_libs=no
+       break
+       ;;
+      -all-static | -static | -static-libtool-libs)
+       case $arg in
+       -all-static)
+         if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
+           func_warning "complete static linking is impossible in this configuration"
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       -static)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=built
+         ;;
+       -static-libtool-libs)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       esac
+       build_libtool_libs=no
+       build_old_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg=$1
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         func_append compile_command " @OUTPUT@"
+         func_append finalize_command " @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       bindir)
+         bindir=$arg
+         prev=
+         continue
+         ;;
+       dlfiles|dlprefiles)
+         $preload || {
+           # Add the symbol object into the linking commands.
+           func_append compile_command " @SYMFILE@"
+           func_append finalize_command " @SYMFILE@"
+           preload=:
+         }
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test no = "$dlself"; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test dlprefiles = "$prev"; then
+             dlself=yes
+           elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test dlfiles = "$prev"; then
+             func_append dlfiles " $arg"
+           else
+             func_append dlprefiles " $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols=$arg
+         test -f "$arg" \
+           || func_fatal_error "symbol file '$arg' does not exist"
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex=$arg
+         prev=
+         continue
+         ;;
+       framework)
+         case $host in
+           *-*-darwin*)
+             case "$deplibs " in
+               *" $qarg.ltframework "*) ;;
+               *) func_append deplibs " $qarg.ltframework" # this is fixed later
+                  ;;
+             esac
+             ;;
+         esac
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir=$arg
+         prev=
+         continue
+         ;;
+       mllvm)
+         # Clang does not use LLVM to link, so we can simply discard any
+         # '-mllvm $arg' options when doing the link step.
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat "$save_arg"`
+           do
+#            func_append moreargs " $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if func_lalib_unsafe_p "$arg"; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               func_source "$arg"
+
+               if test -z "$pic_object" ||
+                  test -z "$non_pic_object" ||
+                  test none = "$pic_object" &&
+                  test none = "$non_pic_object"; then
+                 func_fatal_error "cannot find name of object for '$arg'"
+               fi
+
+               # Extract subdirectory from the argument.
+               func_dirname "$arg" "/" ""
+               xdir=$func_dirname_result
+
+               if test none != "$pic_object"; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object=$xdir$pic_object
+
+                 if test dlfiles = "$prev"; then
+                   if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
+                     func_append dlfiles " $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test dlprefiles = "$prev"; then
+                   # Preload the old-style object.
+                   func_append dlprefiles " $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 func_append libobjs " $pic_object"
+                 arg=$pic_object
+               fi
+
+               # Non-PIC object.
+               if test none != "$non_pic_object"; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object=$xdir$non_pic_object
+
+                 # A standard non-PIC object
+                 func_append non_pic_objects " $non_pic_object"
+                 if test -z "$pic_object" || test none = "$pic_object"; then
+                   arg=$non_pic_object
+                 fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object=$pic_object
+                 func_append non_pic_objects " $non_pic_object"
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if $opt_dry_run; then
+                 # Extract subdirectory from the argument.
+                 func_dirname "$arg" "/" ""
+                 xdir=$func_dirname_result
+
+                 func_lo2o "$arg"
+                 pic_object=$xdir$objdir/$func_lo2o_result
+                 non_pic_object=$xdir$func_lo2o_result
+                 func_append libobjs " $pic_object"
+                 func_append non_pic_objects " $non_pic_object"
+               else
+                 func_fatal_error "'$arg' is not a valid libtool object"
+               fi
+             fi
+           done
+         else
+           func_fatal_error "link input file '$arg' does not exist"
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       os2dllname)
+         os2dllname=$arg
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex=$arg
+         prev=
+         continue
+         ;;
+       release)
+         release=-$arg
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           func_fatal_error "only absolute run-paths are allowed"
+           ;;
+         esac
+         if test rpath = "$prev"; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) func_append rpath " $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) func_append xrpath " $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       shrext)
+         shrext_cmds=$arg
+         prev=
+         continue
+         ;;
+       weak)
+         func_append weak_libs " $arg"
+         prev=
+         continue
+         ;;
+       xcclinker)
+         func_append linker_flags " $qarg"
+         func_append compiler_flags " $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xcompiler)
+         func_append compiler_flags " $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xlinker)
+         func_append linker_flags " $qarg"
+         func_append compiler_flags " $wl$qarg"
+         prev=
+         func_append compile_command " $wl$qarg"
+         func_append finalize_command " $wl$qarg"
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg=$arg
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         # See comment for -static flag below, for more details.
+         func_append compile_command " $link_static_flag"
+         func_append finalize_command " $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       func_fatal_error "'-allow-undefined' must not be used because it is the default"
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -bindir)
+       prev=bindir
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         func_fatal_error "more than one -exported-symbols argument is not allowed"
+       fi
+       if test X-export-symbols = "X$arg"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -framework)
+       prev=framework
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         func_append compile_command " $arg"
+         func_append finalize_command " $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       func_stripname "-L" '' "$arg"
+       if test -z "$func_stripname_result"; then
+         if test "$#" -gt 0; then
+           func_fatal_error "require no space between '-L' and '$1'"
+         else
+           func_fatal_error "need path for '-L' option"
+         fi
+       fi
+       func_resolve_sysroot "$func_stripname_result"
+       dir=$func_resolve_sysroot_result
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         test -z "$absdir" && \
+           func_fatal_error "cannot determine absolute directory name of '$dir'"
+         dir=$absdir
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "* | *" $arg "*)
+         # Will only happen for absolute or sysroot arguments
+         ;;
+       *)
+         # Preserve sysroot, but never include relative directories
+         case $dir in
+           [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+           *) func_append deplibs " -L$dir" ;;
+         esac
+         func_append lib_search_path " $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         ::) dllsearchpath=$dir;;
+         *) func_append dllsearchpath ":$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) func_append dllsearchpath ":$testbindir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test X-lc = "X$arg" || test X-lm = "X$arg"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test X-lc = "X$arg" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
+           # Do not include libc due to us having libc/libc_r.
+           test X-lc = "X$arg" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           func_append deplibs " System.ltframework"
+           continue
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           test X-lc = "X$arg" && continue
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           test X-lc = "X$arg" && continue
+           ;;
+         esac
+       elif test X-lc_r = "X$arg"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       func_append deplibs " $arg"
+       continue
+       ;;
+
+      -mllvm)
+       prev=mllvm
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot|--sysroot)
+       func_append compiler_flags " $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       prev=xcompiler
+       continue
+       ;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+       func_append compiler_flags " $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       case "$new_inherited_linker_flags " in
+           *" $arg "*) ;;
+           * ) func_append new_inherited_linker_flags " $arg" ;;
+       esac
+       continue
+       ;;
+
+      -multi_module)
+       single_module=$wl-multi_module
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # and Darwin in order for the loader to find any dlls it needs.
+         func_warning "'-no-install' is ignored for $host"
+         func_warning "assuming '-no-fast-install' instead"
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -os2dllname)
+       prev=os2dllname
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       func_stripname '-R' '' "$arg"
+       dir=$func_stripname_result
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       =*)
+         func_stripname '=' '' "$dir"
+         dir=$lt_sysroot$func_stripname_result
+         ;;
+       *)
+         func_fatal_error "only absolute run-paths are allowed"
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) func_append xrpath " $dir" ;;
+       esac
+       continue
+       ;;
+
+      -shared)
+       # The effects of -shared are defined in a previous loop.
+       continue
+       ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -static | -static-libtool-libs)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -weak)
+        prev=weak
+       continue
+       ;;
+
+      -Wc,*)
+       func_stripname '-Wc,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs=$IFS; IFS=,
+       for flag in $args; do
+         IFS=$save_ifs
+          func_quote_for_eval "$flag"
+         func_append arg " $func_quote_for_eval_result"
+         func_append compiler_flags " $func_quote_for_eval_result"
+       done
+       IFS=$save_ifs
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Wl,*)
+       func_stripname '-Wl,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs=$IFS; IFS=,
+       for flag in $args; do
+         IFS=$save_ifs
+          func_quote_for_eval "$flag"
+         func_append arg " $wl$func_quote_for_eval_result"
+         func_append compiler_flags " $wl$func_quote_for_eval_result"
+         func_append linker_flags " $func_quote_for_eval_result"
+       done
+       IFS=$save_ifs
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # -msg_* for osf cc
+      -msg_*)
+       func_quote_for_eval "$arg"
+       arg=$func_quote_for_eval_result
+       ;;
+
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # -fstack-protector*   stack protector flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -stdlib=*            select c++ std lib with clang
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
+        func_quote_for_eval "$arg"
+       arg=$func_quote_for_eval_result
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        func_append compiler_flags " $arg"
+        continue
+        ;;
+
+      -Z*)
+        if test os2 = "`expr $host : '.*\(os2\)'`"; then
+          # OS/2 uses -Zxxx to specify OS/2-specific options
+         compiler_flags="$compiler_flags $arg"
+         func_append compile_command " $arg"
+         func_append finalize_command " $arg"
+         case $arg in
+         -Zlinker | -Zstack)
+           prev=xcompiler
+           ;;
+         esac
+         continue
+        else
+         # Otherwise treat like 'Some other compiler flag' below
+         func_quote_for_eval "$arg"
+         arg=$func_quote_for_eval_result
+        fi
+       ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+       arg=$func_quote_for_eval_result
+       ;;
+
+      *.$objext)
+       # A standard object.
+       func_append objs " $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if func_lalib_unsafe_p "$arg"; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         func_source "$arg"
+
+         if test -z "$pic_object" ||
+            test -z "$non_pic_object" ||
+            test none = "$pic_object" &&
+            test none = "$non_pic_object"; then
+           func_fatal_error "cannot find name of object for '$arg'"
+         fi
+
+         # Extract subdirectory from the argument.
+         func_dirname "$arg" "/" ""
+         xdir=$func_dirname_result
+
+         test none = "$pic_object" || {
+           # Prepend the subdirectory the object is found in.
+           pic_object=$xdir$pic_object
+
+           if test dlfiles = "$prev"; then
+             if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
+               func_append dlfiles " $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test dlprefiles = "$prev"; then
+             # Preload the old-style object.
+             func_append dlprefiles " $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           func_append libobjs " $pic_object"
+           arg=$pic_object
+         }
+
+         # Non-PIC object.
+         if test none != "$non_pic_object"; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object=$xdir$non_pic_object
+
+           # A standard non-PIC object
+           func_append non_pic_objects " $non_pic_object"
+           if test -z "$pic_object" || test none = "$pic_object"; then
+             arg=$non_pic_object
+           fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object=$pic_object
+           func_append non_pic_objects " $non_pic_object"
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if $opt_dry_run; then
+           # Extract subdirectory from the argument.
+           func_dirname "$arg" "/" ""
+           xdir=$func_dirname_result
+
+           func_lo2o "$arg"
+           pic_object=$xdir$objdir/$func_lo2o_result
+           non_pic_object=$xdir$func_lo2o_result
+           func_append libobjs " $pic_object"
+           func_append non_pic_objects " $non_pic_object"
+         else
+           func_fatal_error "'$arg' is not a valid libtool object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       func_append deplibs " $arg"
+       func_append old_deplibs " $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       func_resolve_sysroot "$arg"
+       if test dlfiles = "$prev"; then
+         # This library was specified with -dlopen.
+         func_append dlfiles " $func_resolve_sysroot_result"
+         prev=
+       elif test dlprefiles = "$prev"; then
+         # The library was specified with -dlpreopen.
+         func_append dlprefiles " $func_resolve_sysroot_result"
+         prev=
+       else
+         func_append deplibs " $func_resolve_sysroot_result"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       func_quote_for_eval "$arg"
+       arg=$func_quote_for_eval_result
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the '$prevarg' option requires an argument"
+
+    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname=$func_basename_result
+    libobjs_save=$libobjs
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    # Definition is injected by LT_CONFIG during libtool generation.
+    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
+
+    func_dirname "$output" "/" ""
+    output_objdir=$func_dirname_result$objdir
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_preserve_dup_deps; then
+       case "$libs " in
+       *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+       esac
+      fi
+      func_append libs " $deplib"
+    done
+
+    if test lib = "$linkmode"; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+         esac
+         func_append pre_post_deps " $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+       passes="conv dlpreopen link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=false
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test lib,link = "$linkmode,$pass"; then
+       ## FIXME: Find the place where the list is rebuilt in the wrong
+       ##        order, and fix it there properly
+        tmp_deplibs=
+       for deplib in $deplibs; do
+         tmp_deplibs="$deplib $tmp_deplibs"
+       done
+       deplibs=$tmp_deplibs
+      fi
+
+      if test lib,link = "$linkmode,$pass" ||
+        test prog,scan = "$linkmode,$pass"; then
+       libs=$deplibs
+       deplibs=
+      fi
+      if test prog = "$linkmode"; then
+       case $pass in
+       dlopen) libs=$dlfiles ;;
+       dlpreopen) libs=$dlprefiles ;;
+       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       esac
+      fi
+      if test lib,dlpreopen = "$linkmode,$pass"; then
+       # Collect and forward deplibs of preopened libtool libs
+       for lib in $dlprefiles; do
+         # Ignore non-libtool-libs
+         dependency_libs=
+         func_resolve_sysroot "$lib"
+         case $lib in
+         *.la) func_source "$func_resolve_sysroot_result" ;;
+         esac
+
+         # Collect preopened libtool deplibs, except any this library
+         # has declared as weak libs
+         for deplib in $dependency_libs; do
+           func_basename "$deplib"
+            deplib_base=$func_basename_result
+           case " $weak_libs " in
+           *" $deplib_base "*) ;;
+           *) func_append deplibs " $deplib" ;;
+           esac
+         done
+       done
+       libs=$dlprefiles
+      fi
+      if test dlopen = "$pass"; then
+       # Collect dlpreopened libraries
+       save_deplibs=$deplibs
+       deplibs=
+      fi
+
+      for deplib in $libs; do
+       lib=
+       found=false
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+         if test prog,link = "$linkmode,$pass"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           func_append compiler_flags " $deplib"
+           if test lib = "$linkmode"; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) func_append new_inherited_linker_flags " $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -l*)
+         if test lib != "$linkmode" && test prog != "$linkmode"; then
+           func_warning "'-l' is ignored for archives/objects"
+           continue
+         fi
+         func_stripname '-l' '' "$deplib"
+         name=$func_stripname_result
+         if test lib = "$linkmode"; then
+           searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+         else
+           searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+         fi
+         for searchdir in $searchdirs; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib=$searchdir/lib$name$search_ext
+             if test -f "$lib"; then
+               if test .la = "$search_ext"; then
+                 found=:
+               else
+                 found=false
+               fi
+               break 2
+             fi
+           done
+         done
+         if $found; then
+           # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if func_lalib_p "$lib"; then
+                 library_names=
+                 old_library=
+                 func_source "$lib"
+                 for l in $old_library $library_names; do
+                   ll=$l
+                 done
+                 if test "X$ll" = "X$old_library"; then # only static version available
+                   found=false
+                   func_dirname "$lib" "" "."
+                   ladir=$func_dirname_result
+                   lib=$ladir/$old_library
+                   if test prog,link = "$linkmode,$pass"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         else
+           # deplib doesn't seem to be a libtool library
+           if test prog,link = "$linkmode,$pass"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         fi
+         ;; # -l
+       *.ltframework)
+         if test prog,link = "$linkmode,$pass"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           deplibs="$deplib $deplibs"
+           if test lib = "$linkmode"; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) func_append new_inherited_linker_flags " $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test conv = "$pass" && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           func_stripname '-L' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           func_append newlib_search_path " $func_resolve_sysroot_result"
+           ;;
+         prog)
+           if test conv = "$pass"; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test scan = "$pass"; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           func_stripname '-L' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           func_append newlib_search_path " $func_resolve_sysroot_result"
+           ;;
+         *)
+           func_warning "'-L' is ignored for archives/objects"
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test link = "$pass"; then
+           func_stripname '-R' '' "$deplib"
+           func_resolve_sysroot "$func_stripname_result"
+           dir=$func_resolve_sysroot_result
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) func_append xrpath " $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la)
+         func_resolve_sysroot "$deplib"
+         lib=$func_resolve_sysroot_result
+         ;;
+       *.$libext)
+         if test conv = "$pass"; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           # Linking convenience modules into shared libraries is allowed,
+           # but linking other static libraries is non-portable.
+           case " $dlpreconveniencelibs " in
+           *" $deplib "*) ;;
+           *)
+             valid_a_lib=false
+             case $deplibs_check_method in
+               match_pattern*)
+                 set dummy $deplibs_check_method; shift
+                 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+                 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+                   | $EGREP "$match_pattern_regex" > /dev/null; then
+                   valid_a_lib=:
+                 fi
+               ;;
+               pass_all)
+                 valid_a_lib=:
+               ;;
+             esac
+             if $valid_a_lib; then
+               echo
+               $ECHO "*** Warning: Linking the shared library $output against the"
+               $ECHO "*** static library $deplib is not portable!"
+               deplibs="$deplib $deplibs"
+             else
+               echo
+               $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because the file extensions .$libext of this argument makes me believe"
+               echo "*** that it is just a static archive that I should not use here."
+             fi
+             ;;
+           esac
+           continue
+           ;;
+         prog)
+           if test link != "$pass"; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test conv = "$pass"; then
+           deplibs="$deplib $deplibs"
+         elif test prog = "$linkmode"; then
+           if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             func_append newdlprefiles " $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             func_append newdlfiles " $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=:
+         continue
+         ;;
+       esac # case $deplib
+
+       $found || test -f "$lib" \
+         || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$lib" \
+         || func_fatal_error "'$lib' is not a valid libtool archive"
+
+       func_dirname "$lib" "" "."
+       ladir=$func_dirname_result
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       inherited_linker_flags=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+       avoidtemprpath=
+
+
+       # Read the .la file
+       func_source "$lib"
+
+       # Convert "-framework foo" to "foo.ltframework"
+       if test -n "$inherited_linker_flags"; then
+         tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+         for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+           case " $new_inherited_linker_flags " in
+             *" $tmp_inherited_linker_flag "*) ;;
+             *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+           esac
+         done
+       fi
+       dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       if test lib,link = "$linkmode,$pass" ||
+          test prog,scan = "$linkmode,$pass" ||
+          { test prog != "$linkmode" && test lib != "$linkmode"; }; then
+         test -n "$dlopen" && func_append dlfiles " $dlopen"
+         test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+       fi
+
+       if test conv = "$pass"; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             func_fatal_error "cannot find name of link library for '$lib'"
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           func_append convenience " $ladir/$objdir/$old_library"
+           func_append old_convenience " $ladir/$objdir/$old_library"
+         elif test prog != "$linkmode" && test lib != "$linkmode"; then
+           func_fatal_error "'$lib' is not a convenience library"
+         fi
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           deplibs="$deplib $deplibs"
+           if $opt_preserve_dup_deps; then
+             case "$tmp_libs " in
+             *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+             esac
+           fi
+           func_append tmp_libs " $deplib"
+         done
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       if test -n "$old_library" &&
+          { test yes = "$prefer_static_libs" ||
+            test built,no = "$prefer_static_libs,$installed"; }; then
+         linklib=$old_library
+       else
+         for l in $old_library $library_names; do
+           linklib=$l
+         done
+       fi
+       if test -z "$linklib"; then
+         func_fatal_error "cannot find name of link library for '$lib'"
+       fi
+
+       # This library was specified with -dlopen.
+       if test dlopen = "$pass"; then
+         test -z "$libdir" \
+           && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
+         if test -z "$dlname" ||
+            test yes != "$dlopen_support" ||
+            test no = "$build_libtool_libs"
+         then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           func_append dlprefiles " $lib $dependency_libs"
+         else
+           func_append newdlfiles " $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           func_warning "cannot determine absolute directory name of '$ladir'"
+           func_warning "passing it literally to the linker, although it might fail"
+           abs_ladir=$ladir
+         fi
+         ;;
+       esac
+       func_basename "$lib"
+       laname=$func_basename_result
+
+       # Find the relevant object directory and library name.
+       if test yes = "$installed"; then
+         if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           func_warning "library '$lib' was moved."
+           dir=$ladir
+           absdir=$abs_ladir
+           libdir=$abs_ladir
+         else
+           dir=$lt_sysroot$libdir
+           absdir=$lt_sysroot$libdir
+         fi
+         test yes = "$hardcode_automatic" && avoidtemprpath=yes
+       else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           dir=$ladir
+           absdir=$abs_ladir
+           # Remove this search path later
+           func_append notinst_path " $abs_ladir"
+         else
+           dir=$ladir/$objdir
+           absdir=$abs_ladir/$objdir
+           # Remove this search path later
+           func_append notinst_path " $abs_ladir"
+         fi
+       fi # $installed = yes
+       func_stripname 'lib' '.la' "$laname"
+       name=$func_stripname_result
+
+       # This library was specified with -dlpreopen.
+       if test dlpreopen = "$pass"; then
+         if test -z "$libdir" && test prog = "$linkmode"; then
+           func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
+         fi
+         case $host in
+           # special handling for platforms with PE-DLLs.
+           *cygwin* | *mingw* | *cegcc* )
+             # Linker will automatically link against shared library if both
+             # static and shared are present.  Therefore, ensure we extract
+             # symbols from the import library if a shared library is present
+             # (otherwise, the dlopen module name will be incorrect).  We do
+             # this by putting the import library name into $newdlprefiles.
+             # We recover the dlopen module name by 'saving' the la file
+             # name in a special purpose variable, and (later) extracting the
+             # dlname from the la file.
+             if test -n "$dlname"; then
+               func_tr_sh "$dir/$linklib"
+               eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+               func_append newdlprefiles " $dir/$linklib"
+             else
+               func_append newdlprefiles " $dir/$old_library"
+               # Keep a list of preopened convenience libraries to check
+               # that they are being used correctly in the link pass.
+               test -z "$libdir" && \
+                 func_append dlpreconveniencelibs " $dir/$old_library"
+             fi
+           ;;
+           * )
+             # Prefer using a static library (so that no silly _DYNAMIC symbols
+             # are required to link).
+             if test -n "$old_library"; then
+               func_append newdlprefiles " $dir/$old_library"
+               # Keep a list of preopened convenience libraries to check
+               # that they are being used correctly in the link pass.
+               test -z "$libdir" && \
+                 func_append dlpreconveniencelibs " $dir/$old_library"
+             # Otherwise, use the dlname, so that lt_dlopen finds it.
+             elif test -n "$dlname"; then
+               func_append newdlprefiles " $dir/$dlname"
+             else
+               func_append newdlprefiles " $dir/$linklib"
+             fi
+           ;;
+         esac
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test lib = "$linkmode"; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test prog,link = "$linkmode,$pass"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test prog = "$linkmode" && test link != "$pass"; then
+         func_append newlib_search_path " $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=false
+         if test no != "$link_all_deplibs" || test -z "$library_names" ||
+            test no = "$build_libtool_libs"; then
+           linkalldeplibs=:
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) func_stripname '-L' '' "$deplib"
+                func_resolve_sysroot "$func_stripname_result"
+                func_append newlib_search_path " $func_resolve_sysroot_result"
+                ;;
+           esac
+           # Need to link against all dependency_libs?
+           if $linkalldeplibs; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if $opt_preserve_dup_deps; then
+             case "$tmp_libs " in
+             *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+             esac
+           fi
+           func_append tmp_libs " $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test prog,link = "$linkmode,$pass"; then
+         if test -n "$library_names" &&
+            { { test no = "$prefer_static_libs" ||
+                test built,yes = "$prefer_static_libs,$installed"; } ||
+              test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
+             # Make sure the rpath contains only unique directories.
+             case $temp_rpath: in
+             *"$absdir:"*) ;;
+             *) func_append temp_rpath "$absdir:" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) func_append compile_rpath " $absdir" ;;
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) func_append finalize_rpath " $libdir" ;;
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if $alldeplibs &&
+            { test pass_all = "$deplibs_check_method" ||
+              { test yes = "$build_libtool_libs" &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       use_static_libs=$prefer_static_libs
+       if test built = "$use_static_libs" && test yes = "$installed"; then
+         use_static_libs=no
+       fi
+       if test -n "$library_names" &&
+          { test no = "$use_static_libs" || test -z "$old_library"; }; then
+         case $host in
+         *cygwin* | *mingw* | *cegcc* | *os2*)
+             # No point in relinking DLLs because paths are not encoded
+             func_append notinst_deplibs " $lib"
+             need_relink=no
+           ;;
+         *)
+           if test no = "$installed"; then
+             func_append notinst_deplibs " $lib"
+             need_relink=yes
+           fi
+           ;;
+         esac
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on some
+         # systems (darwin).  Don't bleat about dlopened modules though!
+         dlopenmodule=
+         for dlpremoduletest in $dlprefiles; do
+           if test "X$dlpremoduletest" = "X$lib"; then
+             dlopenmodule=$dlpremoduletest
+             break
+           fi
+         done
+         if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
+           echo
+           if test prog = "$linkmode"; then
+             $ECHO "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $ECHO "*** $linklib is not portable!"
+         fi
+         if test lib = "$linkmode" &&
+            test yes = "$hardcode_into_libs"; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) func_append compile_rpath " $absdir" ;;
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) func_append finalize_rpath " $libdir" ;;
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           shift
+           realname=$1
+           shift
+           libname=`eval "\\$ECHO \"$libname_spec\""`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname=$dlname
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw* | *cegcc* | *os2*)
+               func_arith $current - $age
+               major=$func_arith_result
+               versuffix=-$major
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname=$realname
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot=$soname
+           func_basename "$soroot"
+           soname=$func_basename_result
+           func_stripname 'lib' '.dll' "$soname"
+           newlib=libimp-$func_stripname_result.a
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             func_verbose "extracting exported symbol list from '$soname'"
+             func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             func_verbose "generating import library for '$soname'"
+             func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test prog = "$linkmode" || test relink != "$opt_mode"; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test no = "$hardcode_direct"; then
+               add=$dir/$linklib
+               case $host in
+                 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
+                 *-*-sysv4*uw2*) add_dir=-L$dir ;;
+                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+                   *-*-unixware7*) add_dir=-L$dir ;;
+                 *-*-darwin* )
+                   # if the lib is a (non-dlopened) module then we cannot
+                   # link against it, someone is ignoring the earlier warnings
+                   if /usr/bin/file -L $add 2> /dev/null |
+                        $GREP ": [^:]* bundle" >/dev/null; then
+                     if test "X$dlopenmodule" != "X$lib"; then
+                       $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+                       if test -z "$old_library"; then
+                         echo
+                         echo "*** And there doesn't seem to be a static archive available"
+                         echo "*** The link will probably fail, sorry"
+                       else
+                         add=$dir/$old_library
+                       fi
+                     elif test -n "$old_library"; then
+                       add=$dir/$old_library
+                     fi
+                   fi
+               esac
+             elif test no = "$hardcode_minus_L"; then
+               case $host in
+               *-*-sunos*) add_shlibpath=$dir ;;
+               esac
+               add_dir=-L$dir
+               add=-l$name
+             elif test no = "$hardcode_shlibpath_var"; then
+               add_shlibpath=$dir
+               add=-l$name
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test yes = "$hardcode_direct" &&
+                test no = "$hardcode_direct_absolute"; then
+               add=$dir/$linklib
+             elif test yes = "$hardcode_minus_L"; then
+               add_dir=-L$absdir
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case $libdir in
+                   [\\/]*)
+                     func_append add_dir " -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add=-l$name
+             elif test yes = "$hardcode_shlibpath_var"; then
+               add_shlibpath=$dir
+               add=-l$name
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test yes != "$lib_linked"; then
+             func_fatal_configuration "unsupported hardcode properties"
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) func_append compile_shlibpath "$add_shlibpath:" ;;
+             esac
+           fi
+           if test prog = "$linkmode"; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test yes != "$hardcode_direct" &&
+                test yes != "$hardcode_minus_L" &&
+                test yes = "$hardcode_shlibpath_var"; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) func_append finalize_shlibpath "$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test prog = "$linkmode" || test relink = "$opt_mode"; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test yes = "$hardcode_direct" &&
+              test no = "$hardcode_direct_absolute"; then
+             add=$libdir/$linklib
+           elif test yes = "$hardcode_minus_L"; then
+             add_dir=-L$libdir
+             add=-l$name
+           elif test yes = "$hardcode_shlibpath_var"; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) func_append finalize_shlibpath "$libdir:" ;;
+             esac
+             add=-l$name
+           elif test yes = "$hardcode_automatic"; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib"; then
+               add=$inst_prefix_dir$libdir/$linklib
+             else
+               add=$libdir/$linklib
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir=-L$libdir
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+                 [\\/]*)
+                   func_append add_dir " -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add=-l$name
+           fi
+
+           if test prog = "$linkmode"; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test prog = "$linkmode"; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test unsupported != "$hardcode_direct"; then
+           test -n "$old_library" && linklib=$old_library
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test yes = "$build_libtool_libs"; then
+         # Not a shared library
+         if test pass_all != "$deplibs_check_method"; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           echo
+           $ECHO "*** Warning: This system cannot link to static lib archive $lib."
+           echo "*** I have the capability to make that library automatically link in when"
+           echo "*** you link to this library.  But I can only do this if you have a"
+           echo "*** shared version of the library, which you do not appear to have."
+           if test yes = "$module"; then
+             echo "*** But as you try to build a module library, libtool will still create "
+             echo "*** a static module, that should work as long as the dlopening application"
+             echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               echo
+               echo "*** However, this would only work if libtool was able to extract symbol"
+               echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
+               echo "*** not find such a program.  So, this module is probably useless."
+               echo "*** 'nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test no = "$build_old_libs"; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test lib = "$linkmode"; then
+         if test -n "$dependency_libs" &&
+            { test yes != "$hardcode_into_libs" ||
+              test yes = "$build_old_libs" ||
+              test yes = "$link_static"; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) func_stripname '-R' '' "$libdir"
+                  temp_xrpath=$func_stripname_result
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) func_append xrpath " $temp_xrpath";;
+                  esac;;
+             *) func_append temp_deplibs " $libdir";;
+             esac
+           done
+           dependency_libs=$temp_deplibs
+         fi
+
+         func_append newlib_search_path " $absdir"
+         # Link against this library
+         test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+           if $opt_preserve_dup_deps; then
+             case "$tmp_libs " in
+             *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+             esac
+           fi
+           func_append tmp_libs " $func_resolve_sysroot_result"
+         done
+
+         if test no != "$link_all_deplibs"; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             path=
+             case $deplib in
+             -L*) path=$deplib ;;
+             *.la)
+               func_resolve_sysroot "$deplib"
+               deplib=$func_resolve_sysroot_result
+               func_dirname "$deplib" "" "."
+               dir=$func_dirname_result
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   func_warning "cannot determine absolute directory name of '$dir'"
+                   absdir=$dir
+                 fi
+                 ;;
+               esac
+               if $GREP "^installed=no" $deplib > /dev/null; then
+               case $host in
+               *-*-darwin*)
+                 depdepl=
+                 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names"; then
+                   for tmp in $deplibrary_names; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$absdir/$objdir/$depdepl"; then
+                     depdepl=$absdir/$objdir/$depdepl
+                     darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+                     func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
+                     func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
+                     path=
+                   fi
+                 fi
+                 ;;
+               *)
+                 path=-L$absdir/$objdir
+                 ;;
+               esac
+               else
+                 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 test -z "$libdir" && \
+                   func_fatal_error "'$deplib' is not a valid libtool archive"
+                 test "$absdir" != "$libdir" && \
+                   func_warning "'$deplib' seems to be moved"
+
+                 path=-L$absdir
+               fi
+               ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$path $deplibs" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      if test link = "$pass"; then
+       if test prog = "$linkmode"; then
+         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+       else
+         compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       fi
+      fi
+      dependency_libs=$newdependency_libs
+      if test dlpreopen = "$pass"; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test dlopen != "$pass"; then
+       test conv = "$pass" || {
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) func_append lib_search_path " $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       }
+
+       if test prog,link = "$linkmode,$pass"; then
+         vars="compile_deplibs finalize_deplibs"
+       else
+         vars=deplibs
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) func_append tmp_libs " $deplib" ;;
+             esac
+             ;;
+           *) func_append tmp_libs " $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+
+      # Add Sun CC postdeps if required:
+      test CXX = "$tagname" && {
+        case $host_os in
+        linux*)
+          case `$CC -V 2>&1 | sed 5q` in
+          *Sun\ C*) # Sun C++ 5.9
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+
+        solaris*)
+          func_cc_basename "$CC"
+          case $func_cc_basename_result in
+          CC* | sunCC*)
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+        esac
+      }
+
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=
+         ;;
+       esac
+       if test -n "$i"; then
+         func_append tmp_libs " $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test prog = "$linkmode"; then
+      dlfiles=$newdlfiles
+    fi
+    if test prog = "$linkmode" || test lib = "$linkmode"; then
+      dlprefiles=$newdlprefiles
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+       func_warning "'-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "'-l' and '-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "'-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+       func_warning "'-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+       func_warning "'-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+       func_warning "'-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+       func_warning "'-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs=$output
+      func_append objs "$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form 'libNAME.la'.
+      case $outputname in
+      lib*)
+       func_stripname 'lib' '.la' "$outputname"
+       name=$func_stripname_result
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       test no = "$module" \
+         && func_fatal_help "libtool library '$output' must begin with 'lib'"
+
+       if test no != "$need_lib_prefix"; then
+         # Add the "lib" prefix for modules if required
+         func_stripname '' '.la' "$outputname"
+         name=$func_stripname_result
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         func_stripname '' '.la' "$outputname"
+         libname=$func_stripname_result
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test pass_all != "$deplibs_check_method"; then
+         func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
+       else
+         echo
+         $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+         $ECHO "*** objects $objs is not portable!"
+         func_append libobjs " $objs"
+       fi
+      fi
+
+      test no = "$dlself" \
+       || func_warning "'-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test 1 -lt "$#" \
+       && func_warning "ignoring multiple '-rpath's for a libtool library"
+
+      install_libdir=$1
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test yes = "$build_libtool_libs"; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a '.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       test -n "$vinfo" && \
+         func_warning "'-version-info/-version-number' is ignored for convenience libraries"
+
+       test -n "$release" && \
+         func_warning "'-release' is ignored for convenience libraries"
+      else
+
+       # Parse the version information argument.
+       save_ifs=$IFS; IFS=:
+       set dummy $vinfo 0 0 0
+       shift
+       IFS=$save_ifs
+
+       test -n "$7" && \
+         func_fatal_help "too many parameters to '-version-info'"
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major=$1
+         number_minor=$2
+         number_revision=$3
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # that has an extra 1 added just for fun
+         #
+         case $version_type in
+         # correct linux to gnu/linux during the next big refactor
+         darwin|freebsd-elf|linux|osf|windows|none)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age=$number_minor
+           revision=$number_revision
+           ;;
+         freebsd-aout|qnx|sunos)
+           current=$number_major
+           revision=$number_minor
+           age=0
+           ;;
+         irix|nonstopux)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age=$number_minor
+           revision=$number_minor
+           lt_irix_increment=no
+           ;;
+         esac
+         ;;
+       no)
+         current=$1
+         revision=$2
+         age=$3
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "CURRENT '$current' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $revision in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "REVISION '$revision' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $age in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "AGE '$age' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         func_error "AGE '$age' is greater than the current interface number '$current'"
+         func_fatal_error "'$vinfo' is not valid version information"
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=$major.$age.$revision
+         # Darwin ld doesn't like 0 for these options...
+         func_arith $current + 1
+         minor_current=$func_arith_result
+         xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
+         verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+          # On Darwin other compilers
+          case $CC in
+              nagfor*)
+                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
+                  ;;
+              *)
+                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+                  ;;
+          esac
+         ;;
+
+       freebsd-aout)
+         major=.$current
+         versuffix=.$current.$revision
+         ;;
+
+       freebsd-elf)
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=$major.$age.$revision
+         ;;
+
+       irix | nonstopux)
+         if test no = "$lt_irix_increment"; then
+           func_arith $current - $age
+         else
+           func_arith $current - $age + 1
+         fi
+         major=$func_arith_result
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring=$verstring_prefix$major.$revision
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test 0 -ne "$loop"; do
+           func_arith $revision - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring=$verstring_prefix$major.$iface:$verstring
+         done
+
+         # Before this point, $major must not contain '.'.
+         major=.$major
+         versuffix=$major.$revision
+         ;;
+
+       linux) # correct to gnu/linux during the next big refactor
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=$major.$age.$revision
+         ;;
+
+       osf)
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=.$current.$age.$revision
+         verstring=$current.$age.$revision
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test 0 -ne "$loop"; do
+           func_arith $current - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring=$verstring:$iface.0
+         done
+
+         # Make executables depend on our current version.
+         func_append verstring ":$current.0"
+         ;;
+
+       qnx)
+         major=.$current
+         versuffix=.$current
+         ;;
+
+       sco)
+         major=.$current
+         versuffix=.$current
+         ;;
+
+       sunos)
+         major=.$current
+         versuffix=.$current.$revision
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 file systems.
+         func_arith $current - $age
+         major=$func_arith_result
+         versuffix=-$major
+         ;;
+
+       *)
+         func_fatal_configuration "unknown library version type '$version_type'"
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring=0.0
+           ;;
+         esac
+         if test no = "$need_version"; then
+           versuffix=
+         else
+           versuffix=.0.0
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test yes,no = "$avoid_version,$need_version"; then
+         major=
+         versuffix=
+         verstring=
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test yes = "$allow_undefined"; then
+         if test unsupported = "$allow_undefined_flag"; then
+           if test yes = "$build_old_libs"; then
+             func_warning "undefined symbols not allowed in $host shared libraries; building static only"
+             build_libtool_libs=no
+           else
+             func_fatal_error "can't build $host shared library unless -no-undefined is specified"
+           fi
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag=$no_undefined_flag
+       fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" :
+      func_append libobjs " $symfileobj"
+      test " " = "$libobjs" && libobjs=
+
+      if test relink != "$opt_mode"; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$ECHO "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext | *.gcno)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
+              if test -n "$precious_files_regex"; then
+                if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              func_append removelist " $p"
+              ;;
+           *) ;;
+         esac
+       done
+       test -n "$removelist" && \
+         func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
+       func_append oldlibs " $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #        lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #        deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #        dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         func_replace_sysroot "$libdir"
+         func_append temp_xrpath " -R$func_replace_sysroot_result"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_rpath " $libdir" ;;
+         esac
+       done
+       if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles=$dlfiles
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) func_append dlfiles " $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles=$dlprefiles
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) func_append dlprefiles " $lib" ;;
+       esac
+      done
+
+      if test yes = "$build_libtool_libs"; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           func_append deplibs " System.ltframework"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test yes = "$build_libtool_need_lc"; then
+             func_append deplibs " -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=
+       versuffix=
+       major=
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $opt_dry_run || $RM conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $opt_dry_run || $RM conftest
+         if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   func_append newdeplibs " $i"
+                   i=
+                   ;;
+                 esac
+               fi
+               if test -n "$i"; then
+                 libname=`eval "\\$ECHO \"$libname_spec\""`
+                 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                 set dummy $deplib_matches; shift
+                 deplib_match=$1
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
+                   func_append newdeplibs " $i"
+                 else
+                   droppeddeps=yes
+                   echo
+                   $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                   echo "*** I have the capability to make that library automatically link in when"
+                   echo "*** you link to this library.  But I can only do this if you have a"
+                   echo "*** shared version of the library, which I believe you do not have"
+                   echo "*** because a test_compile did reveal that the linker did not use it for"
+                   echo "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+               ;;
+             *)
+               func_append newdeplibs " $i"
+               ;;
+             esac
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               $opt_dry_run || $RM conftest
+               if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+                 ldd_output=`ldd conftest`
+                 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     func_append newdeplibs " $i"
+                     i=
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i"; then
+                   libname=`eval "\\$ECHO \"$libname_spec\""`
+                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                   set dummy $deplib_matches; shift
+                   deplib_match=$1
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
+                     func_append newdeplibs " $i"
+                   else
+                     droppeddeps=yes
+                     echo
+                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                     echo "*** I have the capability to make that library automatically link in when"
+                     echo "*** you link to this library.  But I can only do this if you have a"
+                     echo "*** shared version of the library, which you do not appear to have"
+                     echo "*** because a test_compile did reveal that the linker did not use this one"
+                     echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 echo
+                 $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+                 echo "*** make it link in!  You will probably need to install it or some"
+                 echo "*** library that it depends on before this library will be fully"
+                 echo "*** functional.  Installing it before continuing would be even better."
+               fi
+               ;;
+             *)
+               func_append newdeplibs " $i"
+               ;;
+             esac
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method; shift
+         file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 func_append newdeplibs " $a_deplib"
+                 a_deplib=
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib"; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               if test -n "$file_magic_glob"; then
+                 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+               else
+                 libnameglob=$libname
+               fi
+               test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 if test yes = "$want_nocaseglob"; then
+                   shopt -s nocaseglob
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                   $nocaseglob
+                 else
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                 fi
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null |
+                        $GREP " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib=$potent_lib
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
+                       *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+                        $SED -e 10q |
+                        $EGREP "$file_magic_regex" > /dev/null; then
+                       func_append newdeplibs " $a_deplib"
+                       a_deplib=
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib"; then
+               droppeddeps=yes
+               echo
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib"; then
+                 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             func_append newdeplibs " $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method; shift
+         match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 func_append newdeplibs " $a_deplib"
+                 a_deplib=
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib"; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib=$potent_lib # see symlink-check above in file_magic test
+                   if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+                      $EGREP "$match_pattern_regex" > /dev/null; then
+                     func_append newdeplibs " $a_deplib"
+                     a_deplib=
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib"; then
+               droppeddeps=yes
+               echo
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib"; then
+                 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             func_append newdeplibs " $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=
+         tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+         if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+           for i in $predeps $postdeps; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
+           done
+         fi
+         case $tmp_deplibs in
+         *[!\  \ ]*)
+           echo
+           if test none = "$deplibs_check_method"; then
+             echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           echo "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+           ;;
+         esac
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library with the System framework
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+         ;;
+       esac
+
+       if test yes = "$droppeddeps"; then
+         if test yes = "$module"; then
+           echo
+           echo "*** Warning: libtool could not satisfy all declared inter-library"
+           $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+           echo "*** a static module, that should work as long as the dlopening"
+           echo "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             echo
+             echo "*** However, this would only work if libtool was able to extract symbol"
+             echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
+             echo "*** not find such a program.  So, this module is probably useless."
+             echo "*** 'nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test no = "$build_old_libs"; then
+             oldlibs=$output_objdir/$libname.$libext
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           echo "*** The inter-library dependencies that have been dropped here will be"
+           echo "*** automatically added whenever a program is linked with this library"
+           echo "*** or is declared to -dlopen it."
+
+           if test no = "$allow_undefined"; then
+             echo
+             echo "*** Since this library must not contain undefined symbols,"
+             echo "*** because either the platform does not support them or"
+             echo "*** it was explicitly requested with -no-undefined,"
+             echo "*** libtool will only create a static version of it."
+             if test no = "$build_old_libs"; then
+               oldlibs=$output_objdir/$libname.$libext
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+       *-*-darwin*)
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           func_append new_libs " -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) func_append new_libs " $deplib" ;;
+         esac
+         ;;
+       *) func_append new_libs " $deplib" ;;
+       esac
+      done
+      deplibs=$new_libs
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test yes = "$build_libtool_libs"; then
+       # Remove $wl instances when linking with ld.
+       # FIXME: should test the right _cmds variable.
+       case $archive_cmds in
+         *\$LD\ *) wl= ;;
+        esac
+       if test yes = "$hardcode_into_libs"; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath=$finalize_rpath
+         test relink = "$opt_mode" || rpath=$compile_rpath$rpath
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               func_replace_sysroot "$libdir"
+               libdir=$func_replace_sysroot_result
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs=$libdir
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               func_append dep_rpath " $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) func_append perm_rpath " $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir=$hardcode_libdirs
+           eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             func_append rpath "$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath=$finalize_shlibpath
+       test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       shift
+       realname=$1
+       shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname=$realname
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib=$output_objdir/$realname
+       linknames=
+       for link
+       do
+         func_append linknames " $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+       test "X$libobjs" = "X " && libobjs=
+
+       delfiles=
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+         export_symbols=$output_objdir/$libname.uexp
+         func_append delfiles " $export_symbols"
+       fi
+
+       orig_export_symbols=
+       case $host_os in
+       cygwin* | mingw* | cegcc*)
+         if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+           # exporting using user supplied symfile
+           func_dll_def_p "$export_symbols" || {
+             # and it's NOT already a .def file. Must figure out
+             # which of the given symbols are data symbols and tag
+             # them as such. So, trigger use of export_symbols_cmds.
+             # export_symbols gets reassigned inside the "prepare
+             # the list of exported symbols" if statement, so the
+             # include_expsyms logic still works.
+             orig_export_symbols=$export_symbols
+             export_symbols=
+             always_export_symbols=yes
+           }
+         fi
+         ;;
+       esac
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
+           func_verbose "generating symbol list for '$libname.la'"
+           export_symbols=$output_objdir/$libname.exp
+           $opt_dry_run || $RM $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs=$IFS; IFS='~'
+           for cmd1 in $cmds; do
+             IFS=$save_ifs
+             # Take the normal branch if the nm_file_list_spec branch
+             # doesn't work or if tool conversion is not needed.
+             case $nm_file_list_spec~$to_tool_file_cmd in
+               *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+                 try_normal_branch=yes
+                 eval cmd=\"$cmd1\"
+                 func_len " $cmd"
+                 len=$func_len_result
+                 ;;
+               *)
+                 try_normal_branch=no
+                 ;;
+             esac
+             if test yes = "$try_normal_branch" \
+                && { test "$len" -lt "$max_cmd_len" \
+                     || test "$max_cmd_len" -le -1; }
+             then
+               func_show_eval "$cmd" 'exit $?'
+               skipped_export=false
+             elif test -n "$nm_file_list_spec"; then
+               func_basename "$output"
+               output_la=$func_basename_result
+               save_libobjs=$libobjs
+               save_output=$output
+               output=$output_objdir/$output_la.nm
+               func_to_tool_file "$output"
+               libobjs=$nm_file_list_spec$func_to_tool_file_result
+               func_append delfiles " $output"
+               func_verbose "creating $NM input file list: $output"
+               for obj in $save_libobjs; do
+                 func_to_tool_file "$obj"
+                 $ECHO "$func_to_tool_file_result"
+               done > "$output"
+               eval cmd=\"$cmd1\"
+               func_show_eval "$cmd" 'exit $?'
+               output=$save_output
+               libobjs=$save_libobjs
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               func_verbose "using reloadable object file for export list..."
+               skipped_export=:
+               # Break out early, otherwise skipped_export may be
+               # set to false by a later but shorter cmd.
+               break
+             fi
+           done
+           IFS=$save_ifs
+           if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         tmp_export_symbols=$export_symbols
+         test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
+         $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+       fi
+
+       if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
+         # The given exports_symbols file has to be filtered, so filter it.
+         func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
+         # FIXME: $output_objdir/$libname.filter potentially contains lots of
+         # 's' commands, which not all seds can handle. GNU sed should be fine
+         # though. Also, the filter scales superlinearly with the number of
+         # global variables. join(1) would be nice here, but unfortunately
+         # isn't a blessed tool.
+         $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+         func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+         export_symbols=$output_objdir/$libname.def
+         $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+         case " $convenience " in
+         *" $test_deplib "*) ;;
+         *)
+           func_append tmp_deplibs " $test_deplib"
+           ;;
+         esac
+       done
+       deplibs=$tmp_deplibs
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec" &&
+           test yes = "$compiler_needs_object" &&
+           test -z "$libobjs"; then
+           # extract the archives, so we have objects to list.
+           # TODO: could optimize this to just extract one archive.
+           whole_archive_flag_spec=
+         fi
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         else
+           gentop=$output_objdir/${outputname}x
+           func_append generated " $gentop"
+
+           func_extract_archives $gentop $convenience
+           func_append libobjs " $func_extract_archives_result"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+       fi
+
+       if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         func_append linker_flags " $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test relink = "$opt_mode"; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test yes = "$module" && test -n "$module_cmds"; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           eval test_cmds=\"$archive_expsym_cmds\"
+           cmds=$archive_expsym_cmds
+         else
+           eval test_cmds=\"$archive_cmds\"
+           cmds=$archive_cmds
+         fi
+       fi
+
+       if test : != "$skipped_export" &&
+          func_len " $test_cmds" &&
+          len=$func_len_result &&
+          test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise
+         # or, if using GNU ld and skipped_export is not :, use a linker
+         # script.
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+         func_basename "$output"
+         output_la=$func_basename_result
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         last_robj=
+         k=1
+
+         if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
+           output=$output_objdir/$output_la.lnkscript
+           func_verbose "creating GNU ld script: $output"
+           echo 'INPUT (' > $output
+           for obj in $save_libobjs
+           do
+             func_to_tool_file "$obj"
+             $ECHO "$func_to_tool_file_result" >> $output
+           done
+           echo ')' >> $output
+           func_append delfiles " $output"
+           func_to_tool_file "$output"
+           output=$func_to_tool_file_result
+         elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
+           output=$output_objdir/$output_la.lnk
+           func_verbose "creating linker input file list: $output"
+           : > $output
+           set x $save_libobjs
+           shift
+           firstobj=
+           if test yes = "$compiler_needs_object"; then
+             firstobj="$1 "
+             shift
+           fi
+           for obj
+           do
+             func_to_tool_file "$obj"
+             $ECHO "$func_to_tool_file_result" >> $output
+           done
+           func_append delfiles " $output"
+           func_to_tool_file "$output"
+           output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+         else
+           if test -n "$save_libobjs"; then
+             func_verbose "creating reloadable object files..."
+             output=$output_objdir/$output_la-$k.$objext
+             eval test_cmds=\"$reload_cmds\"
+             func_len " $test_cmds"
+             len0=$func_len_result
+             len=$len0
+
+             # Loop over the list of objects to be linked.
+             for obj in $save_libobjs
+             do
+               func_len " $obj"
+               func_arith $len + $func_len_result
+               len=$func_arith_result
+               if test -z "$objlist" ||
+                  test "$len" -lt "$max_cmd_len"; then
+                 func_append objlist " $obj"
+               else
+                 # The command $test_cmds is almost too long, add a
+                 # command to the queue.
+                 if test 1 -eq "$k"; then
+                   # The first file doesn't have a previous command to add.
+                   reload_objs=$objlist
+                   eval concat_cmds=\"$reload_cmds\"
+                 else
+                   # All subsequent reloadable object files will link in
+                   # the last one created.
+                   reload_objs="$objlist $last_robj"
+                   eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+                 fi
+                 last_robj=$output_objdir/$output_la-$k.$objext
+                 func_arith $k + 1
+                 k=$func_arith_result
+                 output=$output_objdir/$output_la-$k.$objext
+                 objlist=" $obj"
+                 func_len " $last_robj"
+                 func_arith $len0 + $func_len_result
+                 len=$func_arith_result
+               fi
+             done
+             # Handle the remaining objects by creating one last
+             # reloadable object file.  All subsequent reloadable object
+             # files will link in the last one created.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             reload_objs="$objlist $last_robj"
+             eval concat_cmds=\"\$concat_cmds$reload_cmds\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+             fi
+             func_append delfiles " $output"
+
+           else
+             output=
+           fi
+
+           ${skipped_export-false} && {
+             func_verbose "generating symbol list for '$libname.la'"
+             export_symbols=$output_objdir/$libname.exp
+             $opt_dry_run || $RM $export_symbols
+             libobjs=$output
+             # Append the command to create the export file.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+             fi
+           }
+
+           test -n "$save_libobjs" &&
+             func_verbose "creating a temporary reloadable object file: $output"
+
+           # Loop through the commands generated above and execute them.
+           save_ifs=$IFS; IFS='~'
+           for cmd in $concat_cmds; do
+             IFS=$save_ifs
+             $opt_quiet || {
+                 func_quote_for_expand "$cmd"
+                 eval "func_echo $func_quote_for_expand_result"
+             }
+             $opt_dry_run || eval "$cmd" || {
+               lt_exit=$?
+
+               # Restore the uninstalled library and exit
+               if test relink = "$opt_mode"; then
+                 ( cd "$output_objdir" && \
+                   $RM "${realname}T" && \
+                   $MV "${realname}U" "$realname" )
+               fi
+
+               exit $lt_exit
+             }
+           done
+           IFS=$save_ifs
+
+           if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+
+          ${skipped_export-false} && {
+           if test -n "$export_symbols" && test -n "$include_expsyms"; then
+             tmp_export_symbols=$export_symbols
+             test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
+             $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+           fi
+
+           if test -n "$orig_export_symbols"; then
+             # The given exports_symbols file has to be filtered, so filter it.
+             func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
+             # FIXME: $output_objdir/$libname.filter potentially contains lots of
+             # 's' commands, which not all seds can handle. GNU sed should be fine
+             # though. Also, the filter scales superlinearly with the number of
+             # global variables. join(1) would be nice here, but unfortunately
+             # isn't a blessed tool.
+             $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+             func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+             export_symbols=$output_objdir/$libname.def
+             $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+           fi
+         }
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test yes = "$module" && test -n "$module_cmds"; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+             cmds=$archive_expsym_cmds
+           else
+             cmds=$archive_cmds
+           fi
+         fi
+       fi
+
+       if test -n "$delfiles"; then
+         # Append the command to remove temporary files to $cmds.
+         eval cmds=\"\$cmds~\$RM $delfiles\"
+       fi
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop=$output_objdir/${outputname}x
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         func_append libobjs " $func_extract_archives_result"
+         test "X$libobjs" = "X " && libobjs=
+       fi
+
+       save_ifs=$IFS; IFS='~'
+       for cmd in $cmds; do
+         IFS=$sp$nl
+         eval cmd=\"$cmd\"
+         IFS=$save_ifs
+         $opt_quiet || {
+           func_quote_for_expand "$cmd"
+           eval "func_echo $func_quote_for_expand_result"
+         }
+         $opt_dry_run || eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test relink = "$opt_mode"; then
+             ( cd "$output_objdir" && \
+               $RM "${realname}T" && \
+               $MV "${realname}U" "$realname" )
+           fi
+
+           exit $lt_exit
+         }
+       done
+       IFS=$save_ifs
+
+       # Restore the uninstalled library and exit
+       if test relink = "$opt_mode"; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             func_show_eval '${RM}r "$gentop"'
+           fi
+         fi
+
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test yes = "$module" || test yes = "$export_dynamic"; then
+         # On all known operating systems, these are identical.
+         dlname=$soname
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+       func_warning "'-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "'-l' and '-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "'-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+       func_warning "'-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+       func_warning "'-version-info' is ignored for objects"
+
+      test -n "$release" && \
+       func_warning "'-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+       test -n "$objs$old_deplibs" && \
+         func_fatal_error "cannot build library object '$output' from non-libtool objects"
+
+       libobj=$output
+       func_lo2o "$libobj"
+       obj=$func_lo2o_result
+       ;;
+      *)
+       libobj=
+       obj=$output
+       ;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # if reload_cmds runs $LD directly, get rid of -Wl from
+      # whole_archive_flag_spec and hope we can get by with turning comma
+      # into space.
+      case $reload_cmds in
+        *\$LD[\ \$]*) wl= ;;
+      esac
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+         test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+         reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
+       else
+         gentop=$output_objdir/${obj}x
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $convenience
+         reload_conv_objs="$reload_objs $func_extract_archives_result"
+       fi
+      fi
+
+      # If we're not building shared, we need to use non_pic_objs
+      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
+
+      # Create the old-style object.
+      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
+
+      output=$obj
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      test yes = "$build_libtool_libs" || {
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      }
+
+      if test -n "$pic_flag" || test default != "$pic_mode"; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output=$libobj
+       func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+       func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) func_stripname '' '.exe' "$output"
+                 output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+       func_warning "'-version-info' is ignored for programs"
+
+      test -n "$release" && \
+       func_warning "'-release' is ignored for programs"
+
+      $preload \
+       && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
+       && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+       ;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+       # Don't allow lazy linking, it breaks C++ global constructors
+       # But is supposedly fixed on 10.4 or later (yay!).
+       if test CXX = "$tagname"; then
+         case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+           10.[0123])
+             func_append compile_command " $wl-bind_at_load"
+             func_append finalize_command " $wl-bind_at_load"
+           ;;
+         esac
+       fi
+       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           func_append new_libs " -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) func_append new_libs " $deplib" ;;
+         esac
+         ;;
+       *) func_append new_libs " $deplib" ;;
+       esac
+      done
+      compile_deplibs=$new_libs
+
+
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_rpath " $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs=$libdir
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           func_append rpath " $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) func_append perm_rpath " $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         ::) dllsearchpath=$libdir;;
+         *) func_append dllsearchpath ":$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) func_append dllsearchpath ":$testbindir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir=$hardcode_libdirs
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath=$rpath
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs=$libdir
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           func_append rpath " $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) func_append finalize_perm_rpath " $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir=$hardcode_libdirs
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath=$rpath
+
+      if test -n "$libobjs" && test yes = "$build_old_libs"; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+       finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" false
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+       func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=:
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=false
+        ;;
+      *cygwin* | *mingw* )
+        test yes = "$build_libtool_libs" || wrappers_required=false
+        ;;
+      *)
+        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
+          wrappers_required=false
+        fi
+        ;;
+      esac
+      $wrappers_required || {
+       # Replace the output file specification.
+       compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+       link_command=$compile_command$compile_rpath
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       exit_status=0
+       func_show_eval "$link_command" 'exit_status=$?'
+
+       if test -n "$postlink_cmds"; then
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+         func_execute_cmds "$postlink_cmds" 'exit $?'
+       fi
+
+       # Delete the generated files.
+       if test -f "$output_objdir/${outputname}S.$objext"; then
+         func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
+       fi
+
+       exit $exit_status
+      }
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           func_append rpath "$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           func_append rpath "$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test yes = "$no_install"; then
+       # We don't need to create a wrapper script.
+       link_command=$compile_var$compile_command$compile_rpath
+       # Replace the output file specification.
+       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $opt_dry_run || $RM $output
+       # Link the executable and exit
+       func_show_eval "$link_command" 'exit $?'
+
+       if test -n "$postlink_cmds"; then
+         func_to_tool_file "$output"
+         postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+         func_execute_cmds "$postlink_cmds" 'exit $?'
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      case $hardcode_action,$fast_install in
+        relink,*)
+         # Fast installation is not supported
+         link_command=$compile_var$compile_command$compile_rpath
+         relink_command=$finalize_var$finalize_command$finalize_rpath
+
+         func_warning "this platform does not like uninstalled shared libraries"
+         func_warning "'$output' will be relinked during installation"
+         ;;
+        *,yes)
+         link_command=$finalize_var$compile_command$finalize_rpath
+         relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+          ;;
+       *,no)
+         link_command=$compile_var$compile_command$compile_rpath
+         relink_command=$finalize_var$finalize_command$finalize_rpath
+          ;;
+       *,needless)
+         link_command=$finalize_var$compile_command$finalize_rpath
+         relink_command=
+          ;;
+      esac
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      if test -n "$postlink_cmds"; then
+       func_to_tool_file "$output_objdir/$outputname"
+       postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+       func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           func_quote_for_eval "$var_value"
+           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) func_stripname '' '.exe' "$output"
+                output=$func_stripname_result ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           func_stripname '' '.exe' "$outputname"
+           outputname=$func_stripname_result ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+           func_dirname_and_basename "$output" "" "."
+           output_name=$func_basename_result
+           output_path=$func_dirname_result
+           cwrappersource=$output_path/$objdir/lt-$output_name.c
+           cwrapper=$output_path/$output_name.exe
+           $RM $cwrappersource $cwrapper
+           trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_cwrapperexe_src > $cwrappersource
+
+           # The wrapper executable is built using the $host compiler,
+           # because it contains $host paths and files. If cross-
+           # compiling, it, like the target executable, must be
+           # executed on the $host or under an emulation environment.
+           $opt_dry_run || {
+             $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+             $STRIP $cwrapper
+           }
+
+           # Now, create the wrapper script for func_source use:
+           func_ltwrapper_scriptname $cwrapper
+           $RM $func_ltwrapper_scriptname_result
+           trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+           $opt_dry_run || {
+             # note: this script will not be executed, so do not chmod.
+             if test "x$build" = "x$host"; then
+               $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+             else
+               func_emit_wrapper no > $func_ltwrapper_scriptname_result
+             fi
+           }
+         ;;
+         * )
+           $RM $output
+           trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_wrapper no > $output
+           chmod +x $output
+         ;;
+       esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      case $build_libtool_libs in
+        convenience)
+         oldobjs="$libobjs_save $symfileobj"
+         addlibs=$convenience
+         build_libtool_libs=no
+         ;;
+       module)
+         oldobjs=$libobjs_save
+         addlibs=$old_convenience
+         build_libtool_libs=no
+          ;;
+       *)
+         oldobjs="$old_deplibs $non_pic_objects"
+         $preload && test -f "$symfileobj" \
+           && func_append oldobjs " $symfileobj"
+         addlibs=$old_convenience
+         ;;
+      esac
+
+      if test -n "$addlibs"; then
+       gentop=$output_objdir/${outputname}x
+       func_append generated " $gentop"
+
+       func_extract_archives $gentop $addlibs
+       func_append oldobjs " $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
+       cmds=$old_archive_from_new_cmds
+      else
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop=$output_objdir/${outputname}x
+         func_append generated " $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         func_append oldobjs " $func_extract_archives_result"
+       fi
+
+       # POSIX demands no paths to be encoded in archives.  We have
+       # to avoid creating archives with duplicate basenames if we
+       # might have to extract them afterwards, e.g., when creating a
+       # static archive out of a convenience library, or when linking
+       # the entirety of a libtool archive into another (currently
+       # not supported by libtool).
+       if (for obj in $oldobjs
+           do
+             func_basename "$obj"
+             $ECHO "$func_basename_result"
+           done | sort | sort -uc >/dev/null 2>&1); then
+         :
+       else
+         echo "copying selected object files to avoid basename conflicts..."
+         gentop=$output_objdir/${outputname}x
+         func_append generated " $gentop"
+         func_mkdir_p "$gentop"
+         save_oldobjs=$oldobjs
+         oldobjs=
+         counter=1
+         for obj in $save_oldobjs
+         do
+           func_basename "$obj"
+           objbase=$func_basename_result
+           case " $oldobjs " in
+           " ") oldobjs=$obj ;;
+           *[\ /]"$objbase "*)
+             while :; do
+               # Make sure we don't pick an alternate name that also
+               # overlaps.
+               newobj=lt$counter-$objbase
+               func_arith $counter + 1
+               counter=$func_arith_result
+               case " $oldobjs " in
+               *[\ /]"$newobj "*) ;;
+               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+               esac
+             done
+             func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+             func_append oldobjs " $gentop/$newobj"
+             ;;
+           *) func_append oldobjs " $obj" ;;
+           esac
+         done
+       fi
+       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+       tool_oldlib=$func_to_tool_file_result
+       eval cmds=\"$old_archive_cmds\"
+
+       func_len " $cmds"
+       len=$func_len_result
+       if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       elif test -n "$archiver_list_spec"; then
+         func_verbose "using command file archive linking..."
+         for obj in $oldobjs
+         do
+           func_to_tool_file "$obj"
+           $ECHO "$func_to_tool_file_result"
+         done > $output_objdir/$libname.libcmd
+         func_to_tool_file "$output_objdir/$libname.libcmd"
+         oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         func_verbose "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+         oldobjs=
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         eval test_cmds=\"$old_archive_cmds\"
+         func_len " $test_cmds"
+         len0=$func_len_result
+         len=$len0
+         for obj in $save_oldobjs
+         do
+           func_len " $obj"
+           func_arith $len + $func_len_result
+           len=$func_arith_result
+           func_append objlist " $obj"
+           if test "$len" -lt "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj"; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
+             objlist=
+             len=$len0
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test -z "$oldobjs"; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test yes = "$build_old_libs" && old_library=$libname.$libext
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         func_quote_for_eval "$var_value"
+         relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test yes = "$hardcode_automatic"; then
+       relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+       for installed in no yes; do
+         if test yes = "$installed"; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output=$output_objdir/${outputname}i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               func_basename "$deplib"
+               name=$func_basename_result
+               func_resolve_sysroot "$deplib"
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+               test -z "$libdir" && \
+                 func_fatal_error "'$deplib' is not a valid libtool archive"
+               func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             -L*)
+               func_stripname -L '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -L$func_replace_sysroot_result"
+               ;;
+             -R*)
+               func_stripname -R '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -R$func_replace_sysroot_result"
+               ;;
+             *) func_append newdependency_libs " $deplib" ;;
+             esac
+           done
+           dependency_libs=$newdependency_libs
+           newdlfiles=
+
+           for lib in $dlfiles; do
+             case $lib in
+             *.la)
+               func_basename "$lib"
+               name=$func_basename_result
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "'$lib' is not a valid libtool archive"
+               func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             *) func_append newdlfiles " $lib" ;;
+             esac
+           done
+           dlfiles=$newdlfiles
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+             *.la)
+               # Only pass preopened files to the pseudo-archive (for
+               # eventual linking with the app. that links it) if we
+               # didn't already link the preopened objects directly into
+               # the library:
+               func_basename "$lib"
+               name=$func_basename_result
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "'$lib' is not a valid libtool archive"
+               func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             esac
+           done
+           dlprefiles=$newdlprefiles
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             func_append newdlfiles " $abs"
+           done
+           dlfiles=$newdlfiles
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             func_append newdlprefiles " $abs"
+           done
+           dlprefiles=$newdlprefiles
+         fi
+         $RM $output
+         # place dlname in correct position for cygwin
+         # In fact, it would be nice if we could use this code for all target
+         # systems that can't hard-code library paths into their executables
+         # and that have no shared library path variable independent of PATH,
+         # but it turns out we can't easily determine that from inspecting
+         # libtool variables, so we have to hard-code the OSs to which it
+         # applies here; at the moment, that means platforms that use the PE
+         # object format with DLL files.  See the long comment at the top of
+         # tests/bindir.at for full details.
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+             # If a -bindir argument was supplied, place the dll there.
+             if test -n "$bindir"; then
+               func_relative_path "$install_libdir" "$bindir"
+               tdlname=$func_relative_path_result/$dlname
+             else
+               # Otherwise fall back on heuristic.
+               tdlname=../bin/$dlname
+             fi
+             ;;
+         esac
+         $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that cannot go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test no,yes = "$installed,$need_relink"; then
+           $ECHO >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+if test link = "$opt_mode" || test relink = "$opt_mode"; then
+  func_mode_link ${1+"$@"}
+fi
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $debug_cmd
+
+    RM=$nonopt
+    files=
+    rmforce=false
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic=$magic
+
+    for arg
+    do
+      case $arg in
+      -f) func_append RM " $arg"; rmforce=: ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir=$func_dirname_result
+      if test . = "$dir"; then
+       odir=$objdir
+      else
+       odir=$dir/$objdir
+      fi
+      func_basename "$file"
+      name=$func_basename_result
+      test uninstall = "$opt_mode" && odir=$dir
+
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test clean = "$opt_mode"; then
+       case " $rmdirs " in
+         *" $odir "*) ;;
+         *) func_append rmdirs " $odir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+        { test -h "$file"; } >/dev/null 2>&1 ||
+        test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif $rmforce; then
+       continue
+      fi
+
+      rmfiles=$file
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if func_lalib_p "$file"; then
+         func_source $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           func_append rmfiles " $odir/$n"
+         done
+         test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+         case $opt_mode in
+         clean)
+           case " $library_names " in
+           *" $dlname "*) ;;
+           *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+           esac
+           test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+           ;;
+         uninstall)
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+           ;;
+         esac
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if func_lalib_p "$file"; then
+
+         # Read the .lo file
+         func_source $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" && test none != "$pic_object"; then
+           func_append rmfiles " $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" && test none != "$non_pic_object"; then
+           func_append rmfiles " $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test clean = "$opt_mode"; then
+         noexename=$name
+         case $file in
+         *.exe)
+           func_stripname '' '.exe' "$file"
+           file=$func_stripname_result
+           func_stripname '' '.exe' "$name"
+           noexename=$func_stripname_result
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           func_append rmfiles " $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if func_ltwrapper_p "$file"; then
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             relink_command=
+             func_source $func_ltwrapper_scriptname_result
+             func_append rmfiles " $func_ltwrapper_scriptname_result"
+           else
+             relink_command=
+             func_source $dir/$noexename
+           fi
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           func_append rmfiles " $odir/$name $odir/${name}S.$objext"
+           if test yes = "$fast_install" && test -n "$relink_command"; then
+             func_append rmfiles " $odir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name"; then
+             func_append rmfiles " $odir/lt-$noexename.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+
+    # Try to remove the $objdir's in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
+  func_mode_uninstall ${1+"$@"}
+fi
+
+test -z "$opt_mode" && {
+  help=$generic_help
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode '$opt_mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# where we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/m4/attributes.m4 b/m4/attributes.m4
new file mode 100644 (file)
index 0000000..51ac88b
--- /dev/null
@@ -0,0 +1,292 @@
+dnl Macros to check the presence of generic (non-typed) symbols.
+dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
+dnl Copyright (c) 2006-2008 xine project
+dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
+dnl
+dnl As a special exception, the copyright owners of the
+dnl macro gives unlimited permission to copy, distribute and modify the
+dnl configure scripts that are the output of Autoconf when processing the
+dnl Macro. You need not follow the terms of the GNU General Public
+dnl License when using or distributing such scripts, even though portions
+dnl of the text of the Macro appear in them. The GNU General Public
+dnl License (GPL) does govern all other use of the material that
+dnl constitutes the Autoconf Macro.
+dnl
+dnl This special exception to the GPL applies to versions of the
+dnl Autoconf Macro released by this project. When you make and
+dnl distribute a modified version of the Autoconf Macro, you may extend
+dnl this special exception to the GPL to apply to your modified version as
+dnl well.
+
+dnl Check if FLAG in ENV-VAR is supported by compiler and append it
+dnl to WHERE-TO-APPEND variable. Note that we invert -Wno-* checks to
+dnl -W* as gcc cannot test for negated warnings. If a C snippet is passed,
+dnl use it, otherwise use a simple main() definition that just returns 0.
+dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG], [C-SNIPPET])
+
+AC_DEFUN([CC_CHECK_FLAG_APPEND], [
+  AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
+                 AS_TR_SH([cc_cv_$2_$3]),
+          [eval "AS_TR_SH([cc_save_$2])='${$2}'"
+           eval "AS_TR_SH([$2])='${cc_save_$2} -Werror `echo "$3" | sed 's/^-Wno-/-W/'`'"
+           AC_LINK_IFELSE([AC_LANG_SOURCE(ifelse([$4], [],
+                                                 [int main(void) { return 0; } ],
+                                                 [$4]))],
+                          [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
+                          [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
+           eval "AS_TR_SH([$2])='$cc_save_$2'"])
+
+  AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
+        [eval "$1='${$1} $3'"])
+])
+
+dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2], [C-SNIPPET])
+AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
+  for flag in [$3]; do
+    CC_CHECK_FLAG_APPEND([$1], [$2], $flag, [$4])
+  done
+])
+
+dnl Check if the flag is supported by linker (cacheable)
+dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_LDFLAGS], [
+  AC_CACHE_CHECK([if $CC supports $1 flag],
+    AS_TR_SH([cc_cv_ldflags_$1]),
+    [ac_save_LDFLAGS="$LDFLAGS"
+     LDFLAGS="$LDFLAGS $1"
+     AC_LINK_IFELSE([int main() { return 1; }],
+       [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
+       [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
+     LDFLAGS="$ac_save_LDFLAGS"
+    ])
+
+  AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
+    [$2], [$3])
+])
+
+dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
+dnl the current linker to avoid undefined references in a shared object.
+AC_DEFUN([CC_NOUNDEFINED], [
+  dnl We check $host for which systems to enable this for.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  case $host in
+     dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
+     dnl are requested, as different implementations are present; to avoid problems
+     dnl use -Wl,-z,defs only for those platform not behaving this way.
+     *-freebsd* | *-openbsd*) ;;
+     *)
+        dnl First of all check for the --no-undefined variant of GNU ld. This allows
+        dnl for a much more readable command line, so that people can understand what
+        dnl it does without going to look for what the heck -z defs does.
+        for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
+           CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
+           break
+        done
+     ;;
+  esac
+
+  AC_SUBST([LDFLAGS_NOUNDEFINED])
+])
+
+dnl Check for a -Werror flag or equivalent. -Werror is the GCC
+dnl and ICC flag that tells the compiler to treat all the warnings
+dnl as fatal. We usually need this option to make sure that some
+dnl constructs (like attributes) are not simply ignored.
+dnl
+dnl Other compilers don't support -Werror per se, but they support
+dnl an equivalent flag:
+dnl  - Sun Studio compiler supports -errwarn=%all
+AC_DEFUN([CC_CHECK_WERROR], [
+  AC_CACHE_CHECK(
+    [for $CC way to treat warnings as errors],
+    [cc_cv_werror],
+    [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
+      [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
+    ])
+])
+
+AC_DEFUN([CC_CHECK_ATTRIBUTE], [
+  AC_REQUIRE([CC_CHECK_WERROR])
+  AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
+    AS_TR_SH([cc_cv_attribute_$1]),
+    [ac_save_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $cc_cv_werror"
+     AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
+       [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
+       [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
+     CFLAGS="$ac_save_CFLAGS"
+    ])
+
+  AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
+    [AC_DEFINE(
+       AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
+         [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
+         )
+     $4],
+    [$5])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
+  CC_CHECK_ATTRIBUTE(
+    [constructor],,
+    [void __attribute__((constructor)) ctor() { int a; }],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
+  CC_CHECK_ATTRIBUTE(
+    [format], [format(printf, n, n)],
+    [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
+  CC_CHECK_ATTRIBUTE(
+    [format_arg], [format_arg(printf)],
+    [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
+  CC_CHECK_ATTRIBUTE(
+    [visibility_$1], [visibility("$1")],
+    [void __attribute__((visibility("$1"))) $1_function() { }],
+    [$2], [$3])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
+  CC_CHECK_ATTRIBUTE(
+    [nonnull], [nonnull()],
+    [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
+  CC_CHECK_ATTRIBUTE(
+    [unused], ,
+    [void some_function(void *foo, __attribute__((unused)) void *bar);],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
+  CC_CHECK_ATTRIBUTE(
+    [sentinel], ,
+    [void some_function(void *foo, ...) __attribute__((sentinel));],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
+  CC_CHECK_ATTRIBUTE(
+    [deprecated], ,
+    [void some_function(void *foo, ...) __attribute__((deprecated));],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
+  CC_CHECK_ATTRIBUTE(
+    [alias], [weak, alias],
+    [void other_function(void *foo) { }
+     void some_function(void *foo) __attribute__((weak, alias("other_function")));],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
+  CC_CHECK_ATTRIBUTE(
+    [malloc], ,
+    [void * __attribute__((malloc)) my_alloc(int n);],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_PACKED], [
+  CC_CHECK_ATTRIBUTE(
+    [packed], ,
+    [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONST], [
+  CC_CHECK_ATTRIBUTE(
+    [const], ,
+    [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
+    [$1], [$2])
+])
+
+AC_DEFUN([CC_FLAG_VISIBILITY], [
+  AC_REQUIRE([CC_CHECK_WERROR])
+  AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
+    [cc_cv_flag_visibility],
+    [cc_flag_visibility_save_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $cc_cv_werror"
+     CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
+     cc_cv_flag_visibility='yes',
+     cc_cv_flag_visibility='no')
+     CFLAGS="$cc_flag_visibility_save_CFLAGS"])
+
+  AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
+    [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
+       [Define this if the compiler supports the -fvisibility flag])
+     $1],
+    [$2])
+])
+
+AC_DEFUN([CC_FUNC_EXPECT], [
+  AC_REQUIRE([CC_CHECK_WERROR])
+  AC_CACHE_CHECK([if compiler has __builtin_expect function],
+    [cc_cv_func_expect],
+    [ac_save_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $cc_cv_werror"
+     AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+       [int some_function() {
+        int a = 3;
+        return (int)__builtin_expect(a, 3);
+     }])],
+       [cc_cv_func_expect=yes],
+       [cc_cv_func_expect=no])
+     CFLAGS="$ac_save_CFLAGS"
+    ])
+
+  AS_IF([test "x$cc_cv_func_expect" = "xyes"],
+    [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
+     [Define this if the compiler supports __builtin_expect() function])
+     $1],
+    [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
+  AC_REQUIRE([CC_CHECK_WERROR])
+  AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
+    [cc_cv_attribute_aligned],
+    [ac_save_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $cc_cv_werror"
+     for cc_attribute_align_try in 64 32 16 8 4 2; do
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+          int main() {
+            static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
+            return c;
+          }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
+     done
+     CFLAGS="$ac_save_CFLAGS"
+  ])
+
+  if test "x$cc_cv_attribute_aligned" != "x"; then
+     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
+       [Define the highest alignment supported])
+  fi
+])
diff --git a/m4/gettext.m4 b/m4/gettext.m4
new file mode 100644 (file)
index 0000000..8d1f066
--- /dev/null
@@ -0,0 +1,401 @@
+# gettext.m4 serial 66 (gettext-0.18.2)
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl    default (if it is not specified or empty) is 'no-libtool'.
+dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl    depending on --{enable,disable}-{shared,static} and on the presence of
+dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl    $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl    implementations (in libc or libintl) without the ngettext() function
+dnl    will be ignored.  If NEEDSYMBOL is specified and is
+dnl    'need-formatstring-macros', then GNU gettext implementations that don't
+dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries.  If empty,
+dnl    the value '$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl    and used.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl    Catalog format: none
+dnl    Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+  dnl Argument checking.
+  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
+    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
+  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+  define([gt_included_intl],
+    ifelse([$1], [external],
+      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
+      [yes]))
+  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
+  gt_NEEDS_INIT
+  AM_GNU_GETTEXT_NEED([$2])
+
+  AC_REQUIRE([AM_PO_SUBDIRS])dnl
+  ifelse(gt_included_intl, yes, [
+    AC_REQUIRE([AM_INTL_SUBDIR])dnl
+  ])
+
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Sometimes libintl requires libiconv, so first search for libiconv.
+  dnl Ideally we would do this search only after the
+  dnl      if test "$USE_NLS" = "yes"; then
+  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+  dnl the configure script would need to contain the same shell code
+  dnl again, outside any 'if'. There are two solutions:
+  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+  dnl documented, we avoid it.
+  ifelse(gt_included_intl, yes, , [
+    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+  ])
+
+  dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
+  gt_INTL_MACOSX
+
+  dnl Set USE_NLS.
+  AC_REQUIRE([AM_NLS])
+
+  ifelse(gt_included_intl, yes, [
+    BUILD_INCLUDED_LIBINTL=no
+    USE_INCLUDED_LIBINTL=no
+  ])
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+  dnl Add a version number to the cache macros.
+  case " $gt_needs " in
+    *" need-formatstring-macros "*) gt_api_version=3 ;;
+    *" need-ngettext "*) gt_api_version=2 ;;
+    *) gt_api_version=1 ;;
+  esac
+  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
+  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
+
+  dnl If we use NLS figure out what method
+  if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+    ifelse(gt_included_intl, yes, [
+      AC_MSG_CHECKING([whether included gettext is requested])
+      AC_ARG_WITH([included-gettext],
+        [  --with-included-gettext use the GNU gettext library included here],
+        nls_cv_force_use_gnu_gettext=$withval,
+        nls_cv_force_use_gnu_gettext=no)
+      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+    ])
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If GNU gettext is available we use this.  Else we have
+        dnl to fall back to GNU NLS library.
+
+        if test $gt_api_version -ge 3; then
+          gt_revision_test_code='
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+'
+        else
+          gt_revision_test_code=
+        fi
+        if test $gt_api_version -ge 2; then
+          gt_expression_test_code=' + * ngettext ("", "", 0)'
+        else
+          gt_expression_test_code=
+        fi
+
+        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
+         [AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+               ]],
+               [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
+               ]])],
+            [eval "$gt_func_gnugettext_libc=yes"],
+            [eval "$gt_func_gnugettext_libc=no"])])
+
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+          dnl Sometimes libintl requires libiconv, so first search for libiconv.
+          ifelse(gt_included_intl, yes, , [
+            AM_ICONV_LINK
+          ])
+          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+          dnl even if libiconv doesn't exist.
+          AC_LIB_LINKFLAGS_BODY([intl])
+          AC_CACHE_CHECK([for GNU gettext in libintl],
+            [$gt_func_gnugettext_libintl],
+           [gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+            dnl Now see whether libintl exists and does not depend on libiconv.
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+                 ]],
+                 [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+                 ]])],
+              [eval "$gt_func_gnugettext_libintl=yes"],
+              [eval "$gt_func_gnugettext_libintl=no"])
+            dnl Now see whether libintl exists and depends on libiconv.
+            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              AC_LINK_IFELSE(
+                [AC_LANG_PROGRAM(
+                   [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+                   ]],
+                   [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+                   ]])],
+                [LIBINTL="$LIBINTL $LIBICONV"
+                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                 eval "$gt_func_gnugettext_libintl=yes"
+                ])
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"])
+        fi
+
+        dnl If an already present or preinstalled GNU gettext() is found,
+        dnl use it.  But if this macro is used in GNU gettext, and GNU
+        dnl gettext is already preinstalled in libintl, we update this
+        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+          dnl Reset the values set by searching for libintl.
+          LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+    ifelse(gt_included_intl, yes, [
+        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+          dnl GNU gettext is not found in the C library.
+          dnl Fall back on included GNU gettext library.
+          nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions used to generate GNU NLS library.
+        BUILD_INCLUDED_LIBINTL=yes
+        USE_INCLUDED_LIBINTL=yes
+        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
+        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
+        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+      fi
+
+      CATOBJEXT=
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions to use GNU gettext tools.
+        CATOBJEXT=.gmo
+      fi
+    ])
+
+    if test -n "$INTL_MACOSX_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Some extra flags are needed during linking.
+        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+      fi
+    fi
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+      AC_DEFINE([ENABLE_NLS], [1],
+        [Define to 1 if translation of program messages to the user's native language
+   is requested.])
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  AC_MSG_CHECKING([whether to use NLS])
+  AC_MSG_RESULT([$USE_NLS])
+  if test "$USE_NLS" = "yes"; then
+    AC_MSG_CHECKING([where the gettext function comes from])
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    AC_MSG_RESULT([$gt_source])
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        AC_MSG_CHECKING([how to link with libintl])
+        AC_MSG_RESULT([$LIBINTL])
+        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+      fi
+
+      dnl For backward compatibility. Some packages may be using this.
+      AC_DEFINE([HAVE_GETTEXT], [1],
+       [Define if the GNU gettext() function is already present or preinstalled.])
+      AC_DEFINE([HAVE_DCGETTEXT], [1],
+       [Define if the GNU dcgettext() function is already present or preinstalled.])
+    fi
+
+    dnl We need to process the po/ directory.
+    POSUB=po
+  fi
+
+  ifelse(gt_included_intl, yes, [
+    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+    dnl to 'yes' because some of the testsuite requires it.
+    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+      BUILD_INCLUDED_LIBINTL=yes
+    fi
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST([BUILD_INCLUDED_LIBINTL])
+    AC_SUBST([USE_INCLUDED_LIBINTL])
+    AC_SUBST([CATOBJEXT])
+
+    dnl For backward compatibility. Some configure.ins may be using this.
+    nls_cv_header_intl=
+    nls_cv_header_libgt=
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    DATADIRNAME=share
+    AC_SUBST([DATADIRNAME])
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INSTOBJEXT=.mo
+    AC_SUBST([INSTOBJEXT])
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    GENCAT=gencat
+    AC_SUBST([GENCAT])
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INTLOBJS=
+    if test "$USE_INCLUDED_LIBINTL" = yes; then
+      INTLOBJS="\$(GETTOBJS)"
+    fi
+    AC_SUBST([INTLOBJS])
+
+    dnl Enable libtool support if the surrounding package wishes it.
+    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
+  ])
+
+  dnl For backward compatibility. Some Makefiles may be using this.
+  INTLLIBS="$LIBINTL"
+  AC_SUBST([INTLLIBS])
+
+  dnl Make all documented variables known to autoconf.
+  AC_SUBST([LIBINTL])
+  AC_SUBST([LTLIBINTL])
+  AC_SUBST([POSUB])
+])
+
+
+dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
+m4_define([gt_NEEDS_INIT],
+[
+  m4_divert_text([DEFAULTS], [gt_needs=])
+  m4_define([gt_NEEDS_INIT], [])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
+AC_DEFUN([AM_GNU_GETTEXT_NEED],
+[
+  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/m4/glibtests.m4 b/m4/glibtests.m4
new file mode 100644 (file)
index 0000000..7d5920a
--- /dev/null
@@ -0,0 +1,28 @@
+dnl GLIB_TESTS
+dnl
+
+AC_DEFUN([GLIB_TESTS],
+[
+  AC_ARG_ENABLE(installed-tests,
+                AS_HELP_STRING([--enable-installed-tests],
+                               [Enable installation of some test cases]),
+                [case ${enableval} in
+                  yes) ENABLE_INSTALLED_TESTS="1"  ;;
+                  no)  ENABLE_INSTALLED_TESTS="" ;;
+                  *) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
+                 esac])
+  AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1")
+  AC_ARG_ENABLE(always-build-tests,
+                AS_HELP_STRING([--enable-always-build-tests],
+                               [Enable always building tests during 'make all']),
+                [case ${enableval} in
+                  yes) ENABLE_ALWAYS_BUILD_TESTS="1"  ;;
+                  no)  ENABLE_ALWAYS_BUILD_TESTS="" ;;
+                  *) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;;
+                 esac])
+  AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1")
+  if test "$ENABLE_INSTALLED_TESTS" = "1"; then
+    AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME)
+    AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
+  fi
+])
diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4
new file mode 100644 (file)
index 0000000..3675543
--- /dev/null
@@ -0,0 +1,88 @@
+dnl -*- mode: autoconf -*-
+
+# serial 2
+
+dnl Usage:
+dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
+AC_DEFUN([GTK_DOC_CHECK],
+[
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+
+  ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
+  AC_MSG_CHECKING([for gtk-doc])
+  PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
+  AC_MSG_RESULT($have_gtk_doc)
+
+  if test "$have_gtk_doc" = "no"; then
+      AC_MSG_WARN([
+  You will not be able to create source packages with 'make dist'
+  because $gtk_doc_requires is not found.])
+  fi
+
+  dnl check for tools we added during development
+  dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
+  dnl may not be writable by the user. Currently, automake requires that the
+  dnl test name must end in '.test'.
+  dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
+  AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
+  AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
+  AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
+  AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
+
+  dnl for overriding the documentation installation directory
+  AC_ARG_WITH([html-dir],
+    AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
+    [with_html_dir='${datadir}/gtk-doc/html'])
+  HTML_DIR="$with_html_dir"
+  AC_SUBST([HTML_DIR])
+
+  dnl enable/disable documentation building
+  AC_ARG_ENABLE([gtk-doc],
+    AS_HELP_STRING([--enable-gtk-doc],
+                   [use gtk-doc to build documentation [[default=no]]]),,
+    [enable_gtk_doc=no])
+
+  AC_MSG_CHECKING([whether to build gtk-doc documentation])
+  AC_MSG_RESULT($enable_gtk_doc)
+
+  if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
+    AC_MSG_ERROR([
+  You must have $gtk_doc_requires installed to build documentation for
+  $PACKAGE_NAME. Please install gtk-doc or disable building the
+  documentation by adding '--disable-gtk-doc' to '[$]0'.])
+  fi
+
+  dnl don't check for glib if we build glib
+  if test "x$PACKAGE_NAME" != "xglib"; then
+    dnl don't fail if someone does not have glib
+    PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0  >= 2.10.0,,[:])
+  fi
+
+  dnl enable/disable output formats
+  AC_ARG_ENABLE([gtk-doc-html],
+    AS_HELP_STRING([--enable-gtk-doc-html],
+                   [build documentation in html format [[default=yes]]]),,
+    [enable_gtk_doc_html=yes])
+    AC_ARG_ENABLE([gtk-doc-pdf],
+      AS_HELP_STRING([--enable-gtk-doc-pdf],
+                     [build documentation in pdf format [[default=no]]]),,
+      [enable_gtk_doc_pdf=no])
+
+  if test -z "$GTKDOC_MKPDF"; then
+    enable_gtk_doc_pdf=no
+  fi
+
+  if test -z "$AM_DEFAULT_VERBOSITY"; then
+    AM_DEFAULT_VERBOSITY=1
+  fi
+  AC_SUBST([AM_DEFAULT_VERBOSITY])
+
+  AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
+  AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
+  AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
+  AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
+  AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
+  AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
+])
diff --git a/m4/iconv.m4 b/m4/iconv.m4
new file mode 100644 (file)
index 0000000..a503646
--- /dev/null
@@ -0,0 +1,268 @@
+# iconv.m4 serial 18 (gettext-0.18.2)
+dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <iconv.h>
+         ]],
+         [[iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);]])],
+      [am_cv_func_iconv=yes])
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+           ]],
+           [[iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);]])],
+        [am_cv_lib_iconv=yes]
+        [am_cv_func_iconv=yes])
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+      dnl Solaris 10.
+      am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
+}]])],
+        [am_cv_func_iconv_works=yes],
+        [am_cv_func_iconv_works=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+      LIBS="$am_save_LIBS"
+    ])
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+    AC_DEFINE([HAVE_ICONV], [1],
+      [Define if you have the iconv() function and it works.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST([LIBICONV])
+  AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl   warnings.
+m4_define([gl_iconv_AC_DEFUN],
+  m4_version_prereq([2.64],
+    [[AC_DEFUN_ONCE(
+        [$1], [$2])]],
+    [m4_ifdef([gl_00GNULIB],
+       [[AC_DEFUN_ONCE(
+           [$1], [$2])]],
+       [[AC_DEFUN(
+           [$1], [$2])]])]))
+gl_iconv_AC_DEFUN([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL([am_cv_proto_iconv], [
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+           ]],
+           [[]])],
+        [am_cv_proto_iconv_arg1=""],
+        [am_cv_proto_iconv_arg1="const"])
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([
+         $am_cv_proto_iconv])
+    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
+      [Define as const if the declaration of iconv() needs const.])
+    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+    m4_ifdef([gl_ICONV_H_DEFAULTS],
+      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+       if test -n "$am_cv_proto_iconv_arg1"; then
+         ICONV_CONST="const"
+       fi
+      ])
+  fi
+])
diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4
new file mode 100644 (file)
index 0000000..ab97d39
--- /dev/null
@@ -0,0 +1,56 @@
+# intlmacosx.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Checks for special options needed on Mac OS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+  dnl Check for API introduced in Mac OS X 10.2.
+  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+    [gt_cv_func_CFPreferencesCopyAppValue],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFPreferences.h>]],
+          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
+       [gt_cv_func_CFPreferencesCopyAppValue=yes],
+       [gt_cv_func_CFPreferencesCopyAppValue=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
+      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+  fi
+  dnl Check for API introduced in Mac OS X 10.3.
+  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFLocale.h>]],
+          [[CFLocaleCopyCurrent();]])],
+       [gt_cv_func_CFLocaleCopyCurrent=yes],
+       [gt_cv_func_CFLocaleCopyCurrent=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
+      [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+  AC_SUBST([INTL_MACOSX_LIBS])
+])
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
new file mode 100644 (file)
index 0000000..c145e47
--- /dev/null
@@ -0,0 +1,119 @@
+# lib-ld.m4 serial 6
+dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
+dnl collision with libtool.m4.
+
+dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes
+  ;;
+*)
+  acl_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-2.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+        [assume the C compiler uses GNU ld [default=no]])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL([acl_cv_path_LD],
+[if test -z "$LD"; then
+  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$acl_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+        test "$with_gnu_ld" != no && break
+        ;;
+      *)
+        test "$with_gnu_ld" != yes && break
+        ;;
+      esac
+    fi
+  done
+  IFS="$acl_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT([$LD])
+else
+  AC_MSG_RESULT([no])
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
new file mode 100644 (file)
index 0000000..073f040
--- /dev/null
@@ -0,0 +1,777 @@
+# lib-link.m4 serial 26 (gettext-0.18.2)
+dnl Copyright (C) 2001-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ([2.54])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+    dnl because these -l options might require -L options that are present in
+    dnl LIBS. -l options benefit only from the -L options listed before it.
+    dnl Otherwise, add it to the front of LIBS, because it may be a static
+    dnl library that depends on another static library that is present in LIBS.
+    dnl Static libraries benefit only from the static libraries listed after
+    dnl it.
+    case " $LIB[]NAME" in
+      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+      *)       LIBS="$LIB[]NAME $LIBS" ;;
+    esac
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[$3]], [[$4]])],
+      [ac_cv_lib[]Name=yes],
+      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+    LIB[]NAME[]_PREFIX=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl   acl_libext,
+dnl   acl_shlibext,
+dnl   acl_libname_spec,
+dnl   acl_library_names_spec,
+dnl   acl_hardcode_libdir_flag_spec,
+dnl   acl_hardcode_libdir_separator,
+dnl   acl_hardcode_direct,
+dnl   acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE([rpath],
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_frompackage_]NAME, [$2])
+  popdef([NAME])
+  pushdef([PACK],[$2])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_libsinpackage_]PACKUP,
+    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+  popdef([PACKUP])
+  popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+  dnl Autoconf >= 2.61 supports dots in --with options.
+  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_ARG_WITH(P_A_C_K[-prefix],
+[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
+  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
+])
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Using breadth-first-seach.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+            dnl The same code as in the loop below:
+            dnl First look for a shared library.
+            if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+            dnl Then look for a static library.
+            if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  dnl First look for a shared library.
+                  if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                  dnl Then look for a static library.
+                  if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$acl_hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+  popdef([P_A_C_K])
+  popdef([PACKLIBS])
+  popdef([PACKUP])
+  popdef([PACK])
+  popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+  AC_REQUIRE([AC_LIB_RPATH])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  $1=
+  if test "$enable_rpath" != no; then
+    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+      dnl Use an explicit option to hardcode directories into the resulting
+      dnl binary.
+      rpathdirs=
+      next=
+      for opt in $2; do
+        if test -n "$next"; then
+          dir="$next"
+          dnl No need to hardcode the standard /usr/lib.
+          if test "X$dir" != "X/usr/$acl_libdirstem" \
+             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+            rpathdirs="$rpathdirs $dir"
+          fi
+          next=
+        else
+          case $opt in
+            -L) next=yes ;;
+            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+                 dnl No need to hardcode the standard /usr/lib.
+                 if test "X$dir" != "X/usr/$acl_libdirstem" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+                   rpathdirs="$rpathdirs $dir"
+                 fi
+                 next= ;;
+            *) next= ;;
+          esac
+        fi
+      done
+      if test "X$rpathdirs" != "X"; then
+        if test -n ""$3""; then
+          dnl libtool is used for linking. Use -R options.
+          for dir in $rpathdirs; do
+            $1="${$1}${$1:+ }-R$dir"
+          done
+        else
+          dnl The linker is used for linking directly.
+          if test -n "$acl_hardcode_libdir_separator"; then
+            dnl Weird platform: only the last -rpath option counts, the user
+            dnl must pass all path elements in one option.
+            alldirs=
+            for dir in $rpathdirs; do
+              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+            done
+            acl_save_libdir="$libdir"
+            libdir="$alldirs"
+            eval flag=\"$acl_hardcode_libdir_flag_spec\"
+            libdir="$acl_save_libdir"
+            $1="$flag"
+          else
+            dnl The -rpath options are cumulative.
+            for dir in $rpathdirs; do
+              acl_save_libdir="$libdir"
+              libdir="$dir"
+              eval flag=\"$acl_hardcode_libdir_flag_spec\"
+              libdir="$acl_save_libdir"
+              $1="${$1}${$1:+ }$flag"
+            done
+          fi
+        fi
+      fi
+    fi
+  fi
+  AC_SUBST([$1])
+])
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
new file mode 100644 (file)
index 0000000..60908e8
--- /dev/null
@@ -0,0 +1,224 @@
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib-prefix],
+[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl   "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl   "lib/amd64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+  dnl There is no formal standard regarding lib and lib64.
+  dnl On glibc systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+  dnl the compiler's default mode by looking at the compiler's library search
+  dnl path. If at least one of its elements ends in /lib64 or points to a
+  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+  dnl Otherwise we use the default, namely "lib".
+  dnl On Solaris systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  acl_libdirstem=lib
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+      dnl symlink is missing, so we set acl_libdirstem2 too.
+      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+        [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+        ])
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+        esac
+      fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS=   }"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+])
diff --git a/m4/libtool.m4 b/m4/libtool.m4
new file mode 100644 (file)
index 0000000..a644432
--- /dev/null
@@ -0,0 +1,8372 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+])
+
+# serial 58 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+                  [m4_fatal([Libtool version $1 or higher is required],
+                            63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\    *)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS=$ltmain
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_PREPARE_CC_BASENAME
+# -----------------------
+m4_defun([_LT_PREPARE_CC_BASENAME], [
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in @S|@*""; do
+      case $cc_temp in
+        compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+        distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+])# _LT_PREPARE_CC_BASENAME
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
+# but that macro is also expanded into generated libtool script, which
+# arranges for $SED and $ECHO to be set by different means.
+m4_defun([_LT_CC_BASENAME],
+[m4_require([_LT_PREPARE_CC_BASENAME])dnl
+AC_REQUIRE([_LT_DECL_SED])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+func_cc_basename $1
+cc_basename=$func_cc_basename_result
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+m4_require([_LT_CMD_TRUNCATE])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options that allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}"; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}"; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test set != "${COLLECT_NAMES+set}"; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a '.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+old_CC=$CC
+old_CFLAGS=$CFLAGS
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from 'configure', and 'config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# 'config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain=$ac_aux_dir/ltmain.sh
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the 'libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+       [m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+       [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+       [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+          m4_quote(lt_decl_varnames),
+       m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+                       lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to 'config.status' so that its
+# declaration there will have the same value as in 'configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags='_LT_TAGS'dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+                                          [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into 'config.status', and then the shell code to quote escape them in
+# for loops in 'config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+       dnl If the libtool generation code has been placed in $CONFIG_LT,
+       dnl instead of duplicating it all over again into config.status,
+       dnl then we will have config.status run $CONFIG_LT later, so it
+       dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# '#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test 0 = "$lt_write_fail" && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+'$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test 0 != $[#]
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try '$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try '$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test yes = "$silent" &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options that allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}"; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile=${ofile}T
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+# Generated automatically by $as_me ($PACKAGE) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_PREPARE_MUNGE_PATH_LIST
+_LT_PREPARE_CC_BASENAME
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test set != "${COLLECT_NAMES+set}"; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],                 [_LT_LANG(C)],
+  [C++],               [_LT_LANG(CXX)],
+  [Go],                        [_LT_LANG(GO)],
+  [Java],              [_LT_LANG(GCJ)],
+  [Fortran 77],                [_LT_LANG(F77)],
+  [Fortran],           [_LT_LANG(FC)],
+  [Windows Resource],  [_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+       [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+       [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+       [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "$LT_MULTI_MODULE"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       # If there is a non-empty error log, and "single_module"
+       # appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+         cat conftest.err >&AS_MESSAGE_LOG_FD
+       # Otherwise, if the output was created with a 0 exit code from
+       # the compiler, it worked.
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&AS_MESSAGE_LOG_FD
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+       [lt_cv_ld_exported_symbols_list=yes],
+       [lt_cv_ld_exported_symbols_list=no])
+       LDFLAGS=$save_LDFLAGS
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+       cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       10.[[012]][[,.]]*)
+         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+       10.*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
+    fi
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test yes = "$lt_cv_ld_force_load"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
+  case $cc_basename in
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test yes = "$_lt_dar_can_shared"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
+    m4_if([$1], [CXX],
+[   if test yes != "$lt_cv_apple_cc_single_mod"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test set = "${lt_cv_aix_libpath+set}"; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+         /^0/ {
+             s/^0  *\([^ ]*\) *$/\1/
+             p
+         }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script that will find a shell with a builtin
+# printf (that we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+case $ECHO in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
+  [Search for dependent libraries within DIR (or the compiler's sysroot
+   if not specified).])],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case $with_sysroot in #(
+ yes)
+   if test yes = "$GCC"; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([$with_sysroot])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and where our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE=32
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE=64
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+       emul="${emul}32"
+       ;;
+      *64-bit*)
+       emul="${emul}64"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+       emul="${emul}btsmip"
+       ;;
+      *LSB*)
+       emul="${emul}ltsmip"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+       emul="${emul}n32"
+       ;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           case `/usr/bin/file conftest.o` in
+             *x86-64*)
+               LD="${LD-ld} -m elf32_x86_64"
+               ;;
+             *)
+               LD="${LD-ld} -m elf_i386"
+               ;;
+           esac
+           ;;
+         powerpc64le-*linux*)
+           LD="${LD-ld} -m elf32lppclinux"
+           ;;
+         powerpc64-*linux*)
+           LD="${LD-ld} -m elf32ppclinux"
+           ;;
+         s390x-*linux*)
+           LD="${LD-ld} -m elf_s390"
+           ;;
+         sparc64-*linux*)
+           LD="${LD-ld} -m elf32_sparc"
+           ;;
+       esac
+       ;;
+      *64-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_x86_64_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_x86_64"
+           ;;
+         powerpcle-*linux*)
+           LD="${LD-ld} -m elf64lppc"
+           ;;
+         powerpc-*linux*)
+           LD="${LD-ld} -m elf64ppc"
+           ;;
+         s390*-*linux*|s390*-*tpf*)
+           LD="${LD-ld} -m elf64_s390"
+           ;;
+         sparc*-*linux*)
+           LD="${LD-ld} -m elf64_sparc"
+           ;;
+       esac
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS=$CFLAGS
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test yes != "$lt_cv_cc_needs_belf"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS=$SAVE_CFLAGS
+  fi
+  ;;
+*-*solaris*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*|x86_64-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD=${LD-ld}_sol2
+        fi
+        ;;
+      *)
+       if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+         LD="${LD-ld} -64"
+       fi
+       ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks=$enable_libtool_lock
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test 0 -eq "$ac_status"; then
+       # Ensure the archiver fails upon bogus file names.
+       rm -f conftest.$ac_objext libconftest.a
+       AC_TRY_EVAL([lt_ar_try])
+       if test 0 -ne "$ac_status"; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test no = "$lt_cv_ar_at_file"; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  bitrig* | openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"  ## exclude from sc_useless_quotes_in_assignment
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test yes = "[$]$2"; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS=$LDFLAGS
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS=$save_LDFLAGS
+])
+
+if test yes = "[$]$2"; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring=ABCD
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[        ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
+                = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+             test 17 != "$i" # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n "$lt_cv_sys_max_cmd_len"; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test yes = "$cross_compiling"; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisibility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test yes != "$enable_dlopen"; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen=load_add_on
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen=LoadLibrary
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+    # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[
+    lt_cv_dlopen=dyld
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen=shl_load],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen=dlopen],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test no = "$lt_cv_dlopen"; then
+    enable_dlopen=no
+  else
+    enable_dlopen=yes
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS=$LDFLAGS
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS=$LIBS
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test yes = "$lt_cv_dlopen_self"; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+        [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+        [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+        [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+       [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links=nottested
+if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test no = "$hard_links"; then
+    AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/",
+  [Define to the sub-directory where libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then
+
+  # We can hardcode non-existent directories.
+  if test no != "$_LT_TAGVAR(hardcode_direct, $1)" &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" &&
+     test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test relink = "$_LT_TAGVAR(hardcode_action, $1)" ||
+   test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP"; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_PREPARE_MUNGE_PATH_LIST
+# ---------------------------
+# Make sure func_munge_path_list() is defined correctly.
+m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
+[[# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x@S|@2 in
+    x)
+        ;;
+    *:)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
+        ;;
+    x:*)
+        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
+        ;;
+    *)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+]])# _LT_PREPARE_PATH_LIST
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+       [], [
+if test yes = "$GCC"; then
+  case $host_os in
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary...
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
+      test -d "$lt_sys_path" && \
+       lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo = "/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=.so
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
+[User-defined run-time library search path.])
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='$libname$release$shared_ext$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test ia64 = "$host_cpu"; then
+    # AIX 5 supports IA64
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a[(]lib.so.V[)]'
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='$libname$shared_ext'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec=$LIB
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
+    fi
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test yes = "$lt_cv_prog_gnu_ld"; then
+               version_type=linux # correct to gnu/linux during the next big refactor
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+        LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+        [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[  ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd* | bitrig*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec=/usr/lib
+  need_lib_prefix=no
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
+  else
+    need_version=yes
+  fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+os2*)
+  libname_spec='$name'
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
+  need_lib_prefix=no
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test yes = "$with_gnu_ld"; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec; then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=sco
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test yes = "$with_gnu_ld"; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test no = "$dynamic_linker" && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test yes = "$GCC"; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
+fi
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
+fi
+
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
+    [Detected run-time system search path for libraries])
+_LT_DECL([], [configure_time_lt_sys_library_path], [2],
+    [Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program that can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$1"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
+  ;;
+esac])
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+        [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program that can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test no = "$withval" || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test yes = "$GCC"; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return, which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD=$ac_prog
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test yes = "$with_gnu_ld"; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS=$lt_save_ifs
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD=$ac_dir/$ac_prog
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test no != "$with_gnu_ld" && break
+       ;;
+      *)
+       test yes != "$with_gnu_ld" && break
+       ;;
+      esac
+    fi
+  done
+  IFS=$lt_save_ifs
+else
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
+fi])
+LD=$lt_cv_path_LD
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test yes != "$GCC"; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_PATH_DD
+# -----------
+# find a working dd
+m4_defun([_LT_PATH_DD],
+[AC_CACHE_CHECK([for a working dd], [ac_cv_path_lt_DD],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd],
+[if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi])
+rm -f conftest.i conftest2.i conftest.out])
+])# _LT_PATH_DD
+
+
+# _LT_CMD_TRUNCATE
+# ----------------
+# find command to truncate a binary pipe
+m4_defun([_LT_CMD_TRUNCATE],
+[m4_require([_LT_PATH_DD])
+AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"])
+_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1],
+  [Command to truncate a binary pipe])
+])# _LT_CMD_TRUNCATE
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# 'unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM=$NM
+else
+  lt_nm_to_check=${ac_tool_prefix}nm
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS=$lt_save_ifs
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+       case $build_os in
+       mingw*) lt_bad_file=conftest.nm/nofile ;;
+       *) lt_bad_file=/dev/null ;;
+       esac
+       case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+       *$lt_bad_file* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break 2
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break 2
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS=$lt_save_ifs
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols -headers"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test yes != "$lt_cv_path_mainfest_tool"; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# _LT_DLL_DEF_P([FILE])
+# ---------------------
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with func_dll_def_p in the libtool script
+AC_DEFUN([_LT_DLL_DEF_P],
+[dnl
+  test DEF = "`$SED -n dnl
+    -e '\''s/^[[        ]]*//'\'' dnl Strip leading whitespace
+    -e '\''/^\(;.*\)*$/d'\'' dnl      Delete empty lines and comments
+    -e '\''s/^\(EXPORTS\|LIBRARY\)\([[  ]].*\)*$/DEF/p'\'' dnl
+    -e q dnl                          Only consider the first "real" line
+    $1`" dnl
+])# _LT_DLL_DEF_P
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw)
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM=-lm)
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test yes = "$GCC"; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+       [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test ia64 = "$host_cpu"; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[    ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t@_DLSYM_CONST
+#elif defined __osf__
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+         cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t@_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+         $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_globsym_save_LIBS=$LIBS
+         lt_globsym_save_CFLAGS=$CFLAGS
+         LIBS=conftstm.$ac_objext
+         CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
+           pipe_works=yes
+         fi
+         LIBS=$lt_globsym_save_LIBS
+         CFLAGS=$lt_globsym_save_CFLAGS
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test yes = "$pipe_works"; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1],
+    [Transform the output of nm into a list of symbols to manually relocate])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([nm_interface], [lt_cv_nm_interface], [1],
+    [The name lister interface])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test yes = "$GXX"; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+       # All AIX code is PIC.
+       if test ia64 = "$host_cpu"; then
+         # AIX 5 now supports IA64 processor
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       m4_if([$1], [GCJ], [],
+         [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
+           if test ia64 != "$host_cpu"; then
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64, which still supported -KPIC.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+           # IBM XL 8.0, 9.0 on PPC and BlueGene
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+             _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+             _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd*)
+       ;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test yes = "$GCC"; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test ia64 = "$host_cpu"; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      esac
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+      case $cc_basename in
+      # old Intel for x86_64, which still supported -KPIC.
+      ecc*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+       ;;
+      nagfor*)
+       # NAG Fortran compiler
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       ;;
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+         ;;
+       *Sun\ F* | *Sun*Fortran*)
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+         ;;
+       *Sun\ C*)
+         # Sun C 5.9
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+        *Intel*\ [[CF]]*Compiler*)
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+         ;;
+       *Portland\ Group*)
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms that do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+       [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+       [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+       [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+    # Without the "-l" option, or with the "-B" option, AIX nm treats
+    # weak defined symbols like other global defined symbols, whereas
+    # GNU nm marks them as "W".
+    # While the 'weak' keyword is ignored in the Export File, we need
+    # it in the Import File for the 'aix-soname' feature, so we have
+    # to replace the "-B" option with "-P" for AIX nm.
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test yes != "$GCC"; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd* | bitrig*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test yes = "$with_gnu_ld"; then
+    case $host_os in
+      aix*)
+       # The AIX port of GNU ld has always aspired to compatibility
+       # with the native linker.  However, as the warning in the GNU ld
+       # block says, versions before 2.19.5* couldn't really create working
+       # shared libraries, regardless of the interface used.
+       case `$LD -v 2>&1` in
+         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+         *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+         *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+         *)
+           lt_use_gnu_ld_interface=yes
+           ;;
+       esac
+       ;;
+      *)
+       lt_use_gnu_ld_interface=yes
+       ;;
+    esac
+  fi
+
+  if test yes = "$lt_use_gnu_ld_interface"; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='$wl'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test ia64 != "$host_cpu"; then
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file, use it as
+       # is; otherwise, prepend EXPORTS...
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test linux-dietlibc = "$host_os"; then
+       case $cc_basename in
+         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
+       esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+        && test no = "$tmp_diet"
+      then
+       tmp_addflag=' $pic_flag'
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95* | pgfortran*)
+                                       # Portland Group f77 and f90 compilers
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         _LT_TAGVAR(whole_archive_flag_spec, $1)=
+         tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
+       xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         ;;
+       esac
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)                       # Sun C 5.9
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+
+        if test yes = "$supports_anon_versioning"; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       tcc*)
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
+         ;;
+       xlf* | bgf* | bgxlf* | mpixlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+         _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+         if test yes = "$supports_anon_versioning"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         # For security reasons, it is highly recommended that you always
+         # use absolute paths for naming shared libraries, and exclude the
+         # DT_RUNPATH tag from executables and libraries.  But doing so
+         # requires that you compile everything twice, which is a pain.
+         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           _LT_TAGVAR(ld_shlibs, $1)=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test ia64 = "$host_cpu"; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+       # Without the "-l" option, or with the "-B" option, AIX nm treats
+       # weak defined symbols like other global defined symbols, whereas
+       # GNU nm marks them as "W".
+       # While the 'weak' keyword is ignored in the Export File, we need
+       # it in the Import File for the 'aix-soname' feature, so we have
+       # to replace the "-B" option with "-P" for AIX nm.
+       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # have runtime linking enabled, and use it for executables.
+       # For shared libraries, we enable/disable runtime linking
+       # depending on the kind of the shared library created -
+       # when "with_aix_soname,aix_use_runtimelinking" is:
+       # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "aix,yes"  lib.so          shared, rtl:yes, for executables
+       #            lib.a           static archive
+       # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+       #            lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a(lib.so.V) shared, rtl:no
+       # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a           static archive
+       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+         for ld_flag in $LDFLAGS; do
+         if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+           # With aix-soname=svr4, we create the lib.so.V shared archives only,
+           # so we don't have lib.a shared libs to link our executables.
+           # We have to force runtime linking in this case.
+           aix_use_runtimelinking=yes
+           LDFLAGS="$LDFLAGS -Wl,-brtl"
+         fi
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+       # The Import File defines what to hardcode.
+       _LT_TAGVAR(hardcode_direct, $1)=no
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+       ;;
+      esac
+
+      if test yes = "$GCC"; then
+       case $host_os in aix4.[[012]]|aix4.[[012]].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`$CC -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         :
+         else
+         # We have old collect2
+         _LT_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test yes = "$aix_use_runtimelinking"; then
+         shared_flag="$shared_flag "'$wl-G'
+       fi
+       # Need to ensure runtime linking is disabled for the traditional
+       # shared library, or the linker may eventually find shared libraries
+       # /with/ Import File - we do not want to mix them.
+       shared_flag_aix='-shared'
+       shared_flag_svr4='-shared $wl-G'
+      else
+       # not using gcc
+       if test ia64 = "$host_cpu"; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag='$wl-G'
+         else
+           shared_flag='$wl-bM:SRE'
+         fi
+         shared_flag_aix='$wl-bM:SRE'
+         shared_flag_svr4='$wl-G'
+       fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
+      else
+       if test ia64 = "$host_cpu"; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
+         _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+         _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+         if test yes = "$with_gnu_ld"; then
+           # We only use this code for GNU lds that support --whole-archive.
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
+         else
+           # Exported symbols can be pulled into shared objects from archives
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         fi
+         _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+         # -brtl affects multiple linker settings, -berok does not and is overridden later
+         compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+         if test svr4 != "$with_aix_soname"; then
+           # This is similar to how AIX traditionally builds its shared libraries.
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+         fi
+         if test aix != "$with_aix_soname"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+         else
+           # used by -dlpreopen to get the symbols
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+         fi
+         _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+       # Native MSVC
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       _LT_TAGVAR(always_export_symbols, $1)=yes
+       _LT_TAGVAR(file_list_spec, $1)='@'
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=.dll
+       # FIXME: Setting linknames here is a bad hack.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
+       # The linker will not automatically build a static lib if we build a DLL.
+       # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+       # Don't use ranlib
+       _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+       _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
+       ;;
+      *)
+       # Assume MSVC wrapper
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Tell ltmain to make .lib files, not .a files.
+       libext=lib
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=.dll
+       # FIXME: Setting linknames here is a bad hack.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+       # The linker will automatically build a .lib file if we build a DLL.
+       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+       # FIXME: Should let the user specify the lib program.
+       _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       ;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+      ;;
+
+    hpux10*)
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test no = "$with_gnu_ld"; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+       m4_if($1, [], [
+         # Older versions of the 11.00 compiler do not understand -b yet
+         # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+         _LT_LINKER_OPTION([if $CC understands -b],
+           _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+           [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+           [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+         [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+         ;;
+       esac
+      fi
+      if test no = "$with_gnu_ld"; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         _LT_TAGVAR(hardcode_direct, $1)=no
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       *)
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       # Try to use the -exported_symbol ld option, if it does not
+       # work, assume that -exports_file does not work either and
+       # implicitly export all symbols.
+       # This should be the same for all languages, so no per-tag cache variable.
+       AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+         [lt_cv_irix_exported_symbol],
+         [save_LDFLAGS=$LDFLAGS
+          LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
+          AC_LINK_IFELSE(
+            [AC_LANG_SOURCE(
+               [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+                             [C++], [[int foo (void) { return 0; }]],
+                             [Fortran 77], [[
+      subroutine foo
+      end]],
+                             [Fortran], [[
+      subroutine foo
+      end]])])],
+             [lt_cv_irix_exported_symbol=yes],
+             [lt_cv_irix_exported_symbol=no])
+           LDFLAGS=$save_LDFLAGS])
+       if test yes = "$lt_cv_irix_exported_symbol"; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
+       fi
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    linux*)
+      case $cc_basename in
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       _LT_TAGVAR(ld_shlibs, $1)=yes
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      esac
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd* | bitrig*)
+      if test -f /usr/libexec/ld.so; then
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+       else
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+       fi
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    osf3*)
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test yes = "$GCC"; then
+       wlarc='$wl'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='$wl'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands '-z linker_flag'.  GCC discards it without '$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test yes = "$GCC"; then
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
+       else
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test sequent = "$host_vendor"; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We CANNOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test sni = "$host_vendor"; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test yes,yes = "$GCC,$enable_shared"; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+       [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+       [$RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+         pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+         _LT_TAGVAR(allow_undefined_flag, $1)=
+         if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+         then
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+         else
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         fi
+         _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+       ])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting $shlibpath_var if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC=$CC
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report what library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test no = "$can_build_shared" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test yes = "$enable_shared" && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;                  # shared object as lib.so file only
+      yes,svr4,*) ;;                   # shared object as lib.so archive member only
+      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
+      esac
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test yes = "$enable_shared" || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC=$lt_save_CC
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test no != "$CXX" &&
+    ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
+    (test g++ != "$CXX"))); then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test yes != "$_lt_caught_CXX_error"; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test yes = "$GXX"; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test yes = "$GXX"; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test yes = "$with_gnu_ld"; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='$wl'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test ia64 = "$host_cpu"; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # have runtime linking enabled, and use it for executables.
+          # For shared libraries, we enable/disable runtime linking
+          # depending on the kind of the shared library created -
+          # when "with_aix_soname,aix_use_runtimelinking" is:
+          # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "aix,yes"  lib.so          shared, rtl:yes, for executables
+          #            lib.a           static archive
+          # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+          #            lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a(lib.so.V) shared, rtl:no
+          # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a           static archive
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+           for ld_flag in $LDFLAGS; do
+             case $ld_flag in
+             *-brtl*)
+               aix_use_runtimelinking=yes
+               break
+               ;;
+             esac
+           done
+           if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+             # With aix-soname=svr4, we create the lib.so.V shared archives only,
+             # so we don't have lib.a shared libs to link our executables.
+             # We have to force runtime linking in this case.
+             aix_use_runtimelinking=yes
+             LDFLAGS="$LDFLAGS -Wl,-brtl"
+           fi
+           ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+        case $with_aix_soname,$aix_use_runtimelinking in
+        aix,*) ;;      # no import file
+        svr4,* | *,yes) # use import file
+          # The Import File defines what to hardcode.
+          _LT_TAGVAR(hardcode_direct, $1)=no
+          _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+          ;;
+        esac
+
+        if test yes = "$GXX"; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+         collect2name=`$CC -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+            strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+           # We have reworked collect2
+           :
+         else
+           # We have old collect2
+           _LT_TAGVAR(hardcode_direct, $1)=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           _LT_TAGVAR(hardcode_minus_L, $1)=yes
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+          esac
+          shared_flag='-shared'
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag=$shared_flag' $wl-G'
+         fi
+         # Need to ensure runtime linking is disabled for the traditional
+         # shared library, or the linker may eventually find shared libraries
+         # /with/ Import File - we do not want to mix them.
+         shared_flag_aix='-shared'
+         shared_flag_svr4='-shared $wl-G'
+        else
+          # not using gcc
+          if test ia64 = "$host_cpu"; then
+         # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+         # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+          else
+           if test yes = "$aix_use_runtimelinking"; then
+             shared_flag='$wl-G'
+           else
+             shared_flag='$wl-bM:SRE'
+           fi
+           shared_flag_aix='$wl-bM:SRE'
+           shared_flag_svr4='$wl-G'
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+       if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          # The "-G" linker flag allows undefined symbols.
+          _LT_TAGVAR(no_undefined_flag, $1)='-bernotok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
+        else
+          if test ia64 = "$host_cpu"; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
+           _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           _LT_SYS_MODULE_PATH_AIX([$1])
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+           _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+           if test yes = "$with_gnu_ld"; then
+             # We only use this code for GNU lds that support --whole-archive.
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
+           else
+             # Exported symbols can be pulled into shared objects from archives
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+           fi
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+           # -brtl affects multiple linker settings, -berok does not and is overridden later
+           compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+           if test svr4 != "$with_aix_soname"; then
+             # This is similar to how AIX traditionally builds its shared
+             # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+           fi
+           if test aix != "$with_aix_soname"; then
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+           else
+             # used by -dlpreopen to get the symbols
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+           fi
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         _LT_TAGVAR(ld_shlibs, $1)=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+       case $GXX,$cc_basename in
+       ,cl* | no,cl*)
+         # Native MSVC
+         # hardcode_libdir_flag_spec is actually meaningless, as there is
+         # no search path for DLLs.
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         _LT_TAGVAR(always_export_symbols, $1)=yes
+         _LT_TAGVAR(file_list_spec, $1)='@'
+         # Tell ltmain to make .lib files, not .a files.
+         libext=lib
+         # Tell ltmain to make .dll files, not .so files.
+         shrext_cmds=.dll
+         # FIXME: Setting linknames here is a bad hack.
+         _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+         _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp "$export_symbols" "$output_objdir/$soname.def";
+              echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+            else
+              $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+            fi~
+            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+            linknames='
+         # The linker will not automatically build a static lib if we build a DLL.
+         # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+         # Don't use ranlib
+         _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+         _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+            lt_tool_outputfile="@TOOL_OUTPUT@"~
+            case $lt_outputfile in
+              *.exe|*.EXE) ;;
+              *)
+                lt_outputfile=$lt_outputfile.exe
+                lt_tool_outputfile=$lt_tool_outputfile.exe
+                ;;
+            esac~
+            func_to_tool_file "$lt_outputfile"~
+            if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+              $RM "$lt_outputfile.manifest";
+            fi'
+         ;;
+       *)
+         # g++
+         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+         # as there is no search path for DLLs.
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         _LT_TAGVAR(always_export_symbols, $1)=no
+         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+         if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           # If the export-symbols file already is a .def file, use it as
+           # is; otherwise, prepend EXPORTS...
+           _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp $export_symbols $output_objdir/$soname.def;
+            else
+              echo EXPORTS > $output_objdir/$soname.def;
+              cat $export_symbols >> $output_objdir/$soname.def;
+            fi~
+            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+         else
+           _LT_TAGVAR(ld_shlibs, $1)=no
+         fi
+         ;;
+       esac
+       ;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+       ;;
+
+      os2*)
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+       _LT_TAGVAR(hardcode_minus_L, $1)=yes
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       shrext_cmds=.dll
+       _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         prefix_cmds="$SED"~
+         if test EXPORTS = "`$SED 1q $export_symbols`"; then
+           prefix_cmds="$prefix_cmds -e 1d";
+         fi~
+         prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+         cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test yes = "$GXX"; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test no = "$with_gnu_ld"; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+          *)
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
+               case $host_cpu in
+                 hppa*64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+       _LT_TAGVAR(hardcode_direct, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+
+           # Archives containing C++ object files must be created using
+           # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+             else
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib'
+             fi
+           fi
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+           ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | ecpc* )
+           # Intel C++
+           with_gnu_ld=yes
+           # version 8.0 and above of icpc choke on multiply defined symbols
+           # if we add $predep_objects and $postdep_objects, however 7.1 and
+           # earlier do not add the objects themselves.
+           case `$CC -V 2>&1` in
+             *"Version 7."*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+             _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+             _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+                $RANLIB $oldlib'
+             _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+             ;;
+           *) # Version 6 and above use weak symbols
+             _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+             ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname  -o $lib $wl-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+           ;;
+         xl* | mpixl* | bgxl*)
+           # IBM XL 8.0 on PPC, with GNU ld
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           if test yes = "$supports_anon_versioning"; then
+             _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+                echo "local: *; };" >> $output_objdir/$libname.ver~
+                $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+           fi
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+             _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols'
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
+             _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+             # Not sure whether something based on
+             # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+             # would be better.
+             output_verbose_link_cmd='func_echo_all'
+
+             # Archives containing C++ object files must be created using
+             # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+             # necessary to make sure instantiated templates are included
+             # in the archive.
+             _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+       ;;
+
+      openbsd* | bitrig*)
+       if test -f /usr/libexec/ld.so; then
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=func_echo_all
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+               ;;
+             *)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                  echo "-hidden">> $lib.exp~
+                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
+                  $RM $lib.exp'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+               ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           ;;
+         *)
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+             case $host in
+               osf3*)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+                 ;;
+               *)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+                 ;;
+             esac
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+             _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+           _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+              $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+           _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+           case $host_os in
+             solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands '-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+           output_verbose_link_cmd='func_echo_all'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require '-G' NOT '-shared' on this
+               # platform.
+               _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             fi
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
+             case $host_os in
+               solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+               *)
+                 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We CANNOT use -z defs as we might desire, because we do not
+       # link with -lc, and that would cause any symbols used from libc to
+       # always be unresolved, which means just about no library would
+       # ever link correctly.  If we're not using GNU ld we use -z text
+       # though, which does catch some bad symbols but isn't as heavy-handed
+       # as -z defs.
+       _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+       _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
+       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+       _LT_TAGVAR(link_all_deplibs, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+              '"$_LT_TAGVAR(old_archive_cmds, $1)"
+           _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+              '"$_LT_TAGVAR(reload_cmds, $1)"
+           ;;
+         *)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)=$GXX
+    _LT_TAGVAR(LD, $1)=$LD
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test yes != "$_lt_caught_CXX_error"
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case @S|@2 in
+  .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;;
+  *)  func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case $prev$p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test x-L = "$p" ||
+          test x-R = "$p"; then
+        prev=$p
+        continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test no = "$pre_test_object_deps_done"; then
+        case $prev in
+        -L | -R)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p
+          else
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+          _LT_TAGVAR(postdeps, $1)=$prev$p
+        else
+          _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p"
+        fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test no = "$pre_test_object_deps_done"; then
+        if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+          _LT_TAGVAR(predep_objects, $1)=$p
+        else
+          _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+          _LT_TAGVAR(postdep_objects, $1)=$p
+        else
+          _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test no = "$F77"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test yes != "$_lt_disable_F77"; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test no = "$can_build_shared" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test yes = "$enable_shared" && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+       if test ia64 != "$host_cpu"; then
+         case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+         yes,aix,yes) ;;               # shared object as lib.so file only
+         yes,svr4,*) ;;                # shared object as lib.so archive member only
+         yes,*) enable_static=no ;;    # shared object in lib.a archive as well
+         esac
+       fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test yes = "$enable_shared" || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)=$G77
+    _LT_TAGVAR(LD, $1)=$LD
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test yes != "$_lt_disable_F77"
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test no = "$FC"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test yes != "$_lt_disable_FC"; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test no = "$can_build_shared" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test yes = "$enable_shared" && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+       if test ia64 != "$host_cpu"; then
+         case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+         yes,aix,yes) ;;               # shared object as lib.so file only
+         yes,svr4,*) ;;                # shared object as lib.so archive member only
+         yes,*) enable_static=no ;;    # shared object in lib.a archive as well
+         esac
+       fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test yes = "$enable_shared" || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu
+    _LT_TAGVAR(LD, $1)=$LD
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test yes != "$_lt_disable_FC"
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)=$LD
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)=$LD
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to 'libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code=$lt_simple_compile_test_code
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f "$lt_ac_sed" && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test 10 -lt "$lt_ac_count" && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test "$lt_ac_count" -gt "$lt_ac_max"; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine what file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
new file mode 100644 (file)
index 0000000..94b0829
--- /dev/null
@@ -0,0 +1,437 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
+#   Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 8 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option '$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+           [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+                     [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+                  [_LT_ENABLE_FAST_INSTALL])
+  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
+                  [_LT_WITH_AIX_SONAME([aix])])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the 'dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the 'win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the 'shared' and
+# 'disable-shared' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+       [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the 'static' and
+# 'disable-static' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+       [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the 'fast-install'
+# and 'disable-fast-install' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for pkg in $enableval; do
+       IFS=$lt_save_ifs
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+        [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the 'fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the 'disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_AIX_SONAME([DEFAULT])
+# ----------------------------------
+# implement the --with-aix-soname flag, and support the `aix-soname=aix'
+# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
+# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+m4_define([_LT_WITH_AIX_SONAME],
+[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
+shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[[5-9]]*,yes)
+  AC_MSG_CHECKING([which variant of shared library versioning to provide])
+  AC_ARG_WITH([aix-soname],
+    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
+    [case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname],
+    [AC_CACHE_VAL([lt_cv_with_aix_soname],
+      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
+    with_aix_soname=$lt_cv_with_aix_soname])
+  AC_MSG_RESULT([$with_aix_soname])
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+_LT_DECL([], [shared_archive_member_spec], [0],
+    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
+])# _LT_WITH_AIX_SONAME
+
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
+# LT_INIT options.
+# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
+      for lt_pkg in $withval; do
+       IFS=$lt_save_ifs
+       if test "X$lt_pkg" = "X$lt_p"; then
+         pic_mode=yes
+       fi
+      done
+      IFS=$lt_save_ifs
+      ;;
+    esac],
+    [pic_mode=m4_default([$1], [default])])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the 'pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+                [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+                [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+                [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+                [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+                [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
new file mode 100644 (file)
index 0000000..48bc934
--- /dev/null
@@ -0,0 +1,124 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
+# Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59, which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+          m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+            [m4_foreach([_Lt_suffix],
+               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+         [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+                [lt_append([$1], [$2], [$3])$4],
+                [$5])],
+         [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+       m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+       [$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+                     [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
new file mode 100644 (file)
index 0000000..fa04b52
--- /dev/null
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers                      -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 4179 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.6'
+macro_revision='2.4.6'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
new file mode 100644 (file)
index 0000000..c6b26f8
--- /dev/null
@@ -0,0 +1,99 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
+#   Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],  [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],             [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],        [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],         [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],    [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],           [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],             [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],    [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],           [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],       [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],               [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],        [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],    [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],    [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],         [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],            [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],  [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],             [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],            [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],    [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],   [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],          [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],            [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],           [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],  [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],    [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],          [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],          [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],                [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],     [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],          [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],   [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],           [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],           [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],           [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],  [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],      [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],    [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],    [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],    [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],     [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],         [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],       [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],        [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],                [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],        [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],   [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],              [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/m4/nls.m4 b/m4/nls.m4
new file mode 100644 (file)
index 0000000..8f8a147
--- /dev/null
+++ b/m4/nls.m4
@@ -0,0 +1,32 @@
+# nls.m4 serial 5 (gettext-0.18)
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_NLS],
+[
+  AC_MSG_CHECKING([whether NLS is requested])
+  dnl Default is enabled NLS
+  AC_ARG_ENABLE([nls],
+    [  --disable-nls           do not use Native Language Support],
+    USE_NLS=$enableval, USE_NLS=yes)
+  AC_MSG_RESULT([$USE_NLS])
+  AC_SUBST([USE_NLS])
+])
diff --git a/m4/po.m4 b/m4/po.m4
new file mode 100644 (file)
index 0000000..f395723
--- /dev/null
+++ b/m4/po.m4
@@ -0,0 +1,452 @@
+# po.m4 serial 20 (gettext-0.18.2)
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ([2.60])
+
+dnl Checks for all prerequisites of the po subdirectory.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+  AC_REQUIRE([AM_NLS])dnl
+
+  dnl Release version of the gettext macros. This is used to ensure that
+  dnl the gettext macros and po/Makefile.in.in are in sync.
+  AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
+
+  dnl Perform the following tests also if --disable-nls has been given,
+  dnl because they are needed for "make dist" to work.
+
+  dnl Search for GNU msgfmt in the PATH.
+  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+  dnl The second test excludes FreeBSD msgfmt.
+  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
+
+  dnl Test whether it is GNU msgfmt >= 0.15.
+changequote(,)dnl
+  case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
+    *) MSGFMT_015=$MSGFMT ;;
+  esac
+changequote([,])dnl
+  AC_SUBST([MSGFMT_015])
+changequote(,)dnl
+  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+    *) GMSGFMT_015=$GMSGFMT ;;
+  esac
+changequote([,])dnl
+  AC_SUBST([GMSGFMT_015])
+
+  dnl Search for GNU xgettext 0.12 or newer in the PATH.
+  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+  dnl The second test excludes FreeBSD xgettext.
+  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  dnl Remove leftover from FreeBSD xgettext call.
+  rm -f messages.po
+
+  dnl Test whether it is GNU xgettext >= 0.15.
+changequote(,)dnl
+  case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+    *) XGETTEXT_015=$XGETTEXT ;;
+  esac
+changequote([,])dnl
+  AC_SUBST([XGETTEXT_015])
+
+  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
+
+  dnl Installation directories.
+  dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
+  dnl have to define it here, so that it can be used in po/Makefile.
+  test -n "$localedir" || localedir='${datadir}/locale'
+  AC_SUBST([localedir])
+
+  dnl Support for AM_XGETTEXT_OPTION.
+  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
+  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
+
+  AC_CONFIG_COMMANDS([po-directories], [[
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        # Treat a directory as a PO directory if and only if it has a
+        # POTFILES.in file. This allows packages to have multiple PO
+        # directories under different names or in different locations.
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          gt_tab=`printf '\t'`
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          POMAKEFILEDEPS="POTFILES.in"
+          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$OBSOLETE_ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+          else
+            # The set of available languages was given in configure.in.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
+            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+          fi
+          # Compute POFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+          # Compute UPDATEPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+          # Compute DUMMYPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+          # Compute GMOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          GMOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done]],
+   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+    # from automake < 1.5.
+    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+   ])
+])
+
+dnl Postprocesses a Makefile in a directory containing PO files.
+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
+[
+  # When this code is run, in config.status, two variables have already been
+  # set:
+  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
+  # - LINGUAS is the value of the environment variable LINGUAS at configure
+  #   time.
+
+changequote(,)dnl
+  # Adjust a relative srcdir.
+  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+  ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
+  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+  # In autoconf-2.13 it is called $ac_given_srcdir.
+  # In autoconf-2.50 it is called $srcdir.
+  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+  case "$ac_given_srcdir" in
+    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+    /*) top_srcdir="$ac_given_srcdir" ;;
+    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  # Find a way to echo strings without interpreting backslash.
+  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
+    gt_echo='echo'
+  else
+    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
+      gt_echo='printf %s\n'
+    else
+      echo_func () {
+        cat <<EOT
+$*
+EOT
+      }
+      gt_echo='echo_func'
+    fi
+  fi
+
+  # A sed script that extracts the value of VARIABLE from a Makefile.
+  tab=`printf '\t'`
+  sed_x_variable='
+# Test if the hold space is empty.
+x
+s/P/P/
+x
+ta
+# Yes it was empty. Look if we have the expected variable definition.
+/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
+  # Seen the first line of the variable definition.
+  s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
+  ba
+}
+bd
+:a
+# Here we are processing a line from the variable definition.
+# Remove comment, more precisely replace it with a space.
+s/#.*$/ /
+# See if the line ends in a backslash.
+tb
+:b
+s/\\$//
+# Print the line, without the trailing backslash.
+p
+tc
+# There was no trailing backslash. The end of the variable definition is
+# reached. Clear the hold space.
+s/^.*$//
+x
+bd
+:c
+# A trailing backslash means that the variable definition continues in the
+# next line. Put a nonempty string into the hold space to indicate this.
+s/^.*$/P/
+x
+:d
+'
+changequote([,])dnl
+
+  # Set POTFILES to the value of the Makefile variable POTFILES.
+  sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
+  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
+  # Compute POTFILES_DEPS as
+  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
+  POTFILES_DEPS=
+  for file in $POTFILES; do
+    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
+  done
+  POMAKEFILEDEPS=""
+
+  if test -n "$OBSOLETE_ALL_LINGUAS"; then
+    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+  fi
+  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+    # The LINGUAS file contains the set of available languages.
+    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+  else
+    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
+    sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
+    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
+  fi
+  # Hide the ALL_LINGUAS assignment from automake < 1.5.
+  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+  # Compute POFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+  # Compute UPDATEPOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+  # Compute DUMMYPOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+  # Compute GMOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+  # Compute PROPERTIESFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
+  # Compute CLASSFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
+  # Compute QMFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
+  # Compute MSGFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
+  # Compute RESOURCESDLLFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
+  case "$ac_given_srcdir" in
+    .) srcdirpre= ;;
+    *) srcdirpre='$(srcdir)/' ;;
+  esac
+  POFILES=
+  UPDATEPOFILES=
+  DUMMYPOFILES=
+  GMOFILES=
+  PROPERTIESFILES=
+  CLASSFILES=
+  QMFILES=
+  MSGFILES=
+  RESOURCESDLLFILES=
+  for lang in $ALL_LINGUAS; do
+    POFILES="$POFILES $srcdirpre$lang.po"
+    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
+    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
+    QMFILES="$QMFILES $srcdirpre$lang.qm"
+    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
+    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
+  done
+  # CATALOGS depends on both $ac_dir and the user's LINGUAS
+  # environment variable.
+  INST_LINGUAS=
+  if test -n "$ALL_LINGUAS"; then
+    for presentlang in $ALL_LINGUAS; do
+      useit=no
+      if test "%UNSET%" != "$LINGUAS"; then
+        desiredlanguages="$LINGUAS"
+      else
+        desiredlanguages="$ALL_LINGUAS"
+      fi
+      for desiredlang in $desiredlanguages; do
+        # Use the presentlang catalog if desiredlang is
+        #   a. equal to presentlang, or
+        #   b. a variant of presentlang (because in this case,
+        #      presentlang can be used as a fallback for messages
+        #      which are not translated in the desiredlang catalog).
+        case "$desiredlang" in
+          "$presentlang"*) useit=yes;;
+        esac
+      done
+      if test $useit = yes; then
+        INST_LINGUAS="$INST_LINGUAS $presentlang"
+      fi
+    done
+  fi
+  CATALOGS=
+  JAVACATALOGS=
+  QTCATALOGS=
+  TCLCATALOGS=
+  CSHARPCATALOGS=
+  if test -n "$INST_LINGUAS"; then
+    for lang in $INST_LINGUAS; do
+      CATALOGS="$CATALOGS $lang.gmo"
+      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
+      QTCATALOGS="$QTCATALOGS $lang.qm"
+      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
+      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
+    done
+  fi
+
+  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+  tab=`printf '\t'`
+  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
+    # Add dependencies that cannot be formulated as a simple suffix rule.
+    for lang in $ALL_LINGUAS; do
+      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+      cat >> "$ac_file.tmp" <<EOF
+$frobbedlang.msg: $lang.po
+${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+    done
+  fi
+  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
+    # Add dependencies that cannot be formulated as a simple suffix rule.
+    for lang in $ALL_LINGUAS; do
+      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+      cat >> "$ac_file.tmp" <<EOF
+$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
+${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+    done
+  fi
+  if test -n "$POMAKEFILEDEPS"; then
+    cat >> "$ac_file.tmp" <<EOF
+Makefile: $POMAKEFILEDEPS
+EOF
+  fi
+  mv "$ac_file.tmp" "$ac_file"
+])
+
+dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
+AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
+[
+  XGETTEXT_EXTRA_OPTIONS=
+])
+
+dnl Registers an option to be passed to xgettext in the po subdirectory.
+AC_DEFUN([AM_XGETTEXT_OPTION],
+[
+  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
+  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
+])
diff --git a/m4/progtest.m4 b/m4/progtest.m4
new file mode 100644 (file)
index 0000000..7b39123
--- /dev/null
@@ -0,0 +1,91 @@
+# progtest.m4 serial 7 (gettext-0.18.2)
+dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+AC_PREREQ([2.50])
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL([ac_cv_path_$1],
+[case "[$]$1" in
+  [[\\/]]* | ?:[[\\/]]*)
+    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in ifelse([$5], , $PATH, [$5]); do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
+          if [$3]; then
+            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+    ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+  AC_MSG_RESULT([$][$1])
+else
+  AC_MSG_RESULT([no])
+fi
+AC_SUBST([$1])dnl
+])
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..f62bbae
--- /dev/null
+++ b/missing
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2013-10-28.13; # UTC
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try '$0 --help' for more information"
+  exit 1
+fi
+
+case $1 in
+
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
+
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'autom4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/permission-store/Makefile.am.inc b/permission-store/Makefile.am.inc
new file mode 100644 (file)
index 0000000..023aad3
--- /dev/null
@@ -0,0 +1,37 @@
+libexec_PROGRAMS += \
+       xdg-permission-store \
+       $(NULL)
+
+service_in_files += permission-store/xdg-permission-store.service.in
+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
+
+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)
+
+permission-store/permission-store-dbus.c: data/org.freedesktop.impl.portal.PermissionStore.xml Makefile
+       mkdir -p $(builddir)/permission-store
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                            \
+               --interface-prefix org.freedesktop.impl.portal. \
+               --c-namespace Xdg                               \
+               --generate-c-code $(builddir)/permission-store/permission-store-dbus    \
+               $(srcdir)/data/org.freedesktop.impl.portal.PermissionStore.xml  \
+               $(NULL)
+
+permission-store/%-dbus.h: permission-store/%-dbus.c
+       @true # Built as a side-effect of the rules for the .c
+
+# also used by the document portal
+ps_dbus_built_sources = $(nodist_xdg_permission_store_SOURCES)
+
+xdg_permission_store_SOURCES = \
+       permission-store/permission-store.c     \
+       permission-store/xdg-permission-store.c \
+       permission-store/xdg-permission-store.h \
+       $(NULL)
+
+xdg_permission_store_LDADD = $(AM_LDADD) $(BASE_LIBS) libflatpak-common.la
+xdg_permission_store_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) -I$(srcdir)/permission-store -I$(builddir)/permission-store
diff --git a/permission-store/org.freedesktop.impl.portal.PermissionStore.service.in b/permission-store/org.freedesktop.impl.portal.PermissionStore.service.in
new file mode 100644 (file)
index 0000000..cb444f1
--- /dev/null
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.impl.portal.PermissionStore
+Exec=@libexecdir@/xdg-permission-store
+SystemdService=xdg-permission-store.service
diff --git a/permission-store/permission-store.c b/permission-store/permission-store.c
new file mode 100644 (file)
index 0000000..30971af
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <gio/gio.h>
+#include "permission-store-dbus.h"
+#include "xdg-permission-store.h"
+#include "flatpak-utils.h"
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
+{
+  xdg_permission_store_start (connection);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+                  const gchar     *name,
+                  gpointer         user_data)
+{
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+              const gchar     *name,
+              gpointer         user_data)
+{
+  exit (1);
+}
+
+static gboolean opt_verbose;
+static gboolean opt_replace;
+static gboolean opt_version;
+
+static GOptionEntry entries[] = {
+  { "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Print debug information", NULL },
+  { "replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace", NULL },
+  { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version and exit", NULL },
+  { NULL }
+};
+
+static void
+message_handler (const gchar   *log_domain,
+                 GLogLevelFlags log_level,
+                 const gchar   *message,
+                 gpointer       user_data)
+{
+  /* Make this look like normal console output */
+  if (log_level & G_LOG_LEVEL_DEBUG)
+    printf ("XDP: %s\n", message);
+  else
+    printf ("%s: %s\n", g_get_prgname (), message);
+}
+
+static void
+printerr_handler (const gchar *string)
+{
+  const char *prefix = "";
+  const char *suffix = "";
+  if (flatpak_fancy_output ())
+    {
+      prefix = FLATPAK_ANSI_RED FLATPAK_ANSI_BOLD_ON;
+      suffix = FLATPAK_ANSI_BOLD_OFF FLATPAK_ANSI_COLOR_RESET;
+    }
+  fprintf (stderr, "%serror: %s%s\n", prefix, suffix, string);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  guint owner_id;
+  GMainLoop *loop;
+  GOptionContext *context;
+  g_autoptr(GError) error = NULL;
+
+  setlocale (LC_ALL, "");
+
+  g_setenv ("GIO_USE_VFS", "local", TRUE);
+
+  g_set_prgname (argv[0]);
+
+  flatpak_migrate_from_xdg_app ();
+
+  g_set_printerr_handler (printerr_handler);
+
+  context = g_option_context_new ("- permission store");
+  g_option_context_add_main_entries (context, entries, NULL);
+  if (!g_option_context_parse (context, &argc, &argv, &error))
+    {
+      g_printerr ("Option parsing failed: %s", error->message);
+      return 1;
+    }
+
+  if (opt_version)
+    {
+      g_print ("%s\n", PACKAGE_STRING);
+      exit (EXIT_SUCCESS);
+    }
+
+  if (opt_verbose)
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+
+  g_set_prgname (argv[0]);
+
+  owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+                             "org.freedesktop.impl.portal.PermissionStore",
+                             G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
+
+                             on_bus_acquired,
+                             on_name_acquired,
+                             on_name_lost,
+                             NULL,
+                             NULL);
+
+  loop = g_main_loop_new (NULL, FALSE);
+  g_main_loop_run (loop);
+
+  g_bus_unown_name (owner_id);
+
+  return 0;
+}
diff --git a/permission-store/xdg-permission-store.c b/permission-store/xdg-permission-store.c
new file mode 100644 (file)
index 0000000..499a35f
--- /dev/null
@@ -0,0 +1,468 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+#include "permission-store/permission-store-dbus.h"
+#include "xdg-permission-store.h"
+#include "flatpak-db.h"
+#include "flatpak-portal-error.h"
+
+GHashTable *tables = NULL;
+
+typedef struct
+{
+  char      *name;
+  FlatpakDb *db;
+  GList     *outstanding_writes;
+  GList     *current_writes;
+  gboolean   writing;
+} Table;
+
+static void start_writeout (Table *table);
+
+static void
+table_free (Table *table)
+{
+  g_free (table->name);
+  g_object_unref (table->db);
+  g_free (table);
+}
+
+static Table *
+lookup_table (const char            *name,
+              GDBusMethodInvocation *invocation)
+{
+  Table *table;
+  FlatpakDb *db;
+  g_autofree char *dir = NULL;
+  g_autofree char *path = NULL;
+
+  g_autoptr(GError) error = NULL;
+
+  table = g_hash_table_lookup (tables, name);
+  if (table != NULL)
+    return table;
+
+  dir = g_build_filename (g_get_user_data_dir (), "flatpak/db", NULL);
+  g_mkdir_with_parents (dir, 0755);
+
+  path = g_build_filename (dir, name, NULL);
+  db = flatpak_db_new (path, FALSE, &error);
+  if (db == NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
+                                             "Unable to load db file: %s", error->message);
+      return NULL;
+    }
+
+  table = g_new0 (Table, 1);
+  table->name = g_strdup (name);
+  table->db = db;
+
+  g_hash_table_insert (tables, table->name, table);
+
+  return table;
+}
+
+static void
+writeout_done (GObject      *source_object,
+               GAsyncResult *res,
+               gpointer      user_data)
+{
+  Table *table = user_data;
+  GList *l;
+
+  g_autoptr(GError) error = NULL;
+  gboolean ok;
+
+  ok = flatpak_db_save_content_finish (table->db, res, &error);
+
+  for (l = table->current_writes; l != NULL; l = l->next)
+    {
+      GDBusMethodInvocation *invocation = l->data;
+
+      if (ok)
+        g_dbus_method_invocation_return_value (invocation,
+                                               g_variant_new ("()"));
+      else
+        g_dbus_method_invocation_return_error (invocation,
+                                               FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
+                                               "Unable to write db: %s", error->message);
+    }
+
+  g_list_free (table->current_writes);
+  table->current_writes = NULL;
+  table->writing = FALSE;
+
+  if (table->outstanding_writes != NULL)
+    start_writeout (table);
+}
+
+static void
+start_writeout (Table *table)
+{
+  g_assert (table->current_writes == NULL);
+  table->current_writes = table->outstanding_writes;
+  table->outstanding_writes = NULL;
+  table->writing = TRUE;
+
+  flatpak_db_update (table->db);
+
+  flatpak_db_save_content_async (table->db, NULL, writeout_done, table);
+}
+
+static void
+ensure_writeout (Table                 *table,
+                 GDBusMethodInvocation *invocation)
+{
+  table->outstanding_writes = g_list_prepend (table->outstanding_writes, invocation);
+
+  if (!table->writing)
+    start_writeout (table);
+}
+
+static gboolean
+handle_list (XdgPermissionStore     *object,
+             GDBusMethodInvocation  *invocation,
+             const gchar            *table_name)
+{
+  Table *table;
+
+  g_auto(GStrv) ids = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  ids = flatpak_db_list_ids (table->db);
+
+  xdg_permission_store_complete_list (object, invocation, (const char * const *) ids);
+
+  return TRUE;
+}
+
+static GVariant *
+get_app_permissions (FlatpakDbEntry *entry)
+{
+  g_autofree const char **apps = NULL;
+  GVariantBuilder builder;
+  int i;
+
+  apps = flatpak_db_entry_list_apps (entry);
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sas}"));
+
+  for (i = 0; apps[i] != NULL; i++)
+    {
+      g_autofree const char **permissions = flatpak_db_entry_list_permissions (entry, apps[i]);
+      g_variant_builder_add_value (&builder,
+                                   g_variant_new ("{s@as}",
+                                                  apps[i],
+                                                  g_variant_new_strv (permissions, -1)));
+    }
+
+  return g_variant_ref_sink (g_variant_builder_end (&builder));
+}
+
+static gboolean
+handle_lookup (XdgPermissionStore     *object,
+               GDBusMethodInvocation  *invocation,
+               const gchar            *table_name,
+               const gchar            *id)
+{
+  Table *table;
+
+  g_autoptr(GVariant) data = NULL;
+  g_autoptr(GVariant) permissions = NULL;
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  entry = flatpak_db_lookup (table->db, id);
+  if (entry == NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                             "No entry for %s", id);
+      return TRUE;
+    }
+
+  data = flatpak_db_entry_get_data (entry);
+  permissions = get_app_permissions (entry);
+
+  xdg_permission_store_complete_lookup (object, invocation,
+                                        permissions,
+                                        g_variant_new_variant (data));
+
+  return TRUE;
+}
+
+static void
+emit_deleted (XdgPermissionStore     *object,
+              const gchar            *table_name,
+              const gchar            *id,
+              FlatpakDbEntry         *entry)
+{
+  g_autoptr(GVariant) data = NULL;
+  g_autoptr(GVariant) permissions = NULL;
+
+  data = flatpak_db_entry_get_data (entry);
+  permissions = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("{sas}"), NULL, 0));
+
+  xdg_permission_store_emit_changed (object,
+                                     table_name, id,
+                                     TRUE,
+                                     g_variant_new_variant (data),
+                                     permissions);
+}
+
+
+static void
+emit_changed (XdgPermissionStore     *object,
+              const gchar            *table_name,
+              const gchar            *id,
+              FlatpakDbEntry         *entry)
+{
+  g_autoptr(GVariant) data = NULL;
+  g_autoptr(GVariant) permissions = NULL;
+
+  data = flatpak_db_entry_get_data (entry);
+  permissions = get_app_permissions (entry);
+
+  xdg_permission_store_emit_changed (object,
+                                     table_name, id,
+                                     FALSE,
+                                     g_variant_new_variant (data),
+                                     permissions);
+}
+
+static gboolean
+handle_delete (XdgPermissionStore     *object,
+               GDBusMethodInvocation  *invocation,
+               const gchar            *table_name,
+               const gchar            *id)
+{
+  Table *table;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  entry = flatpak_db_lookup (table->db, id);
+  if (entry == NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                             "No entry for %s", id);
+      return TRUE;
+    }
+
+  flatpak_db_set_entry (table->db, id, NULL);
+  emit_deleted (object, table_name, id, entry);
+
+  ensure_writeout (table, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_set (XdgPermissionStore     *object,
+            GDBusMethodInvocation  *invocation,
+            const gchar            *table_name,
+            gboolean                create,
+            const gchar            *id,
+            GVariant               *app_permissions,
+            GVariant               *data)
+{
+  Table *table;
+  GVariantIter iter;
+  GVariant *child;
+
+  g_autoptr(GVariant) data_child = NULL;
+  g_autoptr(FlatpakDbEntry) old_entry = NULL;
+  g_autoptr(FlatpakDbEntry) new_entry = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  old_entry = flatpak_db_lookup (table->db, id);
+  if (old_entry == NULL && !create)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                             "Id %s not found", id);
+      return TRUE;
+    }
+
+  data_child = g_variant_get_child_value (data, 0);
+  new_entry = flatpak_db_entry_new (data_child);
+
+  /* Add all the given app permissions */
+
+  g_variant_iter_init (&iter, app_permissions);
+  while ((child = g_variant_iter_next_value (&iter)))
+    {
+      g_autoptr(FlatpakDbEntry) old_entry = NULL;
+      const char *child_app_id;
+      g_autofree const char **permissions;
+
+      g_variant_get (child, "{&s^a&s}", &child_app_id, &permissions);
+
+      old_entry = new_entry;
+      new_entry = flatpak_db_entry_set_app_permissions (new_entry, child_app_id, (const char **) permissions);
+
+      g_variant_unref (child);
+    }
+
+  flatpak_db_set_entry (table->db, id, new_entry);
+  emit_changed (object, table_name, id, new_entry);
+
+  ensure_writeout (table, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_set_permission (XdgPermissionStore     *object,
+                       GDBusMethodInvocation  *invocation,
+                       const gchar            *table_name,
+                       gboolean                create,
+                       const gchar            *id,
+                       const gchar            *app,
+                       const gchar *const     *permissions)
+{
+  Table *table;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  g_autoptr(FlatpakDbEntry) new_entry = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  entry = flatpak_db_lookup (table->db, id);
+  if (entry == NULL)
+    {
+      if (create)
+        {
+          entry = flatpak_db_entry_new (NULL);
+        }
+      else
+        {
+          g_dbus_method_invocation_return_error (invocation,
+                                                 FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                                 "Id %s not found", id);
+          return TRUE;
+        }
+    }
+
+  new_entry = flatpak_db_entry_set_app_permissions (entry, app, (const char **) permissions);
+  flatpak_db_set_entry (table->db, id, new_entry);
+  emit_changed (object, table_name, id, new_entry);
+
+  ensure_writeout (table, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_set_value (XdgPermissionStore     *object,
+                  GDBusMethodInvocation  *invocation,
+                  const gchar            *table_name,
+                  gboolean                create,
+                  const gchar            *id,
+                  GVariant               *data)
+{
+  Table *table;
+
+  g_autoptr(FlatpakDbEntry) entry = NULL;
+  g_autoptr(FlatpakDbEntry) new_entry = NULL;
+
+  table = lookup_table (table_name, invocation);
+  if (table == NULL)
+    return TRUE;
+
+  entry = flatpak_db_lookup (table->db, id);
+  if (entry == NULL)
+    {
+      if (create)
+        {
+          new_entry = flatpak_db_entry_new (data);
+        }
+      else
+        {
+          g_dbus_method_invocation_return_error (invocation,
+                                                 FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
+                                                 "Id %s not found", id);
+          return TRUE;
+        }
+    }
+  else
+    {
+      new_entry = flatpak_db_entry_modify_data (entry, data);
+    }
+
+  flatpak_db_set_entry (table->db, id, new_entry);
+  emit_changed (object, table_name, id, new_entry);
+
+  ensure_writeout (table, invocation);
+
+  return TRUE;
+}
+
+void
+xdg_permission_store_start (GDBusConnection *connection)
+{
+  XdgPermissionStore *store;
+  GError *error = NULL;
+
+  tables = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                  g_free, (GDestroyNotify) table_free);
+
+  store = xdg_permission_store_skeleton_new ();
+
+  xdg_permission_store_set_version (XDG_PERMISSION_STORE (store), 1);
+
+  g_signal_connect (store, "handle-list", G_CALLBACK (handle_list), NULL);
+  g_signal_connect (store, "handle-lookup", G_CALLBACK (handle_lookup), NULL);
+  g_signal_connect (store, "handle-set", G_CALLBACK (handle_set), NULL);
+  g_signal_connect (store, "handle-set-permission", G_CALLBACK (handle_set_permission), NULL);
+  g_signal_connect (store, "handle-set-value", G_CALLBACK (handle_set_value), NULL);
+  g_signal_connect (store, "handle-delete", G_CALLBACK (handle_delete), NULL);
+
+  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (store),
+                                         connection,
+                                         "/org/freedesktop/impl/portal/PermissionStore",
+                                         &error))
+    {
+      g_warning ("error: %s", error->message);
+      g_error_free (error);
+    }
+}
diff --git a/permission-store/xdg-permission-store.h b/permission-store/xdg-permission-store.h
new file mode 100644 (file)
index 0000000..55dcc5c
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright © 2015 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __FLATPAK_PERMISSION_STORE_H__
+#define __FLATPAK_PERMISSION_STORE_H__
+
+#include "flatpak-dbus.h"
+
+void xdg_permission_store_start (GDBusConnection *connection);
+
+#endif /* __FLATPAK_PERMISSION_STORE_H__ */
diff --git a/permission-store/xdg-permission-store.service.in b/permission-store/xdg-permission-store.service.in
new file mode 100644 (file)
index 0000000..6685430
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=sandboxed app permission store
+
+[Service]
+BusName=org.freedesktop.impl.portal.PermissionStore
+ExecStart=@libexecdir@/xdg-permission-store
+Type=dbus
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644 (file)
index 0000000..0412f9e
--- /dev/null
@@ -0,0 +1,13 @@
+cs
+de
+es
+gl
+hu
+id
+pl
+pt_BR
+ru
+sk
+sv
+tr
+uk
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
new file mode 100644 (file)
index 0000000..fce63a6
--- /dev/null
@@ -0,0 +1,453 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU General Public
+# License but which still want to provide support for the GNU gettext
+# functionality.
+# Please note that the actual code of GNU gettext is covered by the GNU
+# General Public License and is *not* in the public domain.
+#
+# Origin: gettext-0.18.2
+GETTEXT_MACRO_VERSION = 0.18
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+datadir = @datadir@
+localedir = @localedir@
+gettextsrcdir = $(datadir)/gettext/po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+# We use $(mkdir_p).
+# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
+# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
+# @install_sh@ does not start with $(SHELL), so we add it.
+# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
+# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
+# versions, $(mkinstalldirs) and $(install_sh) are unused.
+mkinstalldirs = $(SHELL) @install_sh@ -d
+install_sh = $(SHELL) @install_sh@
+MKDIR_P = @MKDIR_P@
+mkdir_p = @mkdir_p@
+
+GMSGFMT_ = @GMSGFMT@
+GMSGFMT_no = @GMSGFMT@
+GMSGFMT_yes = @GMSGFMT_015@
+GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
+MSGFMT_ = @MSGFMT@
+MSGFMT_no = @MSGFMT@
+MSGFMT_yes = @MSGFMT_015@
+MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
+XGETTEXT_ = @XGETTEXT@
+XGETTEXT_no = @XGETTEXT@
+XGETTEXT_yes = @XGETTEXT_015@
+XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = @MSGMERGE@ --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+UPDATEPOFILES = @UPDATEPOFILES@
+DUMMYPOFILES = @DUMMYPOFILES@
+DISTFILES.common = Makefile.in.in remove-potcdate.sin \
+$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
+DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
+$(POFILES) $(GMOFILES) \
+$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+
+# Makevars gets inserted here. (Don't remove this line!)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+       @echo "$(MSGFMT) -c -o $@ $<"; \
+       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+       @lang=`echo $* | sed -e 's,.*/,,'`; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+       sed -e '/^#/d' $< > t-$@
+       mv t-$@ $@
+
+
+all: all-@USE_NLS@
+
+all-yes: stamp-po
+all-no:
+
+# Ensure that the gettext macros and this Makefile.in.in are in sync.
+CHECK_MACRO_VERSION = \
+       test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
+         || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
+              exit 1; \
+            }
+
+# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
+# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
+# we don't want to bother translators with empty POT files). We assume that
+# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
+# In this case, stamp-po is a nop (i.e. a phony target).
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+       @$(CHECK_MACRO_VERSION)
+       test ! -f $(srcdir)/$(DOMAIN).pot || \
+         test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+       @test ! -f $(srcdir)/$(DOMAIN).pot || { \
+         echo "touch stamp-po" && \
+         echo timestamp > stamp-poT && \
+         mv stamp-poT stamp-po; \
+       }
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+# The determination of whether the package xyz is a GNU one is based on the
+# heuristic whether some file in the top level directory mentions "GNU xyz".
+# If GNU 'find' is available, we avoid grepping through monster files.
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+       if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
+              LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
+            else \
+              LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
+            fi; \
+          } | grep -v 'libtool:' >/dev/null; then \
+         package_gnu='GNU '; \
+       else \
+         package_gnu=''; \
+       fi; \
+       if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
+         msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
+       else \
+         msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
+       fi; \
+       case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+         '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
+           $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+             --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+             --files-from=$(srcdir)/POTFILES.in \
+             --copyright-holder='$(COPYRIGHT_HOLDER)' \
+             --msgid-bugs-address="$$msgid_bugs_address" \
+           ;; \
+         *) \
+           $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+             --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+             --files-from=$(srcdir)/POTFILES.in \
+             --copyright-holder='$(COPYRIGHT_HOLDER)' \
+             --package-name="$${package_gnu}@PACKAGE@" \
+             --package-version='@VERSION@' \
+             --msgid-bugs-address="$$msgid_bugs_address" \
+           ;; \
+       esac
+       test ! -f $(DOMAIN).po || { \
+         if test -f $(srcdir)/$(DOMAIN).pot; then \
+           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+           else \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+           fi; \
+         else \
+           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+         fi; \
+       }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+       $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+       if test -f "$(srcdir)/$${lang}.po"; then \
+         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) \
+           && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+                  '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+                    $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
+                  *) \
+                    $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
+                esac; \
+              }; \
+       else \
+         $(MAKE) $${lang}.po-create; \
+       fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           $(INSTALL_DATA) $(srcdir)/$$file \
+                           $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+         for file in Makevars; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+install-data-no: all
+install-data-yes: all
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkdir_p) $(DESTDIR)$$dir; \
+         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+           fi; \
+         done; \
+       done
+
+install-strip: install
+
+installdirs: installdirs-exec installdirs-data
+installdirs-exec:
+installdirs-data: installdirs-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+       else \
+         : ; \
+       fi
+installdirs-data-no:
+installdirs-data-yes:
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkdir_p) $(DESTDIR)$$dir; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+           fi; \
+         done; \
+       done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall: uninstall-exec uninstall-data
+uninstall-exec:
+uninstall-data: uninstall-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+uninstall-data-no:
+uninstall-data-yes:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+         done; \
+       done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+mostlyclean:
+       rm -f remove-potcdate.sed
+       rm -f stamp-poT
+       rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f stamp-po $(GMOFILES)
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir:
+       $(MAKE) update-po
+       @$(MAKE) dist2
+# This is a separate target because 'update-po' must be executed before.
+dist2: stamp-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         dists="$$dists Makevars.template"; \
+       fi; \
+       if test -f $(srcdir)/$(DOMAIN).pot; then \
+         dists="$$dists $(DOMAIN).pot stamp-po"; \
+       fi; \
+       if test -f $(srcdir)/ChangeLog; then \
+         dists="$$dists ChangeLog"; \
+       fi; \
+       for i in 0 1 2 3 4 5 6 7 8 9; do \
+         if test -f $(srcdir)/ChangeLog.$$i; then \
+           dists="$$dists ChangeLog.$$i"; \
+         fi; \
+       done; \
+       if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
+       for file in $$dists; do \
+         if test -f $$file; then \
+           cp -p $$file $(distdir) || exit 1; \
+         else \
+           cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+         fi; \
+       done
+
+update-po: Makefile
+       $(MAKE) $(DOMAIN).pot-update
+       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+       $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+       @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+       echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+       exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       cd $(srcdir); \
+       if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+              '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+                $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+              *) \
+                $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+            esac; \
+          }; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "msgmerge for $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+       @:
+
+# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
+# because execution permission bits may not work on the current file system.
+# Use @SHELL@, which is the shell determined by autoconf for the use by its
+# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
+Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
+       cd $(top_builddir) \
+         && @SHELL@ ./config.status $(subdir)/$@.in po-directories
+
+force:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/Makevars b/po/Makevars
new file mode 100644 (file)
index 0000000..7b53c1a
--- /dev/null
@@ -0,0 +1,71 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Flatpak team and others.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = https://github.com/flatpak/flatpak/issues
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context.  Possible values are "yes" and "no".  Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = yes
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+#   --previous            to keep previous msgids of translated messages,
+#   --quiet               to reduce the verbosity.
+MSGMERGE_OPTIONS =
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS =
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+PO_DEPENDS_ON_POT = no
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = no
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..469d430
--- /dev/null
@@ -0,0 +1,40 @@
+# List of source files containing translatable strings.
+# Please keep this file sorted alphabetically.
+app/flatpak-builtins-add-remote.c
+app/flatpak-builtins-build-bundle.c
+app/flatpak-builtins-build.c
+app/flatpak-builtins-build-commit-from.c
+app/flatpak-builtins-build-export.c
+app/flatpak-builtins-build-finish.c
+app/flatpak-builtins-build-import-bundle.c
+app/flatpak-builtins-build-init.c
+app/flatpak-builtins-build-sign.c
+app/flatpak-builtins-config.c
+app/flatpak-builtins-delete-remote.c
+app/flatpak-builtins-document-export.c
+app/flatpak-builtins-document-info.c
+app/flatpak-builtins-document-list.c
+app/flatpak-builtins-document-unexport.c
+app/flatpak-builtins-enter.c
+app/flatpak-builtins-info.c
+app/flatpak-builtins-info-remote.c
+app/flatpak-builtins-install.c
+app/flatpak-builtins-list.c
+app/flatpak-builtins-list-remotes.c
+app/flatpak-builtins-ls-remote.c
+app/flatpak-builtins-make-current.c
+app/flatpak-builtins-override.c
+app/flatpak-builtins-repo.c
+app/flatpak-builtins-repo-update.c
+app/flatpak-builtins-run.c
+app/flatpak-builtins-search.c
+app/flatpak-builtins-uninstall.c
+app/flatpak-builtins-update.c
+app/flatpak-builtins-utils.c
+app/flatpak-main.c
+app/flatpak-transaction.c
+common/flatpak-dir.c
+common/flatpak-run.c
+common/flatpak-utils.c
+system-helper/flatpak-system-helper.service.in
+system-helper/org.freedesktop.Flatpak.policy.in
diff --git a/po/Rules-quot b/po/Rules-quot
new file mode 100644 (file)
index 0000000..d2ac20d
--- /dev/null
@@ -0,0 +1,47 @@
+# Special Makefile rules for English message catalogs with quotation marks.
+
+DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
+
+.SUFFIXES: .insert-header .po-update-en
+
+en@quot.po-create:
+       $(MAKE) en@quot.po-update
+en@boldquot.po-create:
+       $(MAKE) en@boldquot.po-update
+
+en@quot.po-update: en@quot.po-update-en
+en@boldquot.po-update: en@boldquot.po-update-en
+
+.insert-header.po-update-en:
+       @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       ll=`echo $$lang | sed -e 's/@.*//'`; \
+       LC_ALL=C; export LC_ALL; \
+       cd $(srcdir); \
+       if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "creation of $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+en@quot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
+
+en@boldquot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
+
+mostlyclean: mostlyclean-quot
+mostlyclean-quot:
+       rm -f *.insert-header
diff --git a/po/boldquot.sed b/po/boldquot.sed
new file mode 100644 (file)
index 0000000..4b937aa
--- /dev/null
@@ -0,0 +1,10 @@
+s/"\([^"]*\)"/“\1”/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“”/""/g
+s/“/“\e[1m/g
+s/”/\e[0m”/g
+s/‘/‘\e[1m/g
+s/’/\e[0m’/g
diff --git a/po/cs.gmo b/po/cs.gmo
new file mode 100644 (file)
index 0000000..8a2307f
Binary files /dev/null and b/po/cs.gmo differ
diff --git a/po/cs.po b/po/cs.po
new file mode 100644 (file)
index 0000000..da19a9f
--- /dev/null
+++ b/po/cs.po
@@ -0,0 +1,2865 @@
+# Czech translation for flatpak.
+# Copyright (C) 2017 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Daniel Rusek <mail@asciiwolf.com>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-11-25 16:14+0100\n"
+"Last-Translator: Daniel Rusek <mail@asciiwolf.com>\n"
+"Language-Team: Czech <gnome-cs-list@gnome.org>\n"
+"Language: cs\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
+"X-Generator: Poedit 2.0.3\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Nedělat nic, pokud poskytnutý vzdálený repozitář již existuje"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "UMÍSTĚNÍ určuje konfigurační soubor, ne cestu k repozitáři"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Povolit ověřování pomocí GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Označit vzdálený repozitář jako použit pro enumeraci"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Označit vzdálený repozitář jako použit pro závislosti"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Nastavit novou url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Povolit vzdálený repozitář"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Aktualizovat dodatečná metadata ze souboru shrnutí"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Zakázat ověřování pomocí GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Označit vzdálený repozitář jako nepoužit pro enumeraci"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Označit vzdálený repozitář jako nepoužit pro závislosti"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+"Nastavit prioritu (výchozí hodnota je 1, vyšší hodnota znamená větší "
+"prioritu)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITA"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Hezký název, který bude použit pro tento repozitář"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "JMÉNO"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Výchozí větev pro použití s tímto vzdáleným repozitářem"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "VĚTEV"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "ID kolekce"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "KOLEKCE-ID"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importovat klíč GPG ze SOUBORU (- pro standardní vstup)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "SOUBOR"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Zakázat vzdálený repozitář"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Přidat OCI registr"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr "Nelze načíst uri %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Nelze načíst soubor %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr "Neplatný formát souboru"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Neplatná verze %s, pouze 1 je podporována"
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr "Neplatný klíč gpg"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NÁZEV UMÍSTĚNÍ - Přidat vzdálený repozitář"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NÁZEV musí být určen"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "UMÍSTĚNÍ musí být určeno"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Příliš mnoho parametrů"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "„%s“ není platným ID kolekce: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "Ověřování pomocí GPG je vyžadováno, pokud jsou povoleny kolekce"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Vzdálený repozitář %s již existuje"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Žádný url není určen ve flatpakrepo souboru"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Varování: Nepodařilo se aktualizovat dodatečná metadata pro „%s“: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NÁZEV - Upravit vzdálený repozitář"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "NÁZEV vzdáleného repozitáře musí být určen"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Aktualizuji dodatečná metadata ze vzdáleného shrnutí pro %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Chyba během aktualizace dodatečných metadat pro „%s“: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Nepodařilo se aktualizovat dodatečná metadata pro %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exportovat prostředí namísto aplikace"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Architektura, pro kterou se má vytvořit balík"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARCHITEKTURA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url pro repozitář"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url pro flatpakrepo soubor prostředí"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Přidat klíč GPG ze SOUBORU (- pro standardní vstup)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Exportovat oci obraz namísto flatpak balíku"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID klíče GPG pro podepsání OCI obrazu"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "KLÍČ-ID"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Domovský adresář pro použití při hledání klíčenek"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "DOMOVSKÝ_ADRESÁŘ"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"UMÍSTĚNÍ NÁZEV_SOUBORU NÁZEV [VĚTEV] - Vytvořit jeden soubor balíku z "
+"místního repozitáře"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "UMÍSTĚNÍ, NÁZEV_SOUBORU A NÁZEV musí být určeny"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "„%s“ není platným repozitářem"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "„%s“ není platným názvem: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "„%s“ není platným názvem větve: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr "Udělat cíl pouze pro čtení"
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Přidat vázané připojení"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "CÍL=ZDROJ"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Spustit sestavení v tomto adresáři"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "ADRESÁŘ"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Použít alternativní soubor pro metadata"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Zabít procesy v případě, že rodičovský proces zemře"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Exportovat domovský adresář aplikace do sestavení"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Zaznamenávat volání sběrnice sezení"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Zaznamenávat volání systémové sběrnice"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "ADRESÁŘ [PŘÍKAZ [parametry...]] - Sestavit v adresáři"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "ADRESÁŘ musí být určen"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "Adresář sestavení %s neinicializován, použijte flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "neplatná metadata, není aplikace nebo prostředí"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Není možné spustit aplikaci"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Adresář pro zdrojový repozitář"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "ZDROJ-REPOZITÁŘ"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Ref pro zdrojový repozitář"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "ZDROJ-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Předmět na jeden řádek"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "PŘEDMĚT"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Úplný popis"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TĚLO"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Aktualizovat appstream větev"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Neaktualizovat shrnutí"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID klíče GPG pro podepsání commitu"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"CÍL-REPO [CÍL-REF]... - Vytvořit nový commit založený na existujícím commitu "
+"(commitech)"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "CÍL-REPO musí být určeno"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr "%s: žádná změna\n"
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr ""
+"Architektura, pro kterou exportovat (musí být kompatibilní s hostitelem)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Použít alternativní adresář pro soubory"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "PODADRESÁŘ"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Soubory k vyloučení"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "VZOR"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Vyloučené soubory k zahrnutí"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Přepsat časovou značku commitu"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ISO-8601-TIMESTAMP"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Neplatný typ uri %s, pouze http/https jsou podporovány"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "V názvu souboru dodatečných dat nejsou povolena lomítka"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Neplatný formát pro kontrolní součet sha256: „%s“"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Dodatečná data s nulovou velikostí nejsou podporována"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "UMÍSTĚNÍ ADRESÁŘ [VĚTEV] - Vytvořit repozitář z adresáře sestavení"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "UMÍSTĚNÍ a ADRESÁŘ musí být určeny"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Není určen žádný název v metadatech"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr "Commit: %s\n"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Celková metadata: %u\n"
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Zapsaná metadata: %u\n"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr "Celkový obsah: %u\n"
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr "Zapsaný obsah: %u\n"
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr "Zapsáno bajtů obsahu:"
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Příkaz, který se má nastavit"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "PŘÍKAZ"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Požadovaná verze flatpaku"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAJOR.MINOR.MICRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Nezpracovat exporty"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Informace o dodatečných údajích"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NÁZEV=PROMĚNNÁ[=HODNOTA]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr "Nastavit prioritu rozšíření (pouze pro rozšíření)"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr "0"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Změnit sdk použité pro aplikaci"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Změnit prostředí použité pro aplikaci"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "PROSTŘEDÍ"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Nastavit generickou volbu metadat"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "SKUPINA=KLÍČ[=HODNOTA]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr "Exportuji %s\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr "Nalezen více než jeden spustitelný soubor\n"
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr "Používám %s jako příkaz\n"
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr "Nenalezen žádný spustitelný soubor\n"
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "ADRESÁŘ - Dokončit adresář sestavení"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Adresář sestavení %s není inicializován"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Adresář sestavení %s je již uzavřen"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Zkontrolujte prosím exportované soubory a metadata\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importovat oci obraz namísto flatpak balíku"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Ref „%s“ nebyl nalezen v registru"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Importuji %s (%s)\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+"UMÍSTĚNÍ NÁZEV_SOUBORU - Importovat soubor balíku do místního repozitáře"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "UMÍSTĚNÍ a NÁZEV_SOUBORU musí být určeny"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Architektura, která se má použít"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APLIKACE"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Určit verzi pro --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERZE"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Zahrnout toto základní rozšíření"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "ROZŠÍŘENÍ"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Určit typ sestavení (aplikace, prostředí, rozšíření)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TYP"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Přidat značku"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ZNAČKA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Požadované rozšíření %s je nainstalováno pouze částečně"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Požadované rozšíření %s není nainstalováno"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"ADRESÁŘ NÁZEV_APLIKACE SDK PROSTŘEDÍ [VĚTEV] - Inicializovat adresář k "
+"sestavování"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "PROSTŘEDÍ musí byť určeno"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "„%s“ není platným názvem aplikace: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Adresář sestavení %s je již inicializován"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Architektura, pro kterou se má instalovat"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Hledat prostředí s určeným názvem"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "UMÍSTĚNÍ [ID [VĚTEV]] - Podepsat aplikaci nebo prostředí"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Žádné id klíče gpg určeny"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr "Vypsat konfigurační klíče a hodnoty"
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr "Získat konfiguraci pro KLÍČ"
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr "Nastavit konfiguraci pro KLÍČ na HODNOTU"
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr "Zrušit konfiguraci pro KLÍČ"
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Neznámý konfigurační klíč „%s“"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr "Musíte určit klíč"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr "Musíte určit klíč i hodnotu"
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr "[KLÍČ [HODNOTA]] - Spravovat konfiguraci"
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Odstranit vzdálený repozitář i pokud se používá"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NÁZEV - Odstranit vzdálený repozitář"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Vytvořit unikátní referenci dokumentu"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Udělat dokument dočasný pouze pro toto sezení"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Nevyžadovat, aby soubor již existoval"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Udělit aplikaci oprávnění ke čtení"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Udělit aplikaci oprávnění k zápisu"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Udělit aplikaci oprávnění k mazání"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Udělit aplikaci oprávnění k získání dalších oprávnění"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Zrušit oprávnění aplikace ke čtení"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Zrušit oprávnění aplikace k zápisu"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Zrušit oprávnění aplikace k mazání"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Zrušit oprávnění k získání dalších oprávnění"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Přidat oprávnění pro tuto aplikaci"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "APPID"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "SOUBOR - Exportovat soubor pro aplikace"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "SOUBOR musí být určen"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "SOUBOR - Získat informace o exportovaném souboru"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Neexportováno\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[APPID] - Zobrazit exportované soubory"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "SOUBOR - Zrušit export souboru pro aplikace"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [PŘÍKAZ [argumenty...]] - Spustit příkaz v běžícím sandboxu"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "SANDBOXEDPID a PŘÍKAZ musí být určeny"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr "Neběží jako root, možná nebude možno vstoupit do jmenného prostoru"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Neplatný identifikátor pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Identifikátor pid %s neexistuje"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Nelze číst cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Nelze číst root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Neplatný jmenný prostor %s pro pid %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Neplatný jmenný prostor %s pro self"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Nelze otevřít jmenný prostor %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Nelze vstoupit do jmenného prostoru %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Nelze vykonat chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Nelze vykonat chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Nelze přepnout gid"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Nelze přepnout uid"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Zobrazit uživatelské instalace"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Zobrazit systémové instalace"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Zobrazit specifické systémové instalace"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Zobrazit referenci"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Zobrazit commit"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Zobrazit původ"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Zobrazit velikost"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Zobrazit metadata"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Zobrazit rozšíření"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NÁZEV [VĚTEV] - Získat informace o instalované aplikaci a/nebo prostředí"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Ref:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Architektura:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Větev:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Původ:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr "Datum:"
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr "Předmět:"
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Aktivní commit:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Poslední commit:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alt-id:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr "Rodič:"
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Umístění:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Instalovaná velikost:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Prostředí:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Instalované podadresáře:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Rozšíření:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Podcesty:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr "Commit, pro který zobrazit informace"
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "COMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Hledat aplikaci s určeným názvem"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr "Zobrazit záznam"
+
+#: app/flatpak-builtins-info-remote.c:55
+msgid "Show parent"
+msgstr "Zobrazit rodiče"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+" VZDÁLENÉ REF - Zobrazit informace o aplikaci nebo prostředí ve vzdáleném "
+"repozitáři"
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "VZDÁLENÉ a REF musí být určeny"
+
+#: app/flatpak-builtins-info-remote.c:201
+msgid "Download size:"
+msgstr "Stahovaná velikost:"
+
+#: app/flatpak-builtins-info-remote.c:214
+#, fuzzy
+msgid "History:\n"
+msgstr "Historie:"
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr " Předmět:"
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr " Datum:"
+
+#: app/flatpak-builtins-info-remote.c:237
+msgid " Commit:"
+msgstr " Commit:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Nedělat pull, pouze instalovat z místní cache"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Nedělat deploy, pouze stáhnout do místní cache"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Neinstalovat související refy"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Neověřovat/neinstalovat běhové závislosti"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Nepoužívat statické delta soubory"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Předpokládat, že UMÍSTĚNÍ je jednosouborový balíček .flatpak"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Předpokládat, že UMÍSTĚNÍ je popis aplikace .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Zkontrolovat podpisy balíku klíčem GPG ze souboru (- pro standardní vstup)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Instalovat pouze tuto podcestu"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "CESTA"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Automaticky odpovědět ano na všechny otázky"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s commit %s je již nainstalováno"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Tato aplikace závisí na prostředí z:\n"
+"  %s\n"
+"Konfigurovat tohle jako nový vzdálený repozitář „%s“"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Nastavuji %s jako nový vzdálený repozitář „%s“"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Název souboru balíku musí byt určen"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Vzdálené balíky nejsou podporovány"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"Vzdálený repozitář „%s“ umístěný v %s obsahuje dodatečné aplikace.\n"
+"Má být vzdálený repozitář ponechán pro budoucí instalace?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Název vzdáleného repozitáře musí být určen"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Instaluji: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "UMÍSTĚNÍ/VZDÁLENÉ [REF...] - Instalovat aplikaci nebo prostředí"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Zobrazit dodatečné informace"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Vypsat seznam instalovaných prostředí"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Vypsat seznam instalovaných aplikací"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Architektura, která se má zobrazit"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Zobrazit všechny refy (včetně locale/debug)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Ref"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Původ"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Aktivní commit"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Poslední commit"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Instalovaná velikost"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Možnosti"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Vypsat instalované aplikace a/nebo prostředí"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Zobrazit detaily vzdáleného repozitáře"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Zobrazit zakázané vzdálené repozitáře"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Vypsat vzdálené repozitáře"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Název"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Jméno"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Priorita"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Zobrazit architektury a větve"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Zobrazit pouze prostředí"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Zobrazit pouze aplikace"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Zobrazit pouze ty, pro které jsou k dispozici aktualizace"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Omezit na tuto architekturu (* pro všechny)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " VZDÁLENÉ - Zobrazit dostupné prostředí a aplikace"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Commit"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Stahovaná velikost"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "V repozitáři nejsou dostupné žádné ref informace"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "APLIKACE musí být určena"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "VĚTEV musí být určena"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Aplikace %s větev %s není nainstalována"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "APLIKACE - Přepsat nastavení pro aplikaci"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr "Jméno: %s\n"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr "ID kolekce: %s\n"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr "Výchozí větev: %s\n"
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr "URL přesměrování: %s\n"
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "ID kolekce přesměrování: %s\n"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr "Hash klíče GPG: %s\n"
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr "%zd větví\n"
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Instalováno"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Stažení"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Vypsat obecné informace o repozitáři"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Vypsat větve v repozitáři"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Vypsat metadata pro větev"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "UMÍSTĚNÍ - Údržba repozitáře"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Přesměrovat tento repozitář na novou URL"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Hezký název, který bude použit pro tento repozitář"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Výchozí větev pro použití s tímto vzdáleným repozitářem"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importovat nový výchozí veřejný klíč GPG ze SOUBORU"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "ID klíče GPG pro podepsání shrnutí"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Generovat delta soubory"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "HLOUBKA"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Generování delta souboru: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Generování delta souboru: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Selhalo generování delta souboru %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Selhalo generování delta souboru %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "UMÍSTĚNÍ - Aktualizovat metadata repozitáře"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Aktualizace appstream větve\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Aktualizace shrnutí\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Celkový počet objektů: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Žádné nedostupné objekty\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Odstraněno %u objektů, %s uvolněno\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Příkaz, který se má spustit"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Větev, která se má použít"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Použije vývojové prostředí"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Prostředí, které se má použít"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Verze prostředí, které se má použít"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Zaznamenávat volání sběrnice zpřístupnění"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Povolit přesměrování souboru"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "APLIKACE [argumenty...] - Spustit aplikaci"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr "TEXT - Vyhledat text ve vzdálených aplikacích/prostředích"
+
+#: app/flatpak-builtins-search.c:220
+msgid "TEXT must be specified"
+msgstr "TEXT musí být určen"
+
+#: app/flatpak-builtins-search.c:270
+msgid "Application ID"
+msgstr "ID aplikace"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr "Verze"
+
+#: app/flatpak-builtins-search.c:273
+msgid "Branch"
+msgstr "Větev"
+
+#: app/flatpak-builtins-search.c:275
+msgid "Remotes"
+msgstr "Vzdálené repozitáře"
+
+#: app/flatpak-builtins-search.c:276
+msgid "Description"
+msgstr "Popis"
+
+#: app/flatpak-builtins-search.c:285
+msgid "No matches found"
+msgstr "Nenalezeny žádné shody"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Architektura k odinstalování"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Nechat ref v lokálním repozitáři"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Neodinstalovat související refy"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Odstranit soubory i za běhu"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF... - Odinstalovat aplikaci"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Alespoň jeden REF musí být určen"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:164
+#, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Odstraňuji: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Architektura, pro kterou se má aktualizovat"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Commit pro deploy"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Odstranit staré soubory i za běhu"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Nedělat pull, pouze aktualizovat z místní cache"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Neaktualizovat související refy"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Aktualizovat appstream pro vzdálený repozitář"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Aktualizovat pouze tuto podcestu"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Aktualizuji appstream pro vzdálený repozitář %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Aktualizuji appstream pro vzdálený repozitář %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr "Chyba během aktualizace: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF...] - Aktualizovat aplikace nebo prostředí"
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr "Vyhledávají se aktualizace...\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Který si přejete instalovat (0 pro zrušení)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Správa instalovaných aplikací a prostředí"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Instalovat aplikaci nebo prostředí"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Aktualizovat instalovanou aplikaci nebo prostředí"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Odinstalovat instalovanou aplikaci nebo prostředí"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Vypsat instalované aplikace a/nebo prostředí"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Zobrazit informace pro nainstalovanou aplikaci či prostředí"
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr "Nastavit flatpak"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr ""
+"\n"
+" Vyhledávají se aplikace a prostředí"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr "Hledat vzdálené aplikace/prostředí"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Spuštěné aplikace"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Spustit aplikaci"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Přepsat oprávnění pro aplikaci"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Určit výchozí verzi ke spuštění"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Vstoupit do jmenného prostoru běžící aplikace"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Správa přístupu k souborům"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Udělit aplikaci přístup k určenému souboru"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Zrušit přístup aplikace k určenému souboru"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Zobrazit informace o určeném souboru"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Zobrazit exportované soubory"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Správa vzdálených repozitářů"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Vypsat všechny nastavené vzdálené repozitáře"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Přidat nový vzdálený repozitář (pomocí URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Měnit vlastnosti nastaveného vzdáleného repozitáře"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Odstranit nastavený vzdálený repozitář"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Vypsat obsah nastaveného vzdáleného repozitáře"
+
+#: app/flatpak-main.c:96
+msgid "Show information about a remote app or runtime"
+msgstr "Zobrazit informace o vzdálené aplikaci či prostředí"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Sestavení aplikací"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inicializovat adresář pro sestavení"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Spustit příkaz k sestavení uvnitř adresáře sestavení"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Dokončit adresář sestavení pro export"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exportovat adresář sestavení do repozitáře"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Vytvořit soubor balíku z adresáře sestavení"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importovat soubor balíku"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Podepsat aplikaci nebo prostředí"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Aktualizovat soubor shrnutí v repozitáři"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Vytvořit nový commit založený na existujícím ref"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Vypsat informace o repozitáři"
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+"Vypsat ladící informace během zpracovávání příkazu, -vv pro více detailů"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Vypsat ladící informace OSTree během zpracovávání příkazu"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Zobrazit volby nápovědy"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Vypsat informace o verzi a skončit"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Vypsat výchozí architekturu a skončit"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Vypsat podporované architektury a skončit"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Vypsat aktivní gl ovladače a skončit"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Pracovat na uživatelských instalacích"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Pracovat na systémových instalacích (výchozí)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Pracovat na specifických systémových instalacích"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NÁZEV"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Vestavěné příkazy:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Neznámý příkaz „%s“"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Nebyl určen žádný příkaz"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "chyba:"
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr "Nalezeno ve vzdáleném repozitáři %s\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Nalezeno ve vzdáleném repozitáři %s, přejete si provést instalaci?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Nalezeno v několika vzdálených repozitářích:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Který si přejete instalovat (0 pro zrušení)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Požadované prostředí pro %s (%s) není nainstalováno, vyhledává se...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr "Požadované prostředí %s nebylo nalezeno v nastaveném repozitáři.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s není nainstalováno"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Vzdálený repozitář %s je zakázán, ignoruji aktualizaci %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s je již nainstalováno, přeskakuji\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s commit %s je již nainstalováno"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr "Varování: Nelze nalézt závislosti: %s\n"
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s vyžaduje novější verzi flatpaku (%s)"
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Chyba během aktualizace vzdálených metadat pro „%s“: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "instalace"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Instaluji: %s z %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Instaluji: %s z %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "aktualizace"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Aktualizuji: %s z %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Aktualizuji: %s z %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Nyní na %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Žádné aktualizace.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "instalace balíku"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Instaluji: %s z balíku %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Instaluji: %s z balíku %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Varování: Selhalo %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Chyba: Selhalo %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Jedna nebo více operací selhalo"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr ""
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Během otevírání repozitáře %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Nemohu vytvořit adresář sestavení"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Neplatný sha256 pro dodatečná data uri %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Prázdný název pro uri dodatečných dat %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Nepodporovaný uri dodatečných dat %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Chyba během načítání místních dodatečných dat %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Chybná velikost pro dodatečná data %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Během stahování %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Chybná velikost pro dodatečná data %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Neplatný kontrolní součet pro dodatečná data %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s commit %s je již nainstalováno"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Během stahování %s ze vzdáleného repozitáře %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Nemohu nalézt %s ve vzdáleném repozitáři %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Nedostatek paměti"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Selhalo čtení z exportovaného souboru"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Chyba při čtení mimetype xml souboru"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Neplatný mimetype xml soubor"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr ""
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr ""
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Neplatný sha256 pro dodatečná data"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Chybná velikost pro dodatečná data"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Neplatný kontrolní součet pro dodatečná data"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Během zapisování souboru dodatečných dat „%s“: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "apply_extra skript selhal, návratová hodnota %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Během pokusu o vyřešení ref %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s není dostupné"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s větev %s je již nainstalováno"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Nelze číst commit %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr ""
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Během pokusu o odstranění existujícího dodatečného adresáře: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Během pokusu o aplikaci dodatečných dat: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Tato verze aplikace %s je již nainstalována"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Nemohu změnit vzdálený repozitář během instalace balíčku"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s větev %s není nainstalováno"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s větev %s nenainstalováno"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr "Pro %s je dostupno více větví, musíte určit jednu z nich: "
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Nic nevyhovuje názvu %s"
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Nemohu nalézt ref %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Chyba během prohledávání vzdáleného repozitáře %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Chyba během prohledávání místního repozitáře: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s nenainstalováno"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Nemohu nalézt instalaci %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Prostředí %s, větev %s je již nainstalováno"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Aplikace %s, větev %s je již nainstalováno"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Jméno vzdáleného adresáře nenastaveno"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Vzdálený default-branch nenastaven"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Žádná cache ve vzdáleném shrnutí"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Žádný záznam pro %s v cache vzdáleného shrnutí "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Neplatný název dbus %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Neplatné umístění systému souborů %s, platná umístění jsou: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Neplatný formát env %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Sdílet s hostitelem"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "SDÍLET"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Zrušit sdílení s hostitelem"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Odhalit soket aplikaci"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Neodhalovat soket aplikaci"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Odhalit zařízení aplikaci"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "ZAŘÍZENÍ"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Neodhalovat zařízení aplikaci"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Umožnit funkci"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNKCE"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Neumožnit funkci"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Odhalit systém souborů aplikaci (:ro pro přístup pouze ke čtení)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SYSTÉM_SOUBORŮ[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Neodhalovat systém souborů aplikaci"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SYSTÉM_SOUBORŮ"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Nastavit proměnnou prostředí"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "PROMĚNNÁ=HODNOTA"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Povolit aplikaci vlastnit název na sběrnici sezení"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NÁZEV_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Povolit aplikaci komunikovat s názvem na sběrnici sezení"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Povolit aplikaci vlastnit název na systémové sběrnici"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Povolit aplikaci komunikovat s názvem na systémové sběrnici"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Přidat generickou volbu bezpečnostní politiky"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSYSTEM.KLÍČ=HODNOTA"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Odebrat generickou volbu bezpečnostní politiky"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Trvalý domovský adresář"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NÁZEV_SOUBORU"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Nevyžadovat běžící sezení (bez vytvoření cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Selhalo otevření dočasného souboru flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Selhalo otevření dočasného souboru: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Selhalo vytvoření synchronizační roury"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Selhalo otevření souboru s informacemi o aplikaci: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Selhala synchronizace s dbus proxy"
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "ldconfig selhal, návratová hodnota %d"
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Migruji %s do %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr "Chyba během migrace: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Žádné zdroje dodatečných dat"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr "Stahuji metadata: %u/(odhadováno) %s"
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr "Stahuji: %s/%s"
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Stahuji dodatečná data: %s/%s"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Stahuji soubory: %d/%d %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Instalovat podepsanou aplikaci"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "K instalaci softwaru je vyžadováno ověření"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Instalovat podepsané prostředí"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Aktualizovat podepsanou aplikaci"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "K aktualizaci softwaru je vyžadováno ověření"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Aktualizovat podepsané prostředí"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Aktualizovat vzdálená metadata"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "K aktualizaci vzdálených informací je vyžadováno ověření"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr "Aktualizovat systémový repozitář"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr "K aktualizaci systémového repozitáře je vyžadováno ověření"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Instalovat balík"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Odinstalovat prostředí"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "K odinstalování softwaru je vyžadováno ověření"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Odinstalovat aplikaci"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Nastavit vzdálený repozitář"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "K nastavení repozitářů softwaru je vyžadováno ověření"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr "Nastavit"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr "K nastavení instalace softwaru je vyžadováno ověření"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Aktualizovat appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Žádný vzdálený repozitář %s"
+
+#~ msgid "Search only user installations"
+#~ msgstr "Prohledat pouze uživatelské instalace"
+
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Prohledat pouze systémové instalace"
+
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Prohledat specifické systémové instalace"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Selhalo vytvoření dočasného souboru"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Selhalo odlinkování dočasného souboru"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Selhal zápis dočasného souboru"
+
+#~ msgid "REMOTE must be specified"
+#~ msgstr "VZDÁLENÉ musí být určeno"
+
+#~ msgid "Building %s"
+#~ msgstr "Sestavuji %s"
+
+#~ msgid "Installing %s"
+#~ msgstr "Instaluji %s"
+
+#~ msgid "Cleanup %s"
+#~ msgstr "Čištění %s"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "„%s“ není platným názvem prostředí: %s"
+
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "„%s“ není platným názvem sdk: %s"
+
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "Název vzdáleného OCI repozitáře musí být určen"
+
+#~ msgid "OCI image is not a flatpak (missing ref)"
+#~ msgstr "OCI obraz není flatpak (chybí ref)"
diff --git a/po/de.gmo b/po/de.gmo
new file mode 100644 (file)
index 0000000..8749de2
Binary files /dev/null and b/po/de.gmo differ
diff --git a/po/de.po b/po/de.po
new file mode 100644 (file)
index 0000000..27a2b58
--- /dev/null
+++ b/po/de.po
@@ -0,0 +1,3008 @@
+# German translation for flatpak.
+# Copyright (C) 2016 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Wolfgang Stöggl <c72578@yahoo.de>, 2016.
+# Mario Blättermann <mario.blaettermann@gmail.com>, 2016-2017.
+# Christian Kirbach <christian.kirbach@gmail.com>, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-04-07 13:52+0200\n"
+"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
+"Language-Team: German <gnome-de@gnome.org>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.8.12\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Nichts unternehmen, wenn die entfernte Quelle existiert"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "ORT legt eine Konfigurationsdatei fest, nicht den Quellort"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "GPG-Überprüfung aktivieren"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Entfernte Quelle markieren als »berücksichtigen«"
+
+# Bedeutung aus flatpak-remote-add.xml
+# Mark the remote as not enumerated. This means the remote will not be used to list applications, for instance in graphical installation tools.
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Ferne Quelle markieren als »Verwendet für Abhängigkeiten«"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Eine neue Adresse festlegen"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "ADRESSE"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Entfernte Quelle aktivieren"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Zusätzliche Metadaten aus der Zusammenfassungsdatei aktualisieren"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "GPG-Überprüfung deaktivieren"
+
+# Bedeutung aus flatpak-remote-add.xml
+# Mark the remote as not enumerated. This means the remote will not be used to list applications, for instance in graphical installation tools.
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Entfernte Quelle markieren als »nicht berücksichtigen«"
+
+# Bedeutung aus flatpak-remote-add.xml
+# Mark the remote as not enumerated. This means the remote will not be used to list applications, for instance in graphical installation tools.
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Ferne Quelle markieren als »Nicht für Abhängigkeiten verwenden«"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Priorität festlegen (Standard 1, mehr bedeutet höhere Priorität)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITÄT"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Ein passender Name für diese entfernte Quelle"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TITEL"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Zu verwendender Vorgabe-Zweig für diese ferne Quelle"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "ZWEIG"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "GPG-Schlüssel aus DATEI importieren (- für stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "DATEI"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Entfernte Quelle deaktivieren"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "OCI-Registrierung hinzufügen"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Namensraum %s konnte nicht geöffnet werden: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Ungültiges Umgebungsformat: %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Ungültiger URI-Typ %s, nur http/https werden unterstützt"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Ungültige Prozesskennung %s"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NAME ORT - Eine ferne Quelle hinzufügen"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NAME muss angegeben werden"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "ORT muss angegeben werden"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Zu viele Argumente"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, fuzzy, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "»%s« ist kein gültiger Anwendungsname: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Entfernt gelegene Quelle %s existiert bereits"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "In der flatpakrepo-Datei ist keine Adresse angegeben"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, fuzzy, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Zusätzliche Metadaten für %s konnten nicht aktualisiert werden"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NAME - Entfernte Quelle verändern"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Entfernter NAME muss angegeben werden"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Fehler beim Aktualisieren der Metadaten für »%s«: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Zusätzliche Metadaten für %s konnten nicht aktualisiert werden"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Laufzeit anstatt der Anwendung exportieren"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Architektur für die gebündelt wird"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARCH"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Adresse für Quelle"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Adresse der flatpakrepo-Datei der Laufzeit"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "GPG-Schlüssel aus DATEI hinzufügen (- für stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "In ein OCI-Abbild anstelle eines Flatpak-Bündels exportieren"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "GPG-Schlüsselkennung zum Unterschreiben des OCI-Abbilds"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "SCHLÜSSEL-Kennung"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "GPG-Basisordner für die Suche nach Schlüsselbünden"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "BASISORDNER"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"ORT DATEINAME NAME [ZWEIG] - Ein einzelnes Dateibündel aus lokaler Quelle "
+"erstellen"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "ORT, DATEINAME und NAME müssen angegeben werden"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "»%s« ist keine gültige Quelle"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "»%s« ist kein gültiger Name: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "»%s« ist kein gültiger Zweig-Name: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Plattform-Laufzeit eher verwenden als Sdk"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "»Bind-Mount« hinzufügen"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "ZIEL=QUELLE"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Erstellung in diesem Ordner starten"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "ORDNER"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Legt fest, wo der eigene sdk-Ordner gesucht wird (Standard ist »usr«)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Alternative Datei für diese Metadaten verwenden"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Sitzungsbus-Aufrufe protokollieren"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Systembus-Aufrufe protokollieren"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "ORDNER [BEFEHL [Argumente …]] - In Ordner Erstellen"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "ORDNER muss angegeben werden"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"Erstellungsordner %s ist nicht initialisiert. Verwenden Sie flatpak build-"
+"init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "Metadaten sind ungültig. Es ist keine Anwendung oder Laufzeit"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Kein Erweiterungspunkt entspricht %s in %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Fehlendes »=« in Bind-Mount-Option »%s«"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Anwendung kann nicht gestartet werden"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Quellenordner"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "QUELL-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Quellenreferenz"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "QUELL-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Einzeiliger Betreff"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "BETREFF"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Vollständige Beschreibung"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TEXTKÖRPER"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Appstream-Zweig aktualisieren"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Die Zusammenfassung nicht aktualisieren"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "GPG-Schlüsselkennung zum Unterschreiben des »Commit«"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"ZIEL-REPO [ZIEL-REF]... - Einen neuen Commit auf Basis eines/mehrerer "
+"vorhandener Commits ausführen"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "ZIEL-REPO muss angegeben werden"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Wenn --src-repo nicht angegeben ist, so muss genau eine Zielreferenz "
+"angegeben werden"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Wenn --src-ref nicht angegeben ist, so muss genau eine Zielreferenz "
+"angegeben werden"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Es muss entweder --src-repo oder --src-ref angegeben werden."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Zu exportierende Architektur (muss kompatibel mit dem Rechner sein)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Commit von Laufzeit (/usr), nicht /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Alternativen Ordner für die Dateien verwenden"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "UNTERORDNER"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Auszuschließende Dateien"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "MUSTER"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Einzuschließende ausgeschlossene Dateien"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Temporäre Datei konnte nicht geöffnet werden: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Ungültiger URI-Typ %s, nur http/https werden unterstützt"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+"Basisname konnte in %s nicht gefunden werden, bitte geben Sie einen Namen "
+"explizit an"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Schrägstriche sind nicht im zusätzlichen Datennamen erlaubt"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Ungültiges Format der sha256-Prüfsumme: »%s«"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Größe 0 der Extradaten wird nicht unterstützt"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "ORT ORDNER [ZWEIG] - Quelle aus Erstellungsordner erzeugen"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "ORT und ORDNER müssen angegeben werden"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "In den Metadaten ist kein Name angegeben"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Details zur entfernten Quelle anzeigen"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Details zur entfernten Quelle anzeigen"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Festzulegender Befehl"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "BEFEHL"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Benötigte Flatpak-Version"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Exporte nicht verarbeiten"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Zusätzliche Dateninformation"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Information zu Erweiterungspunkt hinzufügen"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NAME=VARIABLE[=WERT]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Die für die App verwendete Laufzeit ändern"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Die für die App verwendete Laufzeit ändern"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "LAUFZEIT"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Allgemeine Metadaten-Einstellungen festlegen"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPPE=SCHLÜSSEL[=WERT]]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Zusammenfassung wird aktualisiert\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Zu wenige Elemente im Argument %s von --extra-data"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Zu wenige Elemente im Argument %s von --metadata. Das Format ist "
+"GRUPPE=SCHLÜSSEL[=WERT]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Zu wenige Elemente für den Parameter %s von --extension. Das Format ist "
+"NAME=VAR[=WERT]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "ORDNER - einen Erstellungsordner abschließen"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Erstellungsordner %s ist nicht initialisiert"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Erstellungsordner %s wurde bereits finalisiert"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Bitte überprüfen Sie die exportierten Dateien und die Metadaten\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Referenz für das importierte Bündel ersetzen"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "OCI-Abbild anstelle eines Flatpak-Bündels importieren"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Referenz »%s« wurde in der Registrierungsdatenbank nicht gefunden"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+"Mehrere Abbilder in der Registrierungsdatenbank, geben Sie eine Referenz mit "
+"--ref an"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Aktualisieren: %s von %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "ORT DATEINAME - Ein Dateibündel in eine lokale Quelle importieren"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "ORT und DATEINAME müssen angegeben werden"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Zu verwendende Architektur"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Variable anhand angegebener Laufzeit initialisieren"
+
+#: app/flatpak-builtins-build-init.c:51
+#, fuzzy
+msgid "Initialize apps from named app"
+msgstr "Variable anhand angegebener Laufzeit initialisieren"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APP"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Version für --base angeben"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSION"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Diese Basiserweiterung einschließen"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "ERWEITERUNG"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "/usr mit einer schreibbaren Kopie der sdk initialisieren"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Geben Sie den Erstellungstyp an (App, Laufzeit, Erweiterung)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TYP"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Schlagwort hinzufügen"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "SCHLAGWORT"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Diese sdk-Erweiterung in /usr einschließen"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Legt fest, wo sdk gespeichert wird (Standard ist »usr«)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "sdk/var reinitialisieren"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Angeforderte Erweiterung »%s« ist nur teilweise installiert"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Angeforderte Erweiterung »%s« ist nicht installiert"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"ORDNER ANWENDUNGSNAME SDK LAUFZEIT [ZWEIG] - Einen Erstellungsordner "
+"initialisieren"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "LAUFZEIT muss angegeben werden"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "»%s« ist kein gültiger Anwendungsname: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Erstellungsordner %s ist bereits initialisiert"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Architektur, für die installiert wird"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Nach Laufzeit unter dem angegebenen Namen suchen"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "QUELLE [NAME [ZWEIG]] - Eine Anwendung oder Laufzeit signieren"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Keine gpg-Schlüsselkennungen angegeben"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Unbekannter Befehl »%s«"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "ANWENDUNG muss angegeben werden"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Entfernte Quelle entfernen, selbst wenn sie in Verwendung ist"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NAME - Entfernte Quelle löschen"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Eine eindeutige Dokumentenreferenz erstellen"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Das Dokument transient für die aktuelle Sitzung machen"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Es ist nicht erforderlich, dass die Datei bereits vorhanden ist"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Der Anwendung Lese-Berechtigungen erteilen"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Der Anwendung Schreib-Berechtigungen erteilen"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Der Anwendung Lösch-Berechtigungen erteilen"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr ""
+"Der Anwendung Berechtigungen erteilen, weitere Berechtigungen zu gewähren"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Lese-Berechtigungen der Anwendung widerrufen"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Schreib-Berechtigungen der Anwendung widerrufen"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Lösch-Berechtigungen der Anwendung widerrufen"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Berechtigungen widerrufen, weitere Berechtigungen zu gewähren"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Dieser Anwendung Berechtigungen erteilen"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "ANWENDUNGSKENNUNG"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "DATEI - Eine Datei an Anwendungen exportieren"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "DATEI muss angegeben werden"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "DATEI - Informationen über die exportierte Datei erhalten"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Nicht exportiert\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[ANWENDUNGSKENNUNG] - Exportierte Dateien auflisten"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "DATEI - Export einer Datei an Anwendungen rückgängig machen"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [BEFEHL [Argumente …]] - Einen Befehl in einer laufenden "
+"Sandbox ausführen"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "SANDBOXEDPID und BEFEHL müssen angegeben werden"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Ungültige Prozesskennung %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Prozesskennung %s nicht vorhanden"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "cwd kann nicht gelesen werden"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "root kann nicht gelesen werden"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Ungültiger %s-Namensraum für Prozesskennung %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Ungültiger %s-Namensraum für sich selbst"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Namensraum %s konnte nicht geöffnet werden: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "In den Namensraum %s konnte nicht gewechselt werden: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "chdir nicht möglich"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "chroot nicht möglich"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Gruppenkennung kann nicht gewechselt werden"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Benutzerkennung kann nicht gewechselt werden"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Benutzerinstallationen anzeigen"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Systemweite Installationen anzeigen"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Spezifische systemweite Installationen anzeigen"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Referenz anzeigen"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Commit anzeigen"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Ursprung anzeigen"
+
+#: app/flatpak-builtins-info.c:55
+#, fuzzy
+msgid "Show size"
+msgstr "Referenz anzeigen"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+#, fuzzy
+msgid "Show metadata"
+msgstr "Details zur entfernten Quelle anzeigen"
+
+#: app/flatpak-builtins-info.c:57
+#, fuzzy
+msgid "Show extensions"
+msgstr "Hilfeoptionen anzeigen"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NAME [ZWEIG] - Informationen über installierte Anwendung und/oder Laufzeit "
+"erhalten"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+#, fuzzy
+msgid "Branch:"
+msgstr "Zu verwendender Zweig"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+#, fuzzy
+msgid "Installed size:"
+msgstr "Signierte Laufzeitumgebung installieren"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+#, fuzzy
+msgid "Runtime:"
+msgstr "Zu verwendende Laufzeitumgebung"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:308
+#, fuzzy
+msgid "Extension:"
+msgstr "Hilfeoptionen anzeigen"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "COMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Nach einer Anwendung mit dem angegebenen Namen suchen"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Referenz anzeigen"
+
+#: app/flatpak-builtins-info-remote.c:121
+#, fuzzy
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr "Anwendung oder Laufzeit von einer entfernten Quelle installieren"
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "FERNE QUELLE und REFERENZ muss angegeben werden"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Referenz anzeigen"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Commit anzeigen"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Keinen »Pull« ausführen, Installation nur aus lokalem Zwischenspeicher"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Nicht bereitstellen, nur in lokalen Zwischenspeicher herunterladen"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Zugehörige Referenzen nicht installieren"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Laufzeitabhängigkeiten nicht prüfen/installieren"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "ORT als .flatpak Einzelbündel-Datei ansehen"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "ORT als .flatpakref-Anwendungsbeschreibung ansehen"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Bündel-Signaturen anhand des GPG-Schlüssels aus DATEI prüfen (- für "
+"Standardeingabe)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Nur diesen Unterpfad installieren"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "PFAD"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Automatisch alle Fragen mit ja beantworten"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s-Commit %s wurde bereits installiert"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "%s wird als neue ferne Quelle »%s« eingerichtet"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Name der Bündel-Datei muss angegeben werden"
+
+#: app/flatpak-builtins-install.c:274
+#, fuzzy
+msgid "Remote bundles are not supported"
+msgstr "Entfernter Titel nicht festgelegt"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Dateiname oder URI muss angegeben werden"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Installieren: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "ORT/GEGENSTELLE [REF…] - Anwendungen oder Laufzeiten installieren"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Zusätzliche Informationen anzeigen"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Installierte Laufzeitumgebungen auflisten"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Installierte Anwendungen auflisten"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Anzuzeigende Architektur"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+#, fuzzy
+msgid "Installed size"
+msgstr "Signierte Laufzeitumgebung installieren"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Installierte Anwendungen und/oder Laufzeiten auflisten"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Details zur entfernten Quelle anzeigen"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Deaktivierte entfernte Quellen anzeigen"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Entfernte Quellen auflisten"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Architekturen und Zweige zeigen"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Nur Laufzeitumgebungen anzeigen"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Nur Anwendungen anzeigen"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Nur Anwendungen anzeigen, die aktualisiert werden können"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Auf diese Architektur begrenzen (* für alle)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr "ENTFERNTE QUELLE - Verfügbare Laufzeiten und Anwendungen anzeigen"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:179
+#, fuzzy
+msgid "Download size"
+msgstr "Referenz anzeigen"
+
+#: app/flatpak-builtins-ls-remote.c:301
+#, fuzzy
+msgid "No ref information available in repository"
+msgstr "DATEI - Informationen über die exportierte Datei erhalten"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Architektur als aktuell festlegen für"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "ANWENDUNG ZWEIG - Zweig der Anwendung aktuell setzen"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "ANWENDUNG muss angegeben werden"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "ZWEIG muss angegeben werden"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Anwendung %s Zweig %s ist nicht installiert"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "ANWENDUNG - Einstellungen für Anwendung ersetzen"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+#, fuzzy
+msgid "Installed"
+msgstr "installieren"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:151
+#, fuzzy
+msgid "Print general information about the repository"
+msgstr "DATEI - Informationen über die exportierte Datei erhalten"
+
+#: app/flatpak-builtins-repo.c:152
+#, fuzzy
+msgid "List the branches in the repository"
+msgstr "Vorgabezweig für diese Quelle"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:168
+#, fuzzy
+msgid "LOCATION - Repository maintenance"
+msgstr "ORT - Metadaten der Quelle aktualisieren"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Ein passender Name für diese Quelle"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Vorgabezweig für diese Quelle"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "GPG-Schlüsselkennung zum Unterschreiben der Zusammenfassung"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Differenzdateien erzeugen"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Ungenutzte Objekte abschneiden"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Nur übergeordnete Ebenen der angegebenen TIEFE für jeden Commit durchqueren "
+"(Standard: -1=unendlich)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "TIEFE"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Delta wird erstellt: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Delta wird erstellt: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Erstellung des Delta %s (%.10s) fehlgeschlagen: %s\n"
+
+#: app/flatpak-builtins-repo-update.c:206
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Erstellung des Delta %s (%.10s-%.10s) fehlgeschlagen: %s\n"
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "ORT - Metadaten der Quelle aktualisieren"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Appstream-Zweig wird aktualisiert\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Zusammenfassung wird aktualisiert\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Objekte gesamt: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Keine unerreichbaren Objekte\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u Objekte gelöscht, %s freigemacht\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Auszuführender Befehl"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Zu verwendender Zweig"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Entwickler-Laufzeitumgebung verwenden"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Zu verwendende Laufzeitumgebung"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Zu verwendende Laufzeit"
+
+#: app/flatpak-builtins-run.c:60
+#, fuzzy
+msgid "Log accessibility bus calls"
+msgstr "Sitzungsbus-Aufrufe protokollieren"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "ANWENDUNG [Argumente …] - Eine Anwendung ausführen"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "ENTFERNTE QUELLE muss angegeben werden"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Eine Anwendung ausführen"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Zu verwendender Zweig"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Keine entfernte Quelle %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Vollständige Beschreibung"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Kein Treffer für %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Zu installierende Architektur"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Referenz in lokaler Quelle behalten"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Zugehörige Referenzen nicht deinstallieren"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Dateien entfernen, selbst wenn sie in Verwendung sind"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF… - Eine Anwendung deinstallieren"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Es muss zumindest eine REFERENZ angegeben werden"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Warnung: Problem bei der Suche nach zugehörigen Referenzen: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Installieren: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Architektur für Aktualisierung"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Bereitzustellender Commit"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Alte Dateien entfernen, selbst wenn sie in Verwendung sind"
+
+# Alternative: Nicht herunterziehen, …
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr ""
+"Keinen »Pull« ausführen, nur aus lokalem Zwischenspeicher aktualisieren"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Zugehörige Referenzen nicht aktualisieren"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Appstream für entfernte Quelle aktualisieren"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Nur diesen Unterpfad aktualisieren"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Appstream für ferne Quelle %s wird aktualisiert\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Appstream für ferne Quelle %s wird aktualisiert\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Zusammenfassung wird aktualisiert\n"
+
+#: app/flatpak-builtins-update.c:143
+#, fuzzy, c-format
+msgid "Remote \"%s\" not found"
+msgstr "Daten wurden nicht gefunden"
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF…] - Anwendungen oder Laufzeitumgebungen aktualisieren"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Nach %s suchen\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Was wollen Sie installieren (0 zum Abbrechen)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Installierte Anwendungen und Laufzeitumgebungen verwalten"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Eine Anwendung oder Laufzeitumgebung installieren"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Eine installierte Anwendung oder Laufzeitumgebung aktualisieren"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Eine installierte Anwendung oder Laufzeitumgebung deinstallieren"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Installierte Anwendungen und/oder Laufzeitumgebungen auflisten"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Informationen zu installierter Anwendung oder Laufzeit anzeigen"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Ferne Quelle einrichten"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Eine Anwendung oder Laufzeitumgebung signieren"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Anwendungen ausführen"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Eine Anwendung ausführen"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Berechtigungen für eine Anwendung ersetzen"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Die als Standard auszuführende Version angeben"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "In den Namensraum einer laufenden Anwendung wechseln"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Dateizugriff verwalten"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Einer Anwendung den Zugriff auf eine bestimmte Datei gewähren"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Den Zugriff auf eine bestimmte Datei widerrufen"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Informationen zu einer bestimmten Datei anzeigen"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Exportierte Dateien auflisten"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Entfernte Quellen verwalten"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Alle konfigurierten entfernten Quellen auflisten"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Eine neue entfernte Quelle hinzufügen (mittels Adresse)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Eigenschaften einer konfigurierten entfernten Quelle verändern"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Eine konfigurierte entfernte Quelle löschen"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Inhalt einer konfigurierten entfernten Quelle auflisten"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Informationen zu installierter Anwendung oder Laufzeit anzeigen"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Anwendungen erstellen"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Einen Ordner für die Erstellung initialisieren"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Einen Erstellungsbefehl innerhalb des Erstellungsordners ausführen"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Einen Erstellungsordner für den Export finalisieren"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Erstellungsordner in eine Quelle exportieren"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Eine Bündel-Datei aus einem Erstellungsordner erzeugen"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Eine Bündel-Datei importieren"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Eine Anwendung oder Laufzeitumgebung signieren"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Zusammenfassungsdatei in einer Quelle aktualisieren"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Neuen Commit basierend auf existierendem Ref erstellen"
+
+#: app/flatpak-main.c:109
+#, fuzzy
+msgid "Print information about a repo"
+msgstr "DATEI - Informationen über die exportierte Datei erhalten"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Fehlerdiagnoseinformationen während der Befehlsverarbeitung ausgeben"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr ""
+"OSTree-Fehlerdiagnoseinformationen während der Befehlsverarbeitung ausgeben"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Hilfeoptionen anzeigen"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Versionsinformationen ausgeben und beenden"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Standard-Architektur ausgeben und beenden"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Unterstützte Architekturen ausgeben und beenden"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Aktiven GL-Treiber ausgeben und beenden"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Benutzerinstallationen bearbeiten"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Systemweite Installationen bearbeiten (Standard)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Auf einer spezifischen systemweiten Installation arbeiten"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "NAME"
+msgstr "DATEINAME"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Eingebaute Befehle:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Unbekannter Befehl »%s«"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Kein Befehl angegeben"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "Fehler:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "In verschiedenen fernen Quellen gefunden:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr ""
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "In verschiedenen fernen Quellen gefunden:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Was wollen Sie installieren (0 zum Abbrechen)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr ""
+"Erforderliche Laufzeit für %s (%s) ist nicht installiert. Suche läuft …\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Die erforderliche Laufzeit %s wurde in keiner konfigurierten entfernten "
+"Quelle gefunden.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s ist nicht installiert"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Entfernte Quelle %s ist deaktiviert. Aktualisierung %s wird ignoriert"
+
+#: app/flatpak-transaction.c:525
+#, fuzzy, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s ist bereits installiert"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s-Commit %s wurde bereits installiert"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s verlangt eine neuere Version von flatpak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Fehler beim Aktualisieren der Metadaten für »%s«: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "installieren"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Installieren: %s von %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Installieren: %s von %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "update"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Aktualisieren: %s von %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Aktualisieren: %s von %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Jetzt bei %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Keine Aktualisierungen.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "Bündel installieren"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Installieren: %s von Bündel %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Installieren: %s von Bündel %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Warnung:  %s %s fehlgeschlagen: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Fehler: %s %s ist fehlgeschlagen: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Ein oder mehrere Vorgänge sind fehlgeschlagen"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Keine Ersetzungen für %s gefunden"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Während des Öffnens der Quelle %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Bereitstellungsordner konnte nicht erstellt werden"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Ungültiges sha256 für die Adresse %s der Extradaten"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Leerer Name für die Adresse %s der Extradaten"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Nicht unterstützte Adresse %s der Extradaten"
+
+#: common/flatpak-dir.c:2647
+#, fuzzy, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Commit %s konnte nicht gelesen werden: "
+
+#: common/flatpak-dir.c:2650
+#, fuzzy, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Falsche Größe für Extradaten %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Während des Herunterladens von %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Falsche Größe für Extradaten %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Ungültige Prüfsumme für Extradaten %s"
+
+#: common/flatpak-dir.c:2742
+#, fuzzy
+msgid "Remote OCI index has no registry uri"
+msgstr "NAME [ORT] - eine ferne Quelle hinzufügen"
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s-Commit %s wurde bereits installiert"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Während des Holens von %s von der entfernten Quelle %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "%s konnte nicht in entfernter Quelle %s gefunden werden"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Nicht genug Speicher"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Lesen aus der exportierten Datei fehlgeschlagen"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Während des Versuchs, abgekoppelte Metadaten zu holen: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Beim Anlegen von extradir: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Ungültige sha256 für zusätzliche Daten"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Falsche Größe für zusätzliche Daten"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Ungültige Prüfsumme für zusätzliche Daten"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Fehler beim Schreiben der zusätzlichen Datendatei: »%s«: "
+
+#: common/flatpak-dir.c:5181
+#, fuzzy, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Skript apply_extra ist fehlgeschlagen"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Während des Auflösens der Referenz %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s ist nicht verfügbar"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s Zweig %s wurde bereits installiert"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Commit %s konnte nicht gelesen werden: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Während des Versuchs, eine Arbeitskopie von %s nach %s zu erstellen: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr ""
+"Während des Versuchs, eine Arbeitskopie des Metadaten-Unterordners zu "
+"erstellen: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Während des Versuchs, den bestehenden Extraordner zu entfernen: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Während des Versuchs, zusätzliche Daten anzuwenden: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Ungültige Prozesskennung %s"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Ungültige Prozesskennung %s"
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Diese Version von %s ist bereits installiert"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr ""
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s Zweig %s ist nicht installiert"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s Zweig %s ist nicht installiert"
+
+#: common/flatpak-dir.c:7489
+#, fuzzy, c-format
+msgid "Pruning repo failed: %s"
+msgstr "Zugehörige werden installiert: %s\n"
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Kein Treffer für %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "%s%s%s%s%s kann nicht in ferner Quelle %s gefunden werden"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Fehler: %s %s ist fehlgeschlagen: %s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Referenz in lokaler Quelle behalten"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s ist nicht installiert"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Installation %s konnte nicht gefunden werden"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Laufzeitumgebung %s, Zweig %s ist bereits installiert"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Anwendung %s, Zweig %s ist bereits installiert"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Entfernter Titel nicht gesetzt"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Vorgabe-Zweig für ferne Quelle nicht definiert"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr ""
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr ""
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Unbekannter Freigabetyp %s, zulässige Typen sind: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Unbekannter Regeltyp %s, zulässige Typen sind: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Ungültiger Dbus-Name %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Unbekannter Socket-Typ %s, zulässige Typen sind: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Unbekannter Gerätetyp %s, zulässige Typen sind: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Unbekannter Funktionstyp %s, zulässige Typen sind: %s"
+
+#: common/flatpak-run.c:774
+#, fuzzy, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Unbekannter Dateisystem-Ort %s, zulässige Typen sind: host, home, xdg-"
+"*[/...], ~/Ordner, /Ordner"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Ungültiges Umgebungsformat: %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Mit Rechner teilen"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "FREIGABE"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Freigabe für Rechner aufheben"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Socket für die Anwendung sichtbar machen"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOCKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Socket vor der Anwendung verbergen"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Gerät für die Anwendung sichtbar machen"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "GERÄT"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Gerät vor der Anwendung verbergen"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Funktion erlauben"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNKTION"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Funktion nicht erlauben"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+"Das Dateisystem für die Anwendung sichtbar machen (:ro für schreibgeschützt)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "DATEISYSTEM[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Das Dateisystem vor der Anwendung verbergen"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "DATEISYSTEM"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Umgebungsvariable festlegen"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VAR=WERT"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr ""
+"Der Anwendung erlauben, einen Namen auf dem Sitzungsbus zu beanspruchen"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "DBUS_NAME"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Der Anwendung erlauben, mit Namen auf dem Sitzungsbus zu kommunizieren"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr ""
+"Der Anwendung erlauben, einen Namen auf dem Sitzungsbus zu beanspruchen"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Der Anwendung erlauben, mit Namen auf dem Systembus zu kommunizieren"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Allgemeine Richtlinien-Einstellungen hinzufügen"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSYSTEM.SCHLÜSSEL=WERT"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Allgemeine Richtlinien-Einstellungen entfernen"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Basisordner beständig machen"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "DATEINAME"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr ""
+"Laufende Sitzung als nicht erforderlich festlegen (keine Erstellung von "
+"cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Öffnen der temporären flatpak-Informationsdatei fehlgeschlagen: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Temporäre Datei konnte nicht geöffnet werden: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "»Sync-Pipe« konnte nicht erstellt werden"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Öffnen der Informationsdatei der Anwendung fehlgeschlagen: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Abgleich mit Dbus-Proxy ist fehlgeschlagen"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "Skript apply_extra ist fehlgeschlagen"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Aktualisieren: %s von %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Fehler: %s %s ist fehlgeschlagen: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Keine zusätzlichen Datenquellen"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Referenz anzeigen"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Referenz anzeigen"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Referenz anzeigen"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Signierte Anwendung installieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Legitimierung wird benötigt, um Software zu installieren"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Signierte Laufzeitumgebung installieren"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Signierte Anwendung aktualisieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Legitimierung wird benötigt, um Software zu aktualisieren"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Signierte Laufzeitumgebung aktualisieren"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+#, fuzzy
+msgid "Update remote metadata"
+msgstr "ORT - Metadaten der Quelle aktualisieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+#, fuzzy
+msgid "Authentication is required to update remote info"
+msgstr "Legitimierung wird benötigt, um Software zu aktualisieren"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Zusammenfassungsdatei in einer Quelle aktualisieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Legitimierung wird benötigt, um Software zu aktualisieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Bündel installieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Laufzeitumgebung deinstallieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Legitimierung wird benötigt, um Software zu deinstallieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Anwendung deinstallieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Ferne Quelle einrichten"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Legitimierung wird benötigt, um die Softwarequellen zu konfigurieren"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Ferne Quelle einrichten"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr "Legitimierung wird benötigt, um die Softwarequellen zu konfigurieren"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Appstream aktualisieren"
+
+#~ msgid "No remote %s"
+#~ msgstr "Keine entfernte Quelle %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Benutzerinstallationen anzeigen"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Systemweite Installationen anzeigen"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Spezifische systemweite Installationen anzeigen"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Temporäre Datei konnte nicht erstellt werden"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Verbindung zur temporären Datei konnte nicht gelöst werden"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "In temporäre Datei konnte nicht geschrieben werden"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Installieren: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Installieren: %s\n"
+
+#, fuzzy
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "Name der Bündel-Datei muss angegeben werden"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "»%s« ist kein gültiger Laufzeitname: %s"
+
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "»%s« ist kein gültiger sdk-Name: %s"
+
+#~ msgid "Data not found for ref %s"
+#~ msgstr "Daten für Referenz %s nicht gefunden"
+
+#~ msgid "Install from local bundle file"
+#~ msgstr "Aus einer lokalen Bündel-Datei installieren"
+
+#, fuzzy
+#~ msgid "Load options from file or uri"
+#~ msgstr "Einstellungen aus Datei laden"
+
+#, fuzzy
+#~ msgid "Invalid ref, no digest"
+#~ msgstr "Ungültiges Umgebungsformat: %s"
+
+#, fuzzy
+#~ msgid "No manfest found for arch %s, os %s"
+#~ msgstr "Daten für Referenz %s nicht gefunden"
+
+#, fuzzy
+#~ msgid "Remote extra metadata not available; server has no summary file"
+#~ msgstr ""
+#~ "Entfernter Titel nicht verfügbar; Server hat keine Zusammenfassungsdatei"
+
+#~ msgid "Data not available; server has no summary file"
+#~ msgstr "Daten sind nicht verfügbar, der Server hat keine Summary-Datei"
+
+#~ msgid "This version of ostree is to old to support OCI exports"
+#~ msgstr "Diese Version von ostree ist zu alt, um OCI-Exporte zu unterstützen"
+
+#~ msgid "This version of flatpak is not compiled with libarchive support"
+#~ msgstr ""
+#~ "Diese Version von flatpak ist nicht mit libarchive-Unterstützung "
+#~ "kompiliert"
+
+#~ msgid "While pulling %s from remote %s, metadata: "
+#~ msgstr "Während des Holens von %s von der entfernten Quelle %s, Metadaten: "
+
+#~ msgid "While pulling %s from remote %s, subpath %s: "
+#~ msgstr ""
+#~ "Während des Holens von %s von der entfernten Quelle %s: Unterordner %s: "
+
+#~ msgid "The Flatpak Project"
+#~ msgstr "Das Flatpak-Projekt"
+
+#~ msgid "auth_admin"
+#~ msgstr "auth_admin"
+
+#~ msgid "yes"
+#~ msgstr "ja"
+
+#~ msgid "REPOSITORY and NAME must be specified"
+#~ msgstr "QUELLE und NAME müssen angegeben werden"
+
+#~ msgid "Uninstalling related: %s\n"
+#~ msgstr "Zugehörige werden deinstalliert: %s\n"
+
+#~ msgid "Warning: Failed to uninstall related ref: %s\n"
+#~ msgstr "Warnung: Deinstallation zugehöriger Referenz fehlgeschlagen: %s\n"
+
+#~ msgid "Updating application %s, branch %s\n"
+#~ msgstr "Anwendung %s, Zweig %s wird aktualisiert\n"
+
+#~ msgid "Updating runtime %s, branch %s\n"
+#~ msgstr "Laufzeitumgebung %s, Zweig %s wird aktualisiert\n"
+
+#~ msgid "LOCATION ID [BRANCH] - Create a repository from a build directory"
+#~ msgstr "ORT KENNUNG [ZWEIG] - Quelle aus Erstellungsordner erzeugen"
+
+#~ msgid ""
+#~ "Warning: Can't find appstream-builder, unable to update appstream branch\n"
+#~ msgstr ""
+#~ "Warnung: Appstream-Builder nicht gefunden, eine Aktualisierung des "
+#~ "Appstream-Zweiges ist nicht möglich\n"
+
+#~ msgid "Generating from-parent delta for %s (%s)\n"
+#~ msgstr "»Von-Vorläufer«-Delta wird erstellt für %s (%s)\n"
diff --git a/po/en@boldquot.header b/po/en@boldquot.header
new file mode 100644 (file)
index 0000000..fedb6a0
--- /dev/null
@@ -0,0 +1,25 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
+# This catalog furthermore displays the text between the quotation marks in
+# bold face, assuming the VT100/XTerm escape sequences.
+#
diff --git a/po/en@quot.header b/po/en@quot.header
new file mode 100644 (file)
index 0000000..a9647fc
--- /dev/null
@@ -0,0 +1,22 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
diff --git a/po/es.gmo b/po/es.gmo
new file mode 100644 (file)
index 0000000..1488dfb
Binary files /dev/null and b/po/es.gmo differ
diff --git a/po/es.po b/po/es.po
new file mode 100644 (file)
index 0000000..085aef2
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,2930 @@
+# Spanish translation for flatpak.
+# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Aitor González Fernández <reimashi@gmail.com>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-09-12 17:20+0200\n"
+"Last-Translator: Aitor González Fernández <reimashi@gmail.com>\n"
+"Language-Team: Spanish <gnome-es-list@gnome.org>\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.8.7.1\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "No hacer nada si el repositorio remoto ya existe"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr ""
+"LOCATION establece un archivo de configuración, lo la localización de un "
+"repositorio"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Habilitar la verificación GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Establecer el remoto como enumerado"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Establecer el remoto como usado por las dependencias"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Establecer una nueva url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Habilitar el repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Actualizar los metadatos extra desde el archivo de resumen"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Desactivar la verificación GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Establecer el remoto como no enumerado"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Establecer el remoto como no usado por las dependencias"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Establecer prioridad (1 por defecto, mayor prioridad cuanto más alto)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORIDAD"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Un buen nombre para usar en este repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TÍTULO"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Rama por defecto para usar en este repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "RAMA"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "ID-COLECCIÓN"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importar la clave GPG desde un ARCHIVO (- para stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "ARCHIVO"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Desactivar el repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Añadir registro OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "No se puede abrir el espacio de nombres %s: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Formato de entorno inválido %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Tipo de enlace %s inválido, solo se soportan http/https"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "PID %s inválido"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NOMBRE LOCALIZACIÓN - Añadir un repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "Se debe especificar el NOMBRE"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "Se debe especificar la LOCALIZACIÓN"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Demasiados argumentos"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "'%s' no es una colección válida de ID's: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+"La verificación GPG es obligatoria si las colecciones están habilitadas"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "El repositorio remoto %s ya existe"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "No se ha especificado una url en el archivo flatpakrepo"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr ""
+"Aviso: No se pueden actualizar los metadatos adicionales para '%s': %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NOMBRE - Modificar un repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Se debe especificar el NOMBRE del repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+"Actualizando los metadatos adicionales desde el resumen remoto para %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Error al actualizar los metados adicionales para '%s': %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "No se han podido actualizar los metadatos adicionales para %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exportar el runtime en lugar de la aplicación"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Arquitectura para empaquetar"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARQUITECTURA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url del repositorio"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url del archivo flatpakrepo del runtime"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Añadir clave GPG desde ARCHIVO (- para stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Exportar imagen oci en lugar de un paquete flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID de la clave GPG para firmar la imagen OCI con"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ID-CLAVE"
+
+# "Llaveros" is the literal translate of keyrings, but in spanish don't mean exactly the same in software slang. A more correct translation would be "repositorios de claves" that means "key repositories".
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr ""
+"Directorio de origen de los archivos GPG para usar cuando se busquen "
+"repositorios de claves"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "DIRECTORIO_DE_INICIO"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"LOCALIZACIÓN NOMBRE_ARCHIVO NOMBRE [RAMA] - Crear un paquete único desde un "
+"repositorio local"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "Se deben especificar LOCALIZACIÓN, NOMBRE_ARCHIVO y NOMBRE"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "'%s' no es un repositorio válido"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "'%s' no es un nombre válido: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "'%s' no es un nombre válido para una rama: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Usar el runtime de la plataforma en en lugar del Sdk"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Añadir punto de montaje"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "DEST=ORIG"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Iniciar la compilación en este directorio"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "DIR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Donde buscar el directorio personalizado de SDK (Por defecto 'usr)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Usar un archivo alternativo para los metadatos"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Matar el proceso cuando el proceso padre muere"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Llamadas al bus de registro de sesión"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Llamadas al bus de registro de sistema"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "DIRECTORIO [COMANDO [argumentos...]] - Compilar en directorio"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "Se debe especificar el DIRECTORIO"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"El directorio de compilación %s no está inicializado, usa el comando flatpak "
+"build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "metadatos inválidos, sin aplicación o runtime"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "No hay un punto de extensión que coincida con %s en %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Falta un '=' en las opciones de punto de montaje '%s'"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "No se pudo iniciar la aplicación"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Dirección del repositorio de código fuente"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "SRC-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Referencia del repositorio de código fuente"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "SRC-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Resumen en una linea"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "RESUMEN"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Descripción completa"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "CUERPO"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Actualizar la rama de appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "No actualizar el resumen"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID de la clave GPG con la que firmar el commit"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"REPO-DEST [REF-DEST]... - Realiza un nuevo commit basado en en los commit(s) "
+"existentes"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "Se debe especificar REPO-DEST"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Si no se especifica --src-repo, se debe especificar exactamente una "
+"referencia de destino"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Si se especifica --src-ref, se debe especificar exactamente una referencia "
+"de destino"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Se debe especificar --src-repo o -src-ref."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "No se puede hacer un commit a partir de otro commit parcial."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Arquitectura en la que exportar (debe ser compatible con el anfitrión)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Runtime del commit (/usr), no /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Usar un directorio alternativo para estos archivos"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "SUBDIR"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Archivos a excluir"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "PATRÓN"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Archivos excluidos a incluir"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Sobrescribir la marca de tiempo del commit"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ISO-8601-TIMESTAMP"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Fallo al abrir un archivo temporal: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Tipo de enlace %s inválido, solo se soportan http/https"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+"No se puede encontrar el nombre base en %s, especifica un nombre "
+"explicitamente"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "No se permiten barras en el nombre de los datos adicionales"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Formato inválido de la suma de verificación sha256: '%s'"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Los datos adicionales no pueden tener tamaño 0"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+"LOCALIZACIÓN DIRECTORIO [RAMA] - Crea un repositorio desde un directorio de "
+"compilación"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "Se debe especificar LOCALIZACION y DIRECTORIO"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "No se ha especificado un nombre en los metadatos"
+
+#: app/flatpak-builtins-build-export.c:976
+#, fuzzy, c-format
+msgid "Commit: %s\n"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Metadatos:"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Metadatos:"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Comando a establecer"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "COMANDO"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Versión de Flatpak requerida"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAJOR.MINOR.MICRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "No procesar los exports"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Información de datos adicionales"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Añadir información del punto de extensión"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NOMBRE=VARIABLE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Cambiar el SDK usado por la aplicación"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Cambiar el runtime usado por la aplicación"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "RUNTIME"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Establecer la opción de metadatos genéricos"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPO=CLAVE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Actualizando %s"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Demasiados elementos en el argumento --extra-data %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Demasiados elementos en el argumento --metadata %s, el formato debe ser "
+"GRUPO=CLAVE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Demasiados argumentos en el parámetro --extension %s, el formato debe ser "
+"NOMBRE=VARIABLE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "DIRECTORIO - Finalizar un directorio de compilación"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "El directorio de compilación %s no está inicializado"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "El directorio de compilación %s ya está inicializado"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Por favor, revisa los archivos exportados y los metadatos\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Sobrescribir la referencia usada en el paquete importado"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REFERENCIA"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importar la imagen OCI en lugar del paquete flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "La referencia '%s' no se encuentra en el registro"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Hay múltiples imágenes en el registro, especifica una con --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr ""
+"Actualizando: %s desde\n"
+" %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "LOCALIZACIÓN NOMBRE_ARCHIVO - Importa un paquete al repositorio local"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "Se debe especificar LOCALIZACIÓN y NOMBRE_ARCHIVO"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Arquitectura a usar"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Inicializar variable desde el runtime nombrado"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Inicializar aplicaciones desde la aplicación nombrada"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APLICACION"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Especifica una versión para --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSIÓN"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Incluir esta extensión base"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "EXTENSIÓN"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Inicializar /usr con una copia con permisos de escritura del SDK"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Especificar el tipo de compilación (aplicación, runtime, extensión)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TIPO"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Añadir una etiqueta"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ETIQUETA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Incluir la extensión de este SDK en /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Donde almacenar el SDK (Por defecto en 'usr')"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Re-inicializar el sdk/variable"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "La extensión %s requerida solo está instalada parcialmente"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "La extensión %s requerida no está instalada"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"DIRECTORIO NOMBRE_APLICACIÓN SDK RUNTIME [RAMA] - Inicializa un directorio "
+"de compilación"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "Se debe especificar un RUNTIME"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"'%s' no es un tipo de compilación válido, usa aplicación, runtime o extensión"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "'%s' no es un nombre de aplicación valido: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "El directorio de compilación %s ya está inicializado"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Arquitectura en la que instalar"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Buscar un runtime con el nombre especifico"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "LOCALIZACIÓN [ID [RAMA]] - Firma una aplicación o runtime"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "No se han especificado los ids de las claves GPG"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Comando desconocido '%s'"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "Se debe especificar APLICACIÓN"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Borrar remoto incluso si está en uso"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NOMBRE - Borra un repositorio remoto"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Crear una referencia única de documento"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Hacer el documento transitorio para la sesión actual"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "No requerir la existencia del archivo"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Obtener los permisos de lectura de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Obtener los permisos de escritura de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Obtener los permisos de borrado de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr ""
+"Obtener los permisos de la aplicación para conceder permisos adicionales"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Revocar permiso de lectura de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Revocar permiso de escritura de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Revocar permiso de borrado de la aplicación"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr ""
+"Revocar los permisos de la aplicación para conceder permisos adicionales"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Añadir permisos a esta aplicación"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "ID_APLICACIÓN"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "ARCHIVO - Exportar un archivo a las aplicaciones"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "Se debe especificar el ARCHIVO"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "ARCHIVO - Obtiene información sobre un archivo exportado"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "No exportado\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[ID_APLICACIÓN] - Obtiene una lista de los archivos exportados"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "ARCHIVO - Elimina la exportación de un archivo a las aplicaciones"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [COMANDO [argumentos...]] - Ejecuta un comando dentro de una "
+"sandbox en ejecución"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "Se deben especificar SANDBOXEDPID y COMANDO"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+"No se está ejecutando como root, puede ser imposible entrar al espacio de "
+"nombres"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "PID %s inválido"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "No existe el PID %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "No se puede leer cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "No se puede leer root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Espacio de nombres %s inválido para el PID %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Espacio de nombres %s inválido para si mismo"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "No se puede abrir el espacio de nombres %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "No se puede entrar al espacio de nombres %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "No se puede hacer chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "No se puede hacer chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "No se puede cambiar el GID"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "No se puede cambiar el UID"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Mostrar instalaciones del usuario"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Mostrar instalaciones del sistema"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Mostrar instalaciones especificas del sistema"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Mostrar referencia"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Mostrar commit"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Mostrar origen"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Mostrar tamaño"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Mostrar metadatos"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Mostrar extensiones"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NOMBRE [RAMA] - Obtiene información a cerca de una aplicación y/o runtime "
+"instalado"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "referencia no presente en el origen"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Referencia:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Arquitectura:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Rama:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Origen:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Commit activo:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Ultimo commit:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "id-alternativo:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Localización:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Tamaño de la instalación:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Runtime:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Subdirectorios de la instalación:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Extensión:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Subdirectorios:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "COMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Buscar una aplicación con el nombre especifico"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Mostrar referencia"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "Se debe especificar REMOTO y REFERENCIA"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Tamaño de la descarga"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "No hacer pull, solo instalar del caché local"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "No desplegar, solo descargar al caché local"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "No instalar referencias relacionadas"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "No verificar/instalar las dependencias de runtime"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "No usar deltas estáticos"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Asumir que LOCALIZACIÓN es un paquete .flatpak de un solo archivo."
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr ""
+"Asumir que LOCALIZACIÓN es un paquete de descripción de aplicación ."
+"flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Comprobar las firmas del paquete con las claves GPG del ARCHIVO (- para "
+"stdin)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Solo instalar este subdirectorio"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "RUTA"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Responder si automáticamente a todas las preguntas"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s commit %s ya está instalado"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Esta aplicación depende de los tiempos de ejecución de:\n"
+"  %s\n"
+"Configura esto como un nuevo repositorio remoto '%s'"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Configurando %s como un nuevo repositorio remoto '%s'"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Se debe especificar el nombre de archivo del paquete"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Los paquetes remotos no están soportados"
+
+#: app/flatpak-builtins-install.c:338
+#, fuzzy, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"El repositorio remoto '%s', en la localización %s contiene aplicaciones "
+"adicionales.\n"
+"¿Quieres instalar otras aplicaciones desde aquí?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Se debe especificar el nombre de archivo o el uri"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr ""
+"LOCALIZACION/REMOTO [REFERENCIA ...] - Instala aplicaciones o tiempos de "
+"ejecución"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Mostrar información adicional"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Mostrar lista con los tiempos de ejecución instalados"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Mostrar lista con las aplicaciones instaladas"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Arquitectura a mostrar"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Mostrar todas las referencias (incluyendo locales/depuración)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Referencia"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Origen"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Commit activo"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Último commit"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Tamaño de la instalación"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Opciones"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Mostrar lista de aplicaciones y/o tiempos de ejecución instalados"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Mostrar detalles del repositorio remoto"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Mostrar repositorios remotos desactivados"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Mostrar lista de repositorios remotos"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Nombre"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Título"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioridad"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Mostrar arquitecturas y ramas"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Mostrar solo tiempos de ejecución"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Mostrar solo aplicaciones"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Mostrar solo elementos si hay actualizaciones disponibles"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Limitar a esta arquitectura (* para mostrar todas)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr "REMOTO - Mostrar tiempos de ejecución y aplicaciones disponibles"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Commit"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Tamaño de la descarga"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Información de referencia no disponible en el repositorio"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Arquitectura para construir el actual"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "APLICACIÓN RAMA - Establece la rama de la aplicación a usar"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Se debe especificar APLICACIÓN"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Se debe especificar RAMA"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "La aplicación %s rama %s no está instalada"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "APLICACIÓN - Sobrescribe la configuración de la aplicación"
+
+#: app/flatpak-builtins-repo.c:48
+#, fuzzy, c-format
+msgid "Title: %s\n"
+msgstr "Título"
+
+#: app/flatpak-builtins-repo.c:51
+#, fuzzy, c-format
+msgid "Collection ID: %s\n"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, fuzzy, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Instalada"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Descarga"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Imprime información general acerca del repositorio"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Mostrar una lista de las ramas en el repositorio"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Imprime los metadatos de una rama"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "LOCALIZACIÓN - Mantenimiento del repositorio"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Redirige este repositorio a una nueva URL"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Un buen nombre para usar en este repositorio"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Rama por defecto a usar en este repositorio"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+"Desplegar de forma permanente el identificador de colección en las "
+"configuraciones remotas del cliente"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importar una nueva clave pública GPG por defecto desde ARCHIVO"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "Identificador de la clave GPG con la que firmar el resumen"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Generando archivos de diferencias"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Eliminando objetos sin uso"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Solo recorrer PROFUNDIDAD padres para cada commit (por defecto: -1=infinitos)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "PROFUNDIDAD"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Generando archivos de diferencias: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Generando archivos de diferencias: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr ""
+"Ha ocurrido un error al generar los archivos de diferencias %s (%.10s) "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr ""
+"Ha ocurrido un error al generar los archivos de diferencias %s (%.10s-"
+"%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "LOCALIZACIÓN - Actualizar los metadatos del repositorio"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Actualizando rama de appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Actualizando resumen\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Objetos totales: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "No hay objetos inaccesibles\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u objetos borrados, se han liberado %s\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Comando a ejecutar"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Rama a usar"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Usar tiempo de ejecución de desarrollo"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Tiempo de ejecución a usar"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Versión de tiempo de ejecución a usar"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Llamadas al bus de registro de accesibilidad"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Habilitar el reenvío de archivos"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "APLICACION [argumentos...] - Ejecuta una aplicación"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "Se debe especificar REMOTO"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Rama:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Sin remoto %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Descripción completa"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Ninguna coincidencia %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Arquitectura a desinstalar"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Mantener referencia en el repositorio local"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "No desinstalar referencias relacionadas"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Borrar archivos aún si se encuentra en ejecución"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REFERENCIA ... - Desinstala una aplicación"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Se debe especificar al menos una REFERENCIA"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Aviso: Problema al buscar referencias relacionadas: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Arquitectura a actualizar"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Commit a desplegar"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Borrar archivos antiguos aún si se encuentra en ejecución"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "No hacer pull, solo actualizar del caché local"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "No actualizar referencias relacionadas"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Actualizar appstream para un repositorio remoto"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Solo actualizar este subdirectorio"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Actualizando appstream para el repositorio remoto %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Actualizando appstream para el repositorio remoto %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Actualizando %s"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REFERENCIA ...] - Actualiza aplicaciones y tiempos de ejecución"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Sin actualizaciones.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "¿Cual quieres instalar (0 para abortar)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Administra las aplicaciones y tiempos de ejecución instalados"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Instalar una aplicación o tiempo de ejecución"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Actualizar una aplicación o tiempo de ejecución"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Desinstalar una aplicación o tiempo de ejecución instalado"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Mostrar lista de aplicaciones y/o tiempos de ejecución instalados"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+"Mostrar información de las aplicaciones o tiempos de ejecución instalados"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Configurar Repositorio Remoto"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Firmar una aplicación o runtime"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Aplicaciones en ejecución"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Ejecutar una aplicación"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Sobrescribir permisos para una aplicación"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Especificar la versión por defecto a ejecutar"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Introduce el espacio de nombres de una aplicación en ejecución"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Administrar el acceso a archivos"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Conceder a una aplicación acceso a un archivo específico"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Revocar acceso a un archivo específico"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Mostrar información sobre un archivo específico"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Mostrar una lista de los archivos exportados"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Administrar repositorios remotos"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Obtener lista de todos los repositorios remotos configurados"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Añadir un nuevo repositorio (por URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modificar las propiedades de un repositorio remoto configurado"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Borrar un repositorio remoto configurado"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr ""
+"Obtener una lista de los contenidos de un repositorio remoto configurado"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr ""
+"Mostrar información de las aplicaciones o tiempos de ejecución instalados"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+"Compilar aplicaciones"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inicializar un directorio para compilar"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr ""
+"Ejecutar un comando de compilación dentro del directorio de compilación"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Finalizar un directorio de compilación para exportar"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exportar un directorio de compilación a un repositorio"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Crear un paquete desde un directorio de compilación"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importar un archivo de paquete"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Firmar una aplicación o runtime"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Actualizar el archivo de resumen en un repositorio"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Crear un nuevo commit basado un en una referencia existente"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Imprimir información acerca de un repositorio"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Imprimir información de depuración durante el procesado del comando"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr ""
+"Imprimir información de depuración de OSTree durante el procesado del comando"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Mostrar las opciones de ayuda"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Imprimir la información de la versión y salir"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Imprimir la arquitectura por defecto y salir"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Imprimir las arquitecturas soportadas y salir"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Imprimir los drivers gl activos y salir"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr ""
+"Trabajar con instalaciones de\n"
+" usuario"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Trabajar con ins"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Trabajar con instalaciones especificas del sistema"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NOMBRE"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Comandos Incorporados:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Comando desconocido '%s'"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Comando no especificado"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "error:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Encontrado en varios repositorios remotos:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "%s encontrado en repositorio remoto, quieres instalarlo?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Encontrado en varios repositorios remotos:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "¿Cual quieres instalar (0 para abortar)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr ""
+"Se requiere un tiempo de ejecución para %s (%s) que no está instalado, "
+"buscando...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"El tiempo de ejecución %s requerido no se ha podido encontrar en un "
+"repositorio remoto de entre los configurados.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s no está instalado"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr ""
+"El repositorio remoto %s está deshabilitado, ignorando la actualización %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s ya está instalado, ignorando\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s commit %s ya está instalado"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s necesita una versión de flatpak superior (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Error al actualizar los metados adicionales para '%s': %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "instalar"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Instalando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Instalando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "actualizar"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr ""
+"Actualizando: %s desde\n"
+" %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr ""
+"Actualizando: %s desde\n"
+" %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Ahora a las %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Sin actualizaciones.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "instalar paquete"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Instalando: %s desde el paquete %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Instalando: %s desde el paquete %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Aviso: Fallo al %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Error: Fallo al %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Han fallado una o más operaciones"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "No se han encontrado anulaciones para %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Mientras se abría el repositorio %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "No se puede crear el directorio de despliegue"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr ""
+"Suma de verificación sha256 inválida para los datos adicionales de la uri %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Nombre vacío para los datos adicionales de la uri %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Uri de datos adicionales no soportada %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Fallo al cargar los datos adicionales locales %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Tamaño incorrecto en los datos adicionales %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Mientras se descargan %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Tamaño incorrecto en los datos adicionales %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Suma de verificación inválida en los datos adicionales %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s commit %s ya está instalado"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Mientras se está cargando %s desde el repositorio remoto %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "No se puede encontrar %s en el repositorio remoto %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "No hay suficiente memoria"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Fallo al leer desde un archivo exportado"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Error al leer un archivo de tipo mime XML"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Archivo de tipo mime XML inválido"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Al obtener metadatos individuales: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Al crear directorios adicionales:"
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Suma de verificación sha256 inválida para los datos adicionales"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Tamaño  incorrecto para los datos adicionales"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Firma de verificación incorrecta para los datos adicionales"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Al escribir el archivo de datos adicionales '%s': "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Ha fallado el script apply_extra, código de error %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Mientras se intentan resolver las referencias %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s no está disponible"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s rama %s ya se encuentra instalada"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Error al leer el commit %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Al intentar revisar %s en %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Al intentar revisar el subdirectorio de metadatos: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Al intentar eliminar el directorio extra existente:"
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Al intentar aplicar datos adicionales: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "PID %s inválido"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "PID %s inválido"
+
+#: common/flatpak-dir.c:5448
+#, fuzzy, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "La referencias desplegadas %s no coinciden con el commit (%s)"
+
+#: common/flatpak-dir.c:5456
+#, fuzzy, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "La referencias desplegadas %s no coinciden con el commit (%s)"
+
+#: common/flatpak-dir.c:5464
+#, fuzzy, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "La referencias desplegadas %s no coinciden con el commit (%s)"
+
+#: common/flatpak-dir.c:5470
+#, fuzzy, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "La referencias desplegadas %s no coinciden con el commit (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "La referencias desplegadas %s no coinciden con el commit (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Los metadatos no coinciden con el commit"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Esta versión de %s ya está instalada"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr ""
+"No se puede cambiar el repositorio remoto durante la instalación de un "
+"paquete"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s rama %s no está instalada"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s rama %s no instalada"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Ninguna coincidencia %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "No se ha encontrado %s%s%s%s%s en el repositorio remoto %s"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Error: Fallo al %s %s: %s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Mantener referencia en el repositorio local"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s no instalado"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "No se pudo encontrar la instalación %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "El tiempo de ejecución %s, rama %s ya se encuentra instalado"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "La aplicación %s, rama %s ya se encuentra instalada"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Titulo de repositorio remoto no establecido"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Rama por defecto del repositorio remoto no establecida"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "No hay un caché de flatpak en el repositorio remoto"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Ninguna entrada para %s en el caché de flatpak del repositorio remoto "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Tipo de recurso compartido %s inválido, los tipos válidos son: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Tipo de póliza  %s inválida, los tipos válidos son: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Nombre dbus inválido: %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Tipo de socket desconocido %s, los tipos válidos son: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Tipo de dispositivo desconocido %s, los tipos válidos son: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Tipo de característica desconocido %s, los tipos válidos son: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Ruta desconocida en el sistema de archivos %s, algunas rutas válidas son: "
+"host, home, xdg-*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Formato de entorno inválido %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Compartir con el huesped"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "COMPARTIR"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Dejar de compartir con el huesped"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Exponer socket a la aplicación"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOCKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "No exponer socket a la aplicación"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Exponer dispositivo a la aplicación"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "DISPOSITIVO"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "No exponer dispositivo a la aplicación"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Permitir característica"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "CARACTERÍSTICA"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "No permitir característica"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+"Exponer los archivos del sistema a la aplicación (:ro solo en modo lectura)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SISTEMA_ARCHIVOS[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "No exponer los archivos del sistema a la aplicación"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SISTEMA_ARCHIVOS"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Establecer variable de entorno"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VARIABLE=VALOR"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Permitir que la aplicación tenga nombre propio en el bus de sesión"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NOMBRE_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Permitir a la aplicación hablar con un nombre en el bus de sesión"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Permitir que la aplicación tenga nombre propio en el bus de sistema"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Permitir a la aplicación hablar con un nombre en el bus de sistema"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Añadir opción de póliza genérica"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSISTEMA.CLAVE=VALOR"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Eliminar opción de póliza genérica"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Directorio de inicio con persistencia"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NOMBRE_ARCHIVO"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "No requerir una sesión en ejecución (no se crearán cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Fallo al abrir un archivo temporal de flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Fallo al abrir un archivo temporal: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Ha sido imposible crear una tubería sincronizada"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Fallo al abrir el archivo de información de una aplicación: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Fallo al sincronizar con el proxy de dbus"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "Ha fallado el script apply_extra, código de error %d"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr ""
+"Actualizando: %s desde\n"
+" %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Error: Fallo al %s %s: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Sin orígenes de datos adicionales"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Descargando %s"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Descargando %s"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Descargando %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Instalar aplicación firmada"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "La autentificación es obligatoria para instalar un programa"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Instalar tiempo de ejecución firmado"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Actualizar aplicación firmada"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "La autentificación es obligatoria para actualizar un programa"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Actualizar tiempo de ejecución firmado"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Actualizar metadatos remotos"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr ""
+"La autentificación es obligatoria para actualizar la información remota"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Actualizar el archivo de resumen en un repositorio"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr ""
+"La autentificación es obligatoria para actualizar la información remota"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Instalar paquete"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Desinstalar tiempo de ejecución"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "La autentificación es obligatoria para desinstalar un programa"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Desinstalar aplicación"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Configurar Repositorio Remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+"La autentificación es obligatoria para configurar repositorio de software"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Configurar Repositorio Remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr ""
+"La autentificación es obligatoria para configurar repositorio de software"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Actualizar appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Sin remoto %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Mostrar instalaciones del usuario"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Mostrar instalaciones del sistema"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Mostrar instalaciones especificas del sistema"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Fallo al crear un archivo temporal"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Fallo al desvincular un archivo temporal"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Fallo al escribir un archivo temporal"
+
+#~ msgid "Installing %s"
+#~ msgstr "Instalando %s"
+
+#~ msgid "Post-Install %s"
+#~ msgstr "Post instalación %s"
diff --git a/po/flatpak.pot b/po/flatpak.pot
new file mode 100644 (file)
index 0000000..53f9f23
--- /dev/null
@@ -0,0 +1,2780 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Flatpak team and others.
+# This file is distributed under the same license as the flatpak package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak 0.10.2\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr ""
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr ""
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr ""
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr ""
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr ""
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr ""
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr ""
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+msgid "Show parent"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:201
+msgid "Download size:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+msgid " Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:70
+msgid "Uninstall first if already installed"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:96
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr ""
+
+#: app/flatpak-builtins-override.c:54
+msgid "[APP] - Override settings [for application]"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+msgid "TEXT must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:270
+msgid "Application ID"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+msgid "Branch"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:275
+msgid "Remotes"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:276
+msgid "Description"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:285
+msgid "No matches found"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:164
+#, c-format
+msgid "Uninstalling: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:107
+#, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:109
+#, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+msgid "Which do you want to use (0 to abort)?"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr ""
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr ""
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr ""
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr ""
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr ""
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr ""
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr ""
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr ""
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr ""
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr ""
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr ""
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:96
+msgid "Show information about a remote app or runtime"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr ""
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr ""
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr ""
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr ""
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr ""
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr ""
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr ""
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr ""
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr ""
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr ""
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr ""
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr ""
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr ""
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr ""
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr ""
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr ""
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr ""
+
+#: app/flatpak-main.c:143
+msgid "Work on specific system-wide installation(s)"
+msgstr ""
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr ""
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr ""
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr ""
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr ""
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr ""
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr ""
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr ""
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr ""
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr ""
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:531
+#, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr ""
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr ""
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr ""
+
+#: app/flatpak-transaction.c:746
+#, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr ""
+
+#: app/flatpak-transaction.c:774
+#, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr ""
+
+#: app/flatpak-transaction.c:822
+#, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr ""
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr ""
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr ""
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr ""
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr ""
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr ""
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr ""
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr ""
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr ""
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr ""
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr ""
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr ""
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr ""
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr ""
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr ""
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr ""
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr ""
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr ""
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr ""
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr ""
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr ""
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr ""
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr ""
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr ""
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr ""
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr ""
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr ""
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr ""
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr ""
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr ""
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr ""
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr ""
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr ""
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr ""
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr ""
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr ""
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr ""
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr ""
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr ""
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr ""
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr ""
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr ""
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr ""
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr ""
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr ""
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr ""
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr ""
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr ""
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr ""
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr ""
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr ""
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr ""
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr ""
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr ""
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr ""
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr ""
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr ""
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr ""
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr ""
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr ""
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr ""
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr ""
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr ""
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr ""
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr ""
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr ""
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr ""
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr ""
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr ""
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr ""
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr ""
diff --git a/po/gl.gmo b/po/gl.gmo
new file mode 100644 (file)
index 0000000..b9a7897
Binary files /dev/null and b/po/gl.gmo differ
diff --git a/po/gl.po b/po/gl.po
new file mode 100644 (file)
index 0000000..1c3d019
--- /dev/null
+++ b/po/gl.po
@@ -0,0 +1,2889 @@
+# Galician translation for flatpak.
+# Copyright (C) 2017 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Fran Dieguez <frandieguez@gnome.org>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-09-26 17:32+0200\n"
+"Last-Translator: Fran Dieguez <frandieguez@gnome.org>\n"
+"Language-Team: Galician <gnome-l10n-gl@gnome.org>\n"
+"Language: gl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Gtranslator 2.91.7\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Non facer nada se o fornecedor remoto existe"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr ""
+"LOCATION especifica o ficheiro de configuracion, non unha localización de "
+"repositorio"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Activar comprobación GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Marcar o remoto como enumerado"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Estabelecer o remoto como usado polas dependencias"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Estabelecer unha nova url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Activar o repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Actualizar os metadatos adicionais desde o ficheiro de resumo"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Desactivar a comprobación GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Marcar o reomoto como non enumerado"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Estabelecer o remoto como non usado para as dependencias"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+"Estabelecer prioridade (1 por omisión, máis prioridade canto máis alto)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORIDADE"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Un nome bonito para usar neste repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TÍTULO"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Rama por omisión que usar neste repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "RAMA"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "ID-COLECTIÓN"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importar a chave GPG desde o FICHEIRO (- para stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "FICHEIRO"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Desactivar o repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Engadir rexistro OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Non é posíbel abrir o espazo de nomes %s: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Formato de env %s non válido"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Tipo de uri non válido %s, só se admite http/https"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "PID %s non válido"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NOME LOCALIZACION - Engade un novo repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "Debe especificar o NOME"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "Debe especificar a LOCALIZACION"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Demasiados argumento"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "«%s» non é un ID de colección válido: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "A comprobación GPG é obrigatoria se as coleccións están activadas"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "O repositorio remoto %s xa existe"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Non se especificou unha url no ficheiro flatpakrepo"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr ""
+"Aviso: Non se puideron actualizar os metadatos adicionais para «%s»: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NOME - Modificar un repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Debe especifciar o NOME do repositorio remoto"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Actualizando os metadatos adicionais desde o resumo remoto para %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr ""
+"Produciuse un erro ao actualizar os metadatos adicionais para «%s»: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Non se puido actualizar os metadatos adicionais para %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exportar o runtime no lugar do aplicativo"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Arquitectura para empaquetar"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARQUITECTURA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url para o repo"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url para o ficheiro flatpakrepo do runtime"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Engadir chave GPG desde FICHEIRO (- para stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Exportar imaxe oci no lugar dun paquete flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID de chave GPG coa que asinar a imaxe OCI"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ID-CHAVE"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr ""
+"Directorio de orixe dos ficheiros GPG para usar ao buscar por aneis de chaves"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "DIRECTORIO_DE_INICIO"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"LOCALIZACION NOMEFICHEIRO NOME [RAME] - Crear un paquete de ficheiro único "
+"desde un repositorio local"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "Debe especificar a LOCALIZACION, NOMEFICHEIRO e o NOME"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "«%s» non é un repositorio válido"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "«%s» non é un nome válido: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "«%s» non é un nome válido para unha rama: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Usar o «runtime» de plataforma no lugar de Sdk"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Engadir punto de montaxe"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "DEST=ORIX"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Iniciar a compilación neste cartafol"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "DIR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Onde buscar o directorio personalizado de SDK (por omisión «usr»)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Usar o ficheiro alternativo para os metadatos"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Matar os procesos cando o proceso pai morre"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Exportar cartafol homedir do aplicativo para construír"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Rexistrar chamadas ao bus de sesión"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Rexistrar chamadas ao bus de sistema"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "DIRECTORIO [ORDE [argumentos...]] - Construír no directorio"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "Debe especificar o DIRECTORIO"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "Directorio de construción %s non iniciado, usar flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "metadatos non válidos, sen aplicativo ou runtime"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Non hai ningún punto de extensión que coincida con %s en %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Falta o «=» na opción «%s» de punto de montaxe"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Non foi posíbel iniciar o aplicativo"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Directorio do repositorio de orixe"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "SRC-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Referencia do repositorio orixe"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "SRC-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Suxeito nunha liña"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "RESUMO"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Descrición completa"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "CORPO"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Actualizar a rama de appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Non actualizar o resumo"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID da chave GPG coa que asinar a remisión"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"REPO-DST [REF-DST]... - Facer unha nova remisión baseada na(s) remisión(s) "
+"existente(s)"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "Debe especificar o DST-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Se --src-repo non se especifica, debe especificar exactamente unha "
+"referencia de destino"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Se --src-ref non está especificado, debe especificar exactamente unha "
+"referencia de destino"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Debe especificar --src-repo ou --src-ref."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Non é posíbel remitir a partir dotra remisión parcial."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Arquitectura á que exportar (debe ser compatíbel co anfitrión)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Runtime de remisión (/usr), non /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Usar un directorio alternativo para os ficheiros"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "SUBDIR"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Ficheiros a excluír"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "PATRON"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Ficheiros excluídos a incluír"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Sobrescribir a marca de tempo da remisión"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ISO-8601-TIMESTAMP"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Produciuse un fallo ao abrir o ficheiro temporal: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Tipo de uri non válido %s, só se admite http/https"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+"Non é posíbel atopar o nome base en %s, especifique un nome de forma "
+"explícita"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Non se permiten as barras no nome de datos adicionais"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Formato non válido para a suma de verificación sha256: «%s»"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Tamaños de datos adicionais de cero non admitidos"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+"LOCALIZACION DIRECTORIO [RAMA] - Crea un repositorio desde o directorio de "
+"construción"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "Debe especificar a LOCALIZACION OU DIRECTORIO"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Non se especificou un nome nos metadatos"
+
+#: app/flatpak-builtins-build-export.c:976
+#, fuzzy, c-format
+msgid "Commit: %s\n"
+msgstr "Remisión:"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Orde a estabelecer"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "ORDE"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Versión de Flatpak a requirir"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAIOR.MENOR.MICRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Non procesar exportados"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Información de datos adicionais"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Engadir información de punto de extensión"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NOME=VARIABEL[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Cambiar o sdk usado para o aplicativo"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Cambiar o «runtime» usado polo aplicativo"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "RUNTIME"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Estabelecer opción de metadatos xenérica"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPO=CHAVE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Demasiados poucos elementos no argumento --extra-data %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Demasiados poucos elementos no argumento --metadata %s, o formato debería "
+"ser GRUPO=CHAVE[=VALOR]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Demasiados poucos elementos no argumento --extension %s, o formato debería "
+"ser NOME=VAR[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "DIRECTORIO - Finalizar un cartafol de construción"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Directorio de construción %s non inicializado"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Directorio de construción %s xa finalizado"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Por favor revise os ficheiros exportados e o metadato\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Sobrescribir a referencia usada para o paquete importado"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importar imaxe oci no lugar de paquete flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Referencia «%s» non atopada no rexistro"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Imaxes múltiples no rexistro, especifique unha referencia con --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Actualizando: %s desde %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+"LOCALIZACION NOMEFICHEIRO - Importar un ficheiro empaquetado no repositorio "
+"local"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "Debe especificar a LOCALIZACION e o NOMEFICHEIRO"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Arquitectura a usar"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Inicializar a variable desde o runtime nomeado"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Inicializar aplicativos desde o aplicativo nomeado"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APP"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Especique a versión para --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSION"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Incluír esta extensión base"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "EXTENSION"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Incializar /usr con unha copia con permisos de escritura do sdk"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Especifique o tipo de construción (aplicativo, runtime, extensión)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TIPO"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Engadir unha etiqueta"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ETIQUETA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Incluír esta extensión de sdk en /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Onde almacenar o sdk (por omisión en «usr»)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Reinicializar o sdk/var"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "A extensión %s solicitada só está instalada parcialmente"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "A extensión %s solicitada non está instalada"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"DIRECTORIO NOMEAPP SDK RUNTIME [RAMA] - Inicializar un directorio para "
+"construír"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "Debe especificar un RUNTIME"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"«%s» non é un nome de tipo de construción válido, use app, runtime ou "
+"extensión"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "«%s» non é un nome de aplicativo válido: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Directorio de construción %s xa inicializado"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Arquitectura para a que instalar"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Buscar un aplicativo cun nome específico"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "LOCALIZACION [ID [RAMA]] - Asina un aplicativo ou runtime"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Non se especificou ningún id de chave de gpg"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Orde descoñecida «%s»"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "Debe especificar o APP"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Eliminar remoto incluso se está en uso"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NOME - Eliminar un repositorio remoto"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Crear unha referencia de documento única"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Facer o documento transitorio para a sesión actual"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Non requirir que o ficheiro de antemán"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Darlle ao aplicativo permisos de lectura"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Darlle ao aplicativo permisos de escritura"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Darlle ao aplicativo permisos de eliminación"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Darlle ao aplicativo permisos para asignar permisos futuros"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Revogarlle os permisos de lectura ao aplicativo"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Revogarlle os permisos de escritura ao aplicativo"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Revogarlle os permisos de eliminación ao aplicativo"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Revogarlle os permisos para asignar permisos futuros"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Engadir permisos para este aplicativo"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "APPID"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "FICHEIRO - Exportar un ficheiro aos aplicativos"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "Debe especificar o FICHEIRO"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "FICHEIRO - Obter información sobre un ficheiro exportado"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Non exportado\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[APPID] - Obtén unha lista dos ficheiros exportados"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "FICHEIRO - Elimina a exportación dun ficheiro aos aplicativos"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [ORDE [args...]] - Executa unha orde dentro dun sandbox en "
+"execución"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "Debe especificar o SANDBOXEDPID e a ORDE"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+"Non se está executando como root, podería ser imposíbel entrar no espazo de "
+"nomes"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "PID %s non válido"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Non existe o PID %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Non é posíbel ler cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Non é posíbel ler root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Espazo de nomes %s non válido para o PID %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Espazo de nomes %s non válido para si mesmo"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Non é posíbel abrir o espazo de nomes %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Non é posíbel entrar no espazo de nomes %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Non é posíbel facer chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Non é posíbel facer chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Non é posíbel trocar o GID"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Non é posíbel trocar o UID"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Mostrar instalacións do usuario"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Mostrar instalacións do sistema"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Mostrar instalacións específicas do sistema"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Mostrar referencia"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Mostrar remisión"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Mostrar orixe"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Mostrar tamaño"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Mostrar metadatos"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Mostrar extensións"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NOME [RAMA] - Obtén información sobre o aplicativo e/ou runtime instalado"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "referencia non presente no orixe"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Referencia:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Arquitectura:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Rama:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Orixe:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Remisión activa:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Última remisión:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Remisión:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alt-id:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Localización:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Tamaño da instalación:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Runtime:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Subdirectorios da instalación:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Extensión:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Subdirectorios:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "REMISIÓN"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Buscar un aplicativo dun nome específico"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Mostrar referencia"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "Debe especificar REMOTO e REF"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Tamaño de descarga"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Remisión:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Non facer «pull», só instar desde a caché local"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "No despregar, só descargar á caché local"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Non instalar referencias relacionadas"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Non verificar/instalar as dependencias de runtime"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Non usar deltas estáticos"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Asume que LOCALIZACION é un paquete .flatpak dun só ficheiro."
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Asume que LOCALIZACION é uha descrición de aplicativo .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Comproba as sinaturas do paquete coa chave GPG dese o FICHEIRO (- para stdin)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Só instalar esta subruta"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "RUTA"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Responder si automaticamente para todas as preguntas"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s remisión %s xa instalado"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Este aplicativo depende dos runtimes de:\n"
+"  %s\n"
+"Configure esta como o novo remoto «%s»"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Configurar %s como un novo remoto «%s»"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Debe especificar o nome de ficheiro do paquete"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Non se admiten os paquetes remotos"
+
+#: app/flatpak-builtins-install.c:338
+#, fuzzy, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"O remoto «%s», na localización %s contén aplicativos adicinais.\n"
+"Desexa instalar outros aplicativos desde aquí?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Debe especificar o nome de ficheiro ou uri"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "LOCALIZACION/REMOTO [REF...] - Instalar aplicativos ou runtimes"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Mostrar información adicional"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Mostrar os runtime instalados"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Mostrar os aplicativos instalados"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Arquitectura a mostrar"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Mostrar todas as referencias (incluíndo as locais/depuración)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Referencia"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Orixe"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Remisión activa"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Última remisión"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Tamaño instalado"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Opcións"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Lista os aplicativos instalados e/ou runtimes"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Mostrar información do remoto"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Mostrar remotos desactivados"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Lista os repositorios remotos"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Nome"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Título"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioridade"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Mostrar arquitecturas e ramas"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Mostrar só os runtimes"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Mostrar só os aplicativos"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Mostrar só aqueles para os que haxa actualizacións"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Limitar a esta arquitectura (* para todas)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " REMOTO - Mostrar os runtimes e aplicativos dispoñíbeis"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Remisión"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Tamaño de descarga"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Non hai información dispoñíbel para a referencia no repositorio"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Arquitectura que facer a actual"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "APP RAMA - Facer actual a rama do aplicativo"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Debe especificar o APP"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Debe especificar a RAMA"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "O aplicativo %s rama %s non está instalado"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "APP - Sobrescribir as configuracións do aplicativo"
+
+#: app/flatpak-builtins-repo.c:48
+#, fuzzy, c-format
+msgid "Title: %s\n"
+msgstr "Título"
+
+#: app/flatpak-builtins-repo.c:51
+#, fuzzy, c-format
+msgid "Collection ID: %s\n"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, fuzzy, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Instalado"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Descargar"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Imprimir a información xeral sobre o repositorio"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Mostra as ramas no repositorio"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Imprime os metadatos para unha rama"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "LOCALIZACION - Mantemento do repositorio"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Redireccionar este repositorio a unha URL nova"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Un nome bonito a usar para este repositorio"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Rama por omisión a usar para este repositorio"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+"ID da colección a desplegar de forma permanente ás configuracións do remoto "
+"cliente"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importa nova chave pública GPG por omisión desde o FICHEIRO"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "ID da chave GPG coa que asinar a descrición"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Xerar ficheiros delta"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Limpar obxectos non usados"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"So atravesar os pais de PROFUNDIDADE para cada remisión (por omisión: "
+"-1=infinito)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "PROFUNDIDADE"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Xerando delta: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Xerando delta: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Produciuse un fallo ao xerar o delta %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Produciuse un fallo ao xerar o delta %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "LOCALIZACION - Actualizar os metadatos do repositorio"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Actualizando a rama de appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Actualizando resumo\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Total de obxectos: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Non hai obxectos alcanzábeis\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u obxectos eliminados, %s liberados\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Orde a executar"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Rama a usar"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Usar runtime de desenvolvemento"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Runtime a usar"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Versión do runtime a usar"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Rexistrar chamadas ao bus de accesibilidade"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Activar redirección de ficheiro"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "APP [argumentos...] - Executa un aplicativo"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "Debe especificar o NOME"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "ID de colección"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Rama:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Sen remoto %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Descrición completa"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Nada coincide con %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Arquitectura a desinstalar"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Manter referencia no repositorio local"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Non desinstalar as referencias relacionadas"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Eliminar os ficheiros incluso se está en execución"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF... - Desinstalar un aplicativo"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Debe especificar cando menos unha vez a REF"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Aviso: Problema ao buscar por referencias relacionadas: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Arquitectura para a que actualizar"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Remisión a despregar"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Eliminar os ficheiros antigos incluso se está en execución"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Non facer «pull», só actualizar desde a caché local"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Non actualiar as referencias relacionadas"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Actualizar appstream desde o remoto"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Só actualizar esta subruta"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Actualizando appstream para o remoto %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Actualizando appstream para o remoto %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr ""
+"Produciuse un erro ao actualizar os metadatos adicionais para «%s»: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF...] - Actualizar aplicativos ou runtimes"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Non hai actualizacións.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Cal desexa instalar (0 para abortar)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Xestionar os aplicativos ou runtimes instalados"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Instalar un aplicativo ou runtime"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Actualizar un aplicativo ou runtime instalado"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Desinstalar un aplicativo ou runtime instalado"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Mostrar os aplicativos e/ou runtimes instalados"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Mostrar información para os aplicativos ou runtime instalados"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Configurar remoto"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Asinar un aplicativo ou runtime"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Aplicativos en execución"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Executa un aplicativo"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Sobrescribir permisos para un aplicativo"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Especifica a versión por omisión a executar"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Entrar no espazo de nomes dun aplicativo en execución"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Xestionar o acceso ao ficheiro"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Darlle a un aplicativo acceso a un ficheiro específico"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Revogar acceso a un ficheiro específico"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Mostrar información sobre un ficheiro específico"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Mostrar os ficheiros exportados"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Xestionar os repositorios remotos"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Mostrar todos os remotos configurados"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Engadir un repositorio remoto novo (por URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modificar as propiedades dun remoto configurado"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Eliminar un remoto configurado"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Mostrar os contidos dun remoto configurado"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Mostrar información para os aplicativos ou runtime instalados"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Construír aplicativos"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inicializar un directorio para a construción"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Executar unha orde de construción dentro do directorio de construción"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Rematar un directorio de construción para exportar"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exportar un directorio de construción a un repositorio"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Crear un ficheiro empaquetado desde un directorio de construción"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importar un ficheiro empaquetado"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Asinar un aplicativo ou runtime"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Actualizaar o ficheiro de resumo no repositorio"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Crear nova remisión baseada na referencia existente"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Imprimir información sobre un repositorio"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Imprimir información de depuración durante o procesado da orde"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr ""
+"Imprimir a información de depuración de OSTree durante o procesado da orde"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Mostrar as opcións de axuda"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Imprimir información da versión e saír"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Imprimir arquitectura por omisión e saír"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Imprimir as arquitecturas compatíbeis e saír"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Imprimir os controladores gl activos e saír"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Traballar nas instalacións de usuario"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Traballar nas instalacións a nivel de sistema (por omisión)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Traballar nunha instalación a nivel de sistema específica"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NOME"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Ordes incrustadas:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Orde descoñecida «%s»"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Non se especificou ningunha orde"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "erro:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Atopado en varios remotos:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Atopado no remoto %s, desexa instalalo?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Atopado en varios remotos:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Cal desexa instalar (0 para abortar)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "O runtime requirido para %s (%s) non instalado, buscando…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr "O runtime %s requirido non se atopou nun remoto configurado.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s non instalado"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Remoto %s descactivado, ignorando a actualización %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s xa está instalado, omitindo\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s remisión %s xa instalado"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s precisa unha versión de flatpak posterior (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr ""
+"Produciuse un erro ao actualizar os metadatos adicionais para «%s»: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "instalar"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Instalando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Instalando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "actualizar"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Actualizando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Actualizando: %s desde %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Agora en %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Non hai actualizacións.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "instalar paquete"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Instalando: %s desde o paquete %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Instalando: %s desde o paquete %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Aviso: fallou o %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Erro: fallou o %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Fallaron unha ou máis operacións"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Non se atopou ningunha sobrescritura para %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Ao abrir o repositorio %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Non é posíbel crear o directorio de despregue"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "SHA256 non válido para o uri de datos adicionais %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Nome baleiro para o uri de datos adicinais %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "URI de datos adicinais %s non admitido"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Produciuse un fallo ao cargar os datos adicinais locais %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Tamaño dos datos adicinais incorrecto %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Ao descargar %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Tamaño dos datos adicinais %s incorrecto"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Suma de verificación non válida para os datos adicinais %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s remisión %s xa instalado"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Ao obter %s desde o remoto %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Non é posíbel atopar %s no remoto %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Non hai momoria dabondo"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Produciuse un fallo ao ler o ficheiro exportado"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Produciuse un erro ao ler o ficheiro xml de mimetype"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Ficheiro xml de mimetype non válido"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Mentres se obtiñan os metadatos desanexados: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Ao crear o directorio adicional: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "SHA256 non válido para os datos adicionais"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Tamaño dos datos adicinais incorrecto"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Suma de verificación non válida para os datos adicinais"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Ao escribir o ficheiro de datos adicionais «%s»: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "apply_extra script failed, estado de saída %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Ao tentar resolver a referencia %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s non está dispoñíbel"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s rama %s xa instalado"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Produciuse un fallo ao ler a remisión %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Ao tentar obter %s en %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Ao tentar obter a subruta de metadatos: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Ao tentar eliminar o directorio adicinal existente: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Ao tentar aplicar os datos adicionais: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Referencia %s despregada non válida: "
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Referencia de remisión %s non válida: "
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "O tipo %s da referencia despregada non coincide coa remisión (%s)"
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "O nome %s da referencia despregada non coincide coa remisión (%s)"
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+"A arquitectura %s da referencia despregada non coincide coa remisión (%s)"
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "A rama %s da referencia despregada non coincide coa remisión (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "A referencia %s despregada non coincide coa remisión (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Os metadatos despregados non coinciden coa remisión"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Esta versión de %s xa está instalada"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Non é posíbel cambiar o remoto durante a instalación dun paquete"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s rama %s non está instalado"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s rama %s non instalado"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Nada coincide con %s"
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Non se puido atopar a referencia %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Produciuse un erro ao buscar o remoto %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Produciuse un erro ao buscar no repositorio local: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s non está instalado"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Non foi posíbel atopar a instalación %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Runtime %s, rama %s xa está instalado"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Aplicativo %s, rama %s xa está instalado"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Título do repositorio remoto non está estabelecido"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Rama por omisión do repositorio remoto non estabelecida"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Non hai caché de flatpak na descrición do remoto"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Non hai ningunha entrada para %s na caché de flatpak do resumo remoto "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Tipo de compartido %s descoñecido, os tipos validos son: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Tipo de normativa %s descoñecida, os tipos válidos son: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Nome de dbus %s non válido\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Tipo de socket %s descoñecido, os tipos validos son: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Tipo de dispositivo %s descoñecido, os tipos válidos son: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Tipo de característica %s descoñecida, os tipos validos son: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Localización de sistema de ficheiros %s descoñecido, as localizacións "
+"válidas son: hos, home, xdg-*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Formato de env %s non válido"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Compartir co anfitrión"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "COMPARTIR"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Deixar de compartir co anfitrión"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Expoñer o socket ao aplicativo"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOCKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Non expoñer o socket ao aplicativo"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Expoñer o dispositivo ao aplicativo"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "DISPOSITIVO"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Non expoñer o dispositivo ao aplicativo"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Permitir característica"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "CARACTERÍSTICA"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "No permitir característica"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Expoñer o sistema de ficheiros ao aplicativo (:ro para só lectura)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SISTEMA_FICHEIROS[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Non expoñer o sistema de ficheiros ao aplicativo"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SISTEMA_FICHEIROS"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Estabelecer variábel de ambiente"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VAR=VALOR"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Permitir que o aplicativo teña un nome propio no bus de sesión"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NOME_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Permitir ao aplicativo falar cun nome no bus de sesión"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Permitir ao aplicativo posuír un nome propio no bus do sistema"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Permitir ao aplicativo falar cun nome no bus de sistema"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Engadir unha opción de normativa xenérica"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSISTEMA.CHAVE=VALOR"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Eliminar opción de normativa xenérica"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Persistir o directorio persoal"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NOME_FICHEIRO"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Non requirir unha sesión en execución (sen creación de cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Produciuse un fallo ao abrir o ficheiro temporal flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Produciuse un fallo ao abrir o ficheiro temporal: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Non foi posíbel crear a tubería de sincronización"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr ""
+"Produciuse un fallo ao abrir o ficheiro de información de aplicativo: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Procuciuse un fallo ao sincronizarse co proxi de dbus"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "apply_extra script failed, estado de saída %d"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Actualizando: %s desde %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Produciuse un erro ao buscar o remoto %s: %s"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Non hai orixes de datos adicionais"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Ao descargar %s: "
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Non hai orixes de datos adicionais"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Instalar aplicativo asinado"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Requírese autenticación para instalar software"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Instalar runtime asinado"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Actualizar aplicativo asinado"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Requírese autenticación para actualizar software"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Actualizar runtime asinado"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Actualizar metadatos do remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Requírese autenticación para actualizar a información do remoto"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Actualizaar o ficheiro de resumo no repositorio"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Requírese autenticación para actualizar a información do remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Instalar paquete"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Desinstalar paquete"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Requírese autenticación para desinstalar software"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Descativar aplicativo"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Configurar remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Requírese autenticación para configurar os repositorios de software"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Configurar remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr "Requírese autenticación para configurar os repositorios de software"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Actualizar appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Sen remoto %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Mostrar instalacións do usuario"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Mostrar instalacións do sistema"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Mostrar instalacións específicas do sistema"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Produciuse un fallo ao crear o ficheiro temporal"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Produciuse un fallo ao desligar o ficheiro temporal"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Produciuse un fallo ao escribir no ficheiro temporal"
diff --git a/po/hu.gmo b/po/hu.gmo
new file mode 100644 (file)
index 0000000..6f2de38
Binary files /dev/null and b/po/hu.gmo differ
diff --git a/po/hu.po b/po/hu.po
new file mode 100644 (file)
index 0000000..086dbc6
--- /dev/null
+++ b/po/hu.po
@@ -0,0 +1,2890 @@
+# Hungarian translation for flatpak.
+# Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+# This file is distributed under the same license as the flatpak package.
+#
+# Balázs Úr <urbalazs@gmail.com>, 2016, 2017.
+# Gabor Kelemen <kelemeng at ubuntu dot com>, 2016.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-05-14 19:51+0100\n"
+"Last-Translator: Balázs Úr <urbalazs@gmail.com>\n"
+"Language-Team: Hungarian <openscope at googlegroups dot com>\n"
+"Language: hu\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Lokalize 2.0\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Ne tegyen semmit, ha a megadott távoli létezik"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "A HELY egy beállítófájlt határoz meg, nem a tároló helyét"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "GPG ellenőrzés engedélyezése"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "A távoli megjelölése felsorolásként"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "A távoli megjelölése függőségekhez használtként"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Új URL beállítása"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "A távoli engedélyezése"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "További metaadatok frissítése az összegzőfájlból"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "GPG ellenőrzés letiltása"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "A távoli megjelölése nem felsorolandóként"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "A távoli megjelölése függőségekhez nem használtként"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+"Prioritás beállítása (alapértelmezetten 1, a magasabb nagyobb prioritású)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITÁS"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Egy szép, ehhez a távolihoz használandó név"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "CÍM"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Ehhez a tárolóhoz használandó alapértelmezett ág"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "ÁG"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "GPG kulcs importálása a FÁJLBÓL (- a szabványos bemenethez)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "FÁJL"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "A távoli letiltása"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "OCI regisztrációs adatbázis hozzáadása"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Nem lehet megnyitni a(z) %s névteret: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Érvénytelen %s env formátum"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Érvénytelen URI-típus (%s), csak a http/https támogatott"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Érvénytelen %s pid"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NÉV HELY - Egy távoli tároló hozzáadása"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "A NÉV megadása kötelező"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "A HELY megadása kötelező"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Túl sok argumentum"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, fuzzy, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "A(z) „%s” nem érvényes alkalmazásnév: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "A távoli %s már létezik"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Nincs URL megadva a flatpaktároló fájlban"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, fuzzy, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Nem sikerült frissíteni a(z) %s további metaadatait"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NÉV - Egy távoli tároló módosítása"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "A távoli NÉV megadása kötelező"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "További metaadatok frissítése a(z) %s távoli összegzéséből\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Hiba a(z) „%s” további metaadatainak frissítéskor: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Nem sikerült frissíteni a(z) %s további metaadatait"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Futtatókörnyezet exportálása az alkalmazás helyett"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Csomagolás ezen architektúrához"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARCHITEKTÚRA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "URL a tárolóhoz"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "URL a futtatókörnyezet flatpaktároló fájlhoz"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "GPG kulcs hozzáadása a FÁJLBÓL (- a szabványos bemenethez)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Egy OCI-lemezkép exportálása flatpak csomag helyett"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "GPG kulcsazonosító az OCI-lemezkép aláírásához"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "KULCSAZONOSÍTÓ"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "A kulcstartók keresésekor használandó GPG saját könyvtár"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "SAJÁTKÖNYVTÁR"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"HELY FÁJLNÉV NÉV [ÁG] - Egyetlen fájlcsomag létrehozása helyi tárolóból"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "A HELY, FÁJLNÉV és NÉV megadása kötelező"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "A(z) „%s” nem érvényes tároló"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "A(z) „%s” nem érvényes név: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "A(z) „%s” nem érvényes ágnév: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Platform futtatókörnyezet használata az Sdk helyett"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Kötési csatolás hozzáadása"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "CÉL=FORRÁS"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Összeállítás indítása ebben a könyvtárban"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "KÖNYVTÁR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Hol keresse az egyéni sdk könyvtárat (alapértelmezetten „usr”)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Alternatív fájl használata a metaadatokhoz"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Munkamenetbusz-hívások naplózása"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Rendszerbusz-hívások naplózása"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "KÖNYVTÁR [PARANCS [argumentumok…]] - Összeállítás a könyvtárban"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "A KÖNYVTÁR megadása kötelező"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"A(z) „%s” összeállítási könyvtár nincs előkészítve, a flatpak összeállítás-"
+"előkészítő használata"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "a metaadat érvénytelen, nem alkalmazás vagy futtatókörnyezet"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Nincs %s illeszkedésű kiterjesztéspont ebben: %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Hiányzó „=” a(z) „%s” kötési csatolás kapcsolóban"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Nem indítható el az alkalmazás"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Forrástároló könyvtár"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "FORRÁS-TÁROLÓ"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Forrástároló hivatkozás"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "FORRÁS-HIVATKOZÁS"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Egysoros tárgy"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "TÁRGY"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Teljes leírás"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TÖRZS"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Az AppStream ág frissítése"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Ne frissítse az összegzést"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "GPG kulcsazonosító a kommit aláírásához"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"CÉL-TÁROLÓ [CÉL-HIVATKOZÁS]… - Új kommit készítése a meglévő kommitok alapján"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "A CÉL-TÁROLÓ megadása kötelező"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Ha a --src-repo nincs megadva, akkor pontosan egy célhivatkozást kell megadni"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Ha a --src-ref meg van adva, akkor pontosan egy célhivatkozást kell megadni"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Vagy a --src-repo, vagy a --src-ref megadása kötelező."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Nem lehet kommitolni részleges forráskommitból."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Architektúra az exportáláshoz (a gazdával kompatibilisnek kell lennie)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Futtatókörnyezet kommitolása (/usr), a /app helyett"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Alternatív könyvtár használata a fájlokhoz"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "ALKÖNYVTÁR"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Kizárandó fájlok"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "MINTA"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Felvenni kívánt kizárt fájlok"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Nem sikerült megnyitni az átmeneti fájlt: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Érvénytelen URI-típus (%s), csak a http/https támogatott"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+"Nem sikerült megtalálni az alapnevet ebben: %s, pontosan adja meg a nevet"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "A perjelek nem engedélyezettek a további adatok névében"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Érvénytelen formátum az sha256 ellenőrzőösszegnél: „%s”"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Nulla méretű további adatméret nem támogatott"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "HELY KÖNYVTÁR [ÁG] - Tároló létrehozása egy összeállítási könyvtárból"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "A HELY és KÖNYVTÁR megadása kötelező"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Nincs név megadva a metaadatokban"
+
+#: app/flatpak-builtins-build-export.c:976
+#, fuzzy, c-format
+msgid "Commit: %s\n"
+msgstr "Kommit:"
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Metaadatok:"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Metaadatok:"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Beállítandó parancs"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "PARANCS"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "A szükséges flatpak-verzió"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "FŐ.KISEBB.APRÓ"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Ne dolgozza fel az exportokat"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "További adatinformációk"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Kiterjesztéspont-információk hozzáadása"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NÉV=VÁLTOZÓ[=ÉRTÉK]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Az alkalmazáshoz használt sdk megváltoztatása"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Az alkalmazáshoz használt futtatókörnyezet megváltoztatása"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "FUTTATÓKÖRNYEZET"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Általános metaadat lehetőség beállítása"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "CSOPORT=KULCS[=ÉRTÉK]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Összegzés frissítése\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Túl kevés elem a(z) %s --extra-data argumentumban"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Túl kevés elem a(z) %s --metadata argumentumban, a formátumnak "
+"CSOPORT=KULCS[=ÉRTÉK] alakban kell lennie"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Túl kevés elem a(z) %s --extension argumentumban, a formátumnak "
+"NÉV=VÁLTOZÓ[=ÉRTÉK] alakban kell lennie"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "KÖNYVTÁR - Egy összeállítási könyvtár befejezése"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "A(z) „%s” összeállítási könyvtár nincs előkészítve"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "A(z) „%s” összeállítási könyvtár már be lett fejezve"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Nézze át az exportált fájlokat és a metaadatokat\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Az importált csomaghoz használt hivatkozás felülbírálása"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "HIVATKOZÁS"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Egy OCI-lemezkép importálása flatpak csomag helyett"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "A(z) „%s” hivatkozás nem található a regisztrációs adatbázisban"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+"Több lemezkép van a regisztrációs adatbázisban, adjon meg egy hivatkozást a "
+"--ref használatával"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Frissítés: %s innen: %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "HELY FÁJLNÉV - Egy fájlcsomag importálása egy helyi tárolóba"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "A HELY és FÁJLNÉV megadása kötelező"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Használandó architektúra"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Változó előkészítése egy elnevezett futtatókörnyezetből"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Alkalmazások előkészítése egy elnevezett alkalmazásból"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "ALKALMAZÁS"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Verzió megadása a --base kapcsolóhoz"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERZIÓ"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Ezen alapkiterjesztés felvétele"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "KITERJESZTÉS"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Az /usr előkészítése az sdk írható másolatával"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr ""
+"Az összeállítás-típus megadása (alkalmazás, futtatókörnyezet, kiterjesztés)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TÍPUS"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Címke hozzáadása"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "CÍMKE"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Ezen sdk kiterjesztés felvétele az /usr könyvtárba"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Hol tárolja az sdk-t (alapértelmezetten „usr”)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Az sdk vagy változó újra előkészítése"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "A kért %s kiterjesztés csak részlegesen van telepítve"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "A szükséges %s kiterjesztés nincs telepítve"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"KÖNYVTÁR ALKALMAZÁSNÉV SDK FUTTATÓKÖRNYEZET [ÁG] - Könyvtár előkészítése az "
+"összeállításhoz"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "A FUTTATÓKÖRNYEZET megadása kötelező"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"A(z) „%s” nem érvényes összeállítás-típus név, alkalmazás, futtatókörnyezet "
+"vagy kiterjesztés használata szükséges"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "A(z) „%s” nem érvényes alkalmazásnév: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "A(z) „%s” összeállítási könyvtár már elő van készítve"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Telepítés ezen architektúrára"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "A megadott nevű futtatókörnyezet keresése"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "HELY [AZONOSÍTÓ [ÁG]] - Egy alkalmazás vagy futtatókörnyezet aláírása"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Nincsenek megadva GPG kulcsazonosítók"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Ismeretlen „%s” parancs"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "Az ALKALMAZÁS megadása kötelező"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Távoli eltávolítása akkor is, ha használatban van"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NÉV - Egy távoli tároló törlése"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Egyedi dokumentumhivatkozás létrehozása"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "A dokumentum átmenetivé tétele a jelenlegi munkamenethez"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Ne követelje meg, hogy a fájl már létezzen"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Olvasási jogosultság adása az alkalmazásnak"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Írási jogosultság adása az alkalmazásnak"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Törlési jogosultság adása az alkalmazásnak"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr ""
+"További jogosultságok adására vonatkozó jogosultság adása az alkalmazásnak"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Az alkalmazás olvasási jogosultságának visszavonása"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Az alkalmazás írási jogosultságának visszavonása"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Az alkalmazás törlési jogosultságának visszavonása"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "További jogosultságok adására vonatkozó jogosultság visszavonása."
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Jogosultságok hozzáadása ehhez az alkalmazáshoz"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "ALKALMAZÁSAZONOSÍTÓ"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "FÁJL - Fájl exportálása az alkalmazásokba"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "A FÁJL megadása kötelező"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "FÁJL - Információk lekérése egy exportált fájlról"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Nincs exportálva\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[ALKALMAZÁSAZONOSÍTÓ] - Exportált fájlok felsorolása"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "FÁJL - Fájl alkalmazásokba exportálásának visszavonása"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"HOMOKOZÓS-PID [PARANCS [argumentumok…]] - Parancs futtatása egy futó "
+"homokozón belül"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "A HOMOKOZÓS-PID és PARANCS megadása kötelező"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Érvénytelen %s pid"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Nincs ilyen PID: %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "A cwd nem olvasható"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "A root nem olvasható"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Érvénytelen %s névtér a(z) %d pid-hez"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Érvénytelen %s névtér saját magához"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Nem lehet megnyitni a(z) %s névteret: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Nem lehet belépni a(z) %s névtérbe: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "A chdir sikertelen"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "A chroot sikertelen"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Nem állítható át a GID"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Nem állítható át az UID"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Felhasználói telepítések megjelenítése"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Rendszerszintű telepítések megjelenítése"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Bizonyos rendszerszintű telepítések megjelenítése"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Hivatkozás megjelenítése"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Kommit megjelenítése"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Eredet megjelenítése"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Méret megjelenítése"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Metaadatok megjelenítése"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Kiterjesztések megjelenítése"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NÉV [ÁG] - Információk lekérése a telepített alkalmazásról és/vagy "
+"futtatókörnyezetről"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Hivatkozás:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "Azonosító:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Architektúra:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Ág:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Eredet:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Aktív kommit:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Legutolsó kommit:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Kommit:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alternatív azonosító:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Hely:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Telepített méret:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Futtatókörnyezet:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Telepített alkönyvtárak:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Kiterjesztés:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Alútvonalak:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "KOMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Alkalmazás keresése a megadott névvel"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Hivatkozás megjelenítése"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "A TÁVOLI és HIVATKOZÁS megadása kötelező"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Letöltési méret"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Kommit:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Ne kérje le, csak telepítse a helyi gyorsítótárból"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Ne telepítse, csak töltse le a helyi gyorsítótárba"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Ne telepítse a kapcsolódó hivatkozásokat"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Ne ellenőrizze/telepítse a futtatókörnyezet függőségeit"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Ne használjon statikus deltákat"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Feltételezzük, hogy a HELY egy .flatpak önálló fájlból álló csomag"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Feltételezzük, hogy a HELY egy .flatpakref alkalmazás-leírás"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Csomag aláírásának ellenőrzése GPG kulccsal a FÁJLBÓL (- a szabványos "
+"bemenethez)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Csak ezen alútvonal telepítése"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "ÚTVONAL"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Automatikusan válaszoljon igennel minden kérdésre"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "A(z) %s kommit %s már telepítve van"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Ez az alkalmazás a következőkből való futtatókörnyezetektől függ:\n"
+"  %s\n"
+"Ennek beállítása mint új távoli „%s”"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "A(z) %s beállítása mint új távoli „%s”"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "A csomagfájlnév megadása kötelező"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "A távoli csomagok nem támogatottak"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "A fájlnév vagy URI megadása kötelező"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Telepítés: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr ""
+"HELY/TÁVOLI [HIVATKOZÁS…] - Alkalmazások vagy futtatókörnyezetek telepítése"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "További információk megjelenítése"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Telepített futtatókörnyezetek felsorolása"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Telepített alkalmazások felsorolása"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Megjelenítendő architektúra"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Hivatkozás"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Eredet"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Aktív kommit"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Legutolsó kommit"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Telepített méret"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Beállítások"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Telepített alkalmazások és/vagy futtatókörnyezetek felsorolása"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Távoli részleteinek megjelenítése"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Letiltott távoliak megjelenítése"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Távoli tárolók felsorolása"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Név"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Cím"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioritás"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Architektúrák és ágak megjelenítése"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Csak futtatókörnyezetek megjelenítése"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Csak alkalmazások megjelenítése"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Csak azok megjelenítése, ahol frissítések érhetők el"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Korlátozás erre az architektúrára (* az összeshez)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " TÁVOLI - Elérhető futtatókörnyezetek és alkalmazások megjelenítése"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Kommit"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Letöltési méret"
+
+#: app/flatpak-builtins-ls-remote.c:301
+#, fuzzy
+msgid "No ref information available in repository"
+msgstr "Általános információk kiírása a tárolóról"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Aktuálissá tétel ezen architektúrára"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "ALKALMAZÁS ÁG - Az alkalmazás ágának aktuálissá tétele"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Az ALKALMAZÁS megadása kötelező"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Az ÁG megadása kötelező"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "A(z) %s alkalmazás, %s ág nincs telepítve"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "ALKALMAZÁS - Beállítások felülbírálása az alkalmazáshoz"
+
+#: app/flatpak-builtins-repo.c:48
+#, fuzzy, c-format
+msgid "Title: %s\n"
+msgstr "Cím"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Telepítve"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Letöltés"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Általános információk kiírása a tárolóról"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "A tárolóban lévő ágak felsorolása"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Egy ág metaadatainak kiírása"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "HELY - Tároló karbantartása"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Ezen tároló átirányítása egy új URL-re"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Egy szép, ehhez a tárolóhoz használandó név"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Ehhez a tárolóhoz használandó alapértelmezett ág"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Új alapértelmezett GPG nyilvános kulcs importálása FÁJLBÓL"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "GPG kulcsazonosító az összegzés aláírásához"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Delta fájlok előállítása"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Nem használt objektumok törlése"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Csak MÉLYSÉG szülők bejárása az egyes kommitoknál (alapértelmezett: -1 = "
+"végtelen)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "MÉLYSÉG"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Delta előállítása: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Delta előállítása: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Nem sikerült a(z) %s (%.10s) delta előállítása: "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Nem sikerült a(z) %s (%.10s-%.10s) delta előállítása: "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "HELY - Tároló metaadatainak frissítése"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Az AppStream ág frissítése\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Összegzés frissítése\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Objektumok összesen: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Nincsenek elérhetetlen objektumok\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u objektum törölve, %s felszabadítva\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Futtatandó parancs"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Használandó ág"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Fejlesztői futtatókörnyezet használata"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Használandó futtatókörnyezet"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Használandó futtatókörnyezet-verzió"
+
+#: app/flatpak-builtins-run.c:60
+#, fuzzy
+msgid "Log accessibility bus calls"
+msgstr "Munkamenetbusz-hívások naplózása"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Fájltovábbítás engedélyezése"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "ALKALMAZÁS [argumentumok…] - Alkalmazás futtatása"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "A TÁVOLI megadása kötelező"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Alkalmazás futtatása"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Ág:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Nincs távoli %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Teljes leírás"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Semmi sem egyezik: %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Eltávolítandó architektúra"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Hivatkozás megtartása a helyi tárolóban"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Ne távolítsa el a kapcsolódó hivatkozásokat"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Fájlok eltávolítása akkor is, ha futnak"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "HIVATKOZÁS… - Alkalmazás eltávolítása"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Legalább egy HIVATKOZÁS megadása kötelező"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Figyelmeztetés: hiba a kapcsolódó hivatkozások keresésekor: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Telepítés: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Frissítés ezen architektúrára"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Telepítendő kommit"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Régi fájlok eltávolítása akkor is, ha futnak"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Ne kérje le, csak frissítse a helyi gyorsítótárból"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Ne frissítse a kapcsolódó hivatkozásokat"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Az AppStream frissítése a távolihoz"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Csak ezen alútvonal frissítése"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Az AppStream frissítése a távolihoz: %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Az AppStream frissítése a távolihoz: %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Összegzés frissítése\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[HIVATKOZÁS…] - Alkalmazások vagy futtatókörnyezetek frissítése"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Nincsenek frissítések.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Melyiket szeretné telepíteni (0 a megszakításhoz)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Telepített alkalmazások és futtatókörnyezetek kezelése"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Egy alkalmazás vagy futtatókörnyezet telepítése"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Telepített alkalmazás vagy futtatókörnyezet frissítése"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Telepített alkalmazás vagy futtatókörnyezet eltávolítása"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Telepített alkalmazások és/vagy futtatókörnyezetek felsorolása"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+"Információk megjelenítése a telepített alkalmazáshoz vagy futtatókörnyezethez"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Távoli beállítása"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Alkalmazás vagy futtatókörnyezet aláírása"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Futó alkalmazások"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Alkalmazás futtatása"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Jogosultságok felülbírálása egy alkalmazásnál"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Alapértelmezett verzió megadása a futtatáshoz"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Futó alkalmazás névterének megadása"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Fájlhozzáférés kezelése"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Hozzáférés adása egy alkalmazásnak egy bizonyos fájlhoz"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Hozzáférés visszavonása egy bizonyos fájlhoz"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Információk megjelenítése egy bizonyos fájlról"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Exportált fájlok felsorolása"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Távoli tárolók kezelése"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Az összes beállított távoli felsorolása"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Új távoli tároló hozzáadása (URL alapján)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Beállított távoli tulajdonságainak módosítása"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Beállított távoli törlése"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Beállított távoli tartalmának felsorolása"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr ""
+"Információk megjelenítése a telepített alkalmazáshoz vagy futtatókörnyezethez"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Alkalmazások összeállítása"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Könyvtár előkészítése az összeállításhoz"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Összeállítási parancs futtatása az összeállítási könyvtáron belül"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Összeállítási könyvtár befejezése exportáláshoz"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Összeállítási könyvtár exportálása tárolóba"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Csomagfájl létrehozása összeállítási könyvtárból"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Csomagfájl importálása"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Alkalmazás vagy futtatókörnyezet aláírása"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Az összegzőfájl frissítése egy tárolóban"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Új kommit létrehozása meglévő hivatkozás alapján"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Információk kiírása egy tárolóról"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Hibakeresési információk kiírása a parancsfeldolgozás közben"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "OSTree hibakeresési információk kiírása a parancsfeldolgozás közben"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Súgólehetőségek megjelenítése"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Verzióinformációk kiírása és kilépés"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Alapértelmezett architektúra kiírása és kilépés"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Támogatott architektúrák kiírása és kilépés"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Aktív gl illesztőprogramok kiírása és kilépés"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Munkavégzés a felhasználói telepítéseken"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Munkavégzés a rendszerszintű telepítéseken (alapértelmezett)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Munkavégzés egy bizonyos rendszerszintű telepítésen"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NÉV"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Beépített parancsok:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Ismeretlen „%s” parancs"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Nincs parancs megadva"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "hiba:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Megtalálható számos távoliban:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Megtalálható a(z) %s távoliban, szeretné telepíteni?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Megtalálható számos távoliban:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Melyiket szeretné telepíteni (0 a megszakításhoz)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "A(z) %s (%s) szükséges futtatókörnyezete nincs telepítve, keresés…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"A szükséges %s futtatókörnyezet nem található a beállított távoliban.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "A(z) %s nincs telepítve"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "A(z) %s távoli le van tiltva, %s frissítésének mellőzése"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "A(z) %s már telepítve van, kihagyás\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "A(z) %s kommit %s már telepítve van"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "A(z) %s egy későbbi flatpak verziót (%s) igényel"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Hiba a(z) „%s” további metaadatainak frissítéskor: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "telepítés"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Telepítés: %s innen: %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Telepítés: %s innen: %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "frissítés"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Frissítés: %s innen: %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Frissítés: %s innen: %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Most: %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Nincsenek frissítések.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "csomag telepítése"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Telepítés: %s ebből a csomagból: %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Telepítés: %s ebből a csomagból: %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Figyelmeztetés: %s %s sikertelen: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Hiba: %s %s sikertelen: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Egy vagy több művelet sikertelen"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Nem találhatók felülbírálások ehhez: %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "A(z) %s tároló megnyitása közben: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Nem lehet létrehozni a telepítési könyvtárat"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Érvénytelen sha256 a további adat URI-nál: %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Üres név a további adat URI-nál: %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Nem támogatott további adat URI: %s"
+
+#: common/flatpak-dir.c:2647
+#, fuzzy, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Nem sikerült olvasni a(z) %s kommitot: "
+
+#: common/flatpak-dir.c:2650
+#, fuzzy, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Hibás méret a(z) %s további adatnál"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "A(z) %s letöltése közben: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Hibás méret a(z) %s további adatnál"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Érvénytelen ellenőrzőösszeg a(z) %s további adatnál"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "A(z) %s kommit %s már telepítve van"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "A(z) %s lekérése közben a(z) %s távoliról: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "A(z) %s nem található a(z) %s távoliban"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Nincs elég memória"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Nem sikerült olvasni az exportált fájlból"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Hiba a MIME-típus XML-fájl olvasásakor"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Érvénytelen MIME-típus XML-fájl"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "A különálló metaadatok lekérése közben: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "A további könyvtár létrehozása közben: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Érvénytelen sha256 a további adatnál"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Hibás méret a további adatnál"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Érvénytelen ellenőrzőösszeg a további adatnál"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "A(z) „%s” további adatfájl írása közben: "
+
+#: common/flatpak-dir.c:5181
+#, fuzzy, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Az apply_extra parancsfájl sikertelen"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "A(z) %s hivatkozás feloldására tett kísérlet közben: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "A(z) %s nem érhető el"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "A(z) %s %s ág már telepítve van"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Nem sikerült olvasni a(z) %s kommitot: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "A(z) %s -> %s átváltására tett kísérlet közben: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "A metaadatok alútvonalának átváltására tett kísérlet közben: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "A meglévő további könyvtár eltávolítására tett kísérlet közben: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "A további adatok alkalmazására tett kísérlet közben: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Érvénytelen %s pid"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Érvénytelen %s pid"
+
+#: common/flatpak-dir.c:5448
+#, fuzzy, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:5456
+#, fuzzy, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:5464
+#, fuzzy, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:5470
+#, fuzzy, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:5476
+#, fuzzy, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Az üzembe állított metaadatok nem egyeznek a kommittal"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "A(z) %s ezen verziója már telepítve van"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Nem lehet megváltoztatni a távolit csomagtelepítés közben"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "A(z) %s %s ág nincs telepítve"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "A(z) %s %s ág nincs telepítve"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Semmi sem egyezik: %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "A(z) %s%s%s%s%s nem található a(z) %s távoliban"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Hiba: %s %s sikertelen: %s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Hivatkozás megtartása a helyi tárolóban"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "A(z) %s %s nincs telepítve"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Nem található a telepítési %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "A(z) %s futtatókörnyezet, %s ág már telepítve van"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "A(z) %s alkalmazás, %s ág már telepítve van"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "A távoli cím nincs beállítva"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "A távoli alapértelmezett ág nincs beállítva"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Nincs flatpak gyorsítótár a távoli összegzésben"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr ""
+"Nincs bejegyzés a(z) %s esetén a távoli összegzés flatpak gyorsítótárban "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Ismeretlen %s megosztástípus, az érvényes típusok: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Ismeretlen %s házirendtípus, az érvényes típusok: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Ismeretlen %s D-Bus név\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Ismeretlen %s foglalattípus, az érvényes típusok: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Ismeretlen %s eszköztípus, az érvényes típusok: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Ismeretlen %s jellemzőtípus, az érvényes típusok: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Ismeretlen %s fájlrendszer hely, az érvényes típusok: gép, saját könyvtár, "
+"xdg-*[/...], ~/könyvtár, /könyvtár"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Érvénytelen %s env formátum"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Megosztás a gazdagéppel"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "MEGOSZTÁS"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Megosztás megszüntetése a gazdagéppel"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Foglalat elérhetővé tétele az alkalmazásnak"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "FOGLALAT"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Ne tegye elérhetővé a foglalatot az alkalmazásnak"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Eszköz elérhetővé tétele az alkalmazásnak"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "ESZKÖZ"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Ne tegye elérhetővé az eszközt az alkalmazásnak"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Jellemző engedélyezése"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "JELLEMZŐ"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Ne engedélyezze a jellemzőt"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+"Fájlrendszer elérhetővé tétele az alkalmazásnak (:ro a csak olvashatóhoz)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "FÁJLRENDSZER[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Ne tegye elérhetővé a fájlrendszert az alkalmazásnak"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "FÁJLRENDSZER"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Környezeti változó beállítása"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VÁLTOZÓ=ÉRTÉK"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Név birtoklásának lehetővé tétele az alkalmazásnak a munkamenetbuszon"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "DBUS_NÉV"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr ""
+"A névhez való beszéd lehetővé tétele az alkalmazásnak a munkamenetbuszon"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Név birtoklásának lehetővé tétele az alkalmazásnak a rendszerbuszon"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "A névhez való beszéd lehetővé tétele az alkalmazásnak a rendszerbuszon"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Általános irányelv-lehetőség hozzáadása"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "ALRENDSZER.KULCS=ÉRTÉK"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Általános irányelv-lehetőség eltávolítása"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Saját könyvtár megőrzése"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "FÁJLNÉV"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Ne követeljen meg egy futó munkamenetet (nincs cgroups létrehozás)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Nem sikerült megnyitni a flatpak-információs átmeneti fájlt: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Nem sikerült megnyitni az átmeneti fájlt: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Nem hozható létre szinkronizálási cső"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Nem sikerült megnyitni az alkalmazás-információs fájlt: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Nem sikerült szinkronizálni a dbus proxyval"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "Az apply_extra parancsfájl sikertelen"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Frissítés: %s innen: %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Hiba: %s %s sikertelen: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Nincsenek további adatforrások"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Letöltési méret"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Letöltési méret"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Letöltési méret"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Aláírt alkalmazás telepítése"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Hitelesítés szükséges a szoftver telepítéséhez"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Aláírt futtatókörnyezet telepítése"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Aláírt alkalmazás frissítése"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Hitelesítés szükséges a szoftver frissítéséhez"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Aláírt futtatókörnyezet frissítése"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Távoli metaadatok frissítése"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Hitelesítés szükséges a távoli információk frissítéséhez"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Az összegzőfájl frissítése egy tárolóban"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Hitelesítés szükséges a távoli információk frissítéséhez"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Csomag telepítése"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Futtatókörnyezet eltávolítása"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Hitelesítés szükséges a szoftver eltávolításához"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Alkalmazás eltávolítása"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Távoli beállítása"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Hitelesítés szükséges a szoftvertárolók beállításához"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Távoli beállítása"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr "Hitelesítés szükséges a szoftvertárolók beállításához"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "AppStream frissítése"
+
+#~ msgid "No remote %s"
+#~ msgstr "Nincs távoli %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Felhasználói telepítések megjelenítése"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Rendszerszintű telepítések megjelenítése"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Bizonyos rendszerszintű telepítések megjelenítése"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Nem sikerült létrehozni az átmeneti fájlt"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Nem sikerült törölni az átmeneti fájlt"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Nem sikerült írni az átmeneti fájlba"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Telepítés: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Telepítés: %s\n"
diff --git a/po/id.gmo b/po/id.gmo
new file mode 100644 (file)
index 0000000..59552f8
Binary files /dev/null and b/po/id.gmo differ
diff --git a/po/id.po b/po/id.po
new file mode 100644 (file)
index 0000000..d29ce15
--- /dev/null
+++ b/po/id.po
@@ -0,0 +1,2873 @@
+# Indonesian translation for flatpak.
+# Copyright (C) 2017 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Kukuh Syafaat <syafaatkukuh@gmail.com>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-11-30 14:16+0700\n"
+"Last-Translator: Kukuh Syafaat <syafaatkukuh@gmail.com>\n"
+"Language-Team: Indonesian <gnome-l10n-id@googlegroups.com>\n"
+"Language: id\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.0.4\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Tidak melakukan apapun jika remote yang disediakan ada"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "LOKASI menentukan berkas konfigurasi, bukan lokasi repo"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Aktifkan verifikasi GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Tandai remote sebagai enumerasi"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Tandai remote seperti yang digunakan untuk dependensi"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Atur url baru"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Aktifkan remote"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Perbarui metadata tambahan dari berkas ringkasan"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Nonaktifkan verifikasi GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Tandai remote jangan sebagai enumerasi"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Tandai remote seperti yang jangan digunakan untuk dependensi"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Atur prioritas (bawaan 1, lebih tinggi berarti lebih diprioritaskan)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITAS"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Sebuah nama yang bagus untuk digunakan bagi remote ini"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "JUDUL"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Cabang bawaan yang digunakan untuk remote ini"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "CABANG"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "ID Koleksi"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "ID-KOLEKSI"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Impor kunci GPG dari BERKAS (- untuk stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "BERKAS"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Nonaktifkan remote"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Tambah registri OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr "Tidak dapat memuat uri %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Tidak dapat memuat berkas %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr "Format berkas tidak valid"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Versi %s tidak valid, hanya 1 yang didukung"
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr "Kunci gpg tidak valid"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NAMA LOKASI - Tambah repositori remote"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NAMA harus ditentukan"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "LOKASI harus ditentukan"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Terlalu banyak argumen"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "'%s' bukan ID koleksi yang valid: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "Verifikasi GPG diperlukan jika koleksi diaktifkan"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Remote %s sudah ada"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Tidak ada url yang ditentukan dalam berkas flatpakrepo"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Peringatan: Tidak dapat memperbarui metadata tambahan untuk '%s': %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NAMA - Mengubah repositori remote"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "NAMA remote harus ditentukan"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Memperbarui metadata ekstra dari ringkasan remote untuk %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Galat memperbarui metadata tambahan untuk '%s': %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Tidak dapat memperbarui metadata tambahan untuk %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Ekspor runtime alih-alih aplikasi"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Arsitektur tujuan bundel"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARSITEKTUR"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url untuk repo"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url untuk berkas flatpakrepo runtime"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Tambah kunci GPG dari BERKAS (- untuk stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Ekspor citra oci alih-alih paket flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID kunci GPG untuk menandatangani citra OCI"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ID KUNCI"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Homedir GPG untuk digunakan saat mencari ring kunci"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "HOMEDIR"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"LOKASI NAMABERKAS NAMA [CABANG] - Buat bundel berkas tunggal dari repositori "
+"lokal"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "LOKASI, NAMABERKAS dan NAMA harus ditentukan"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "'%s' bukan repositori yang valid"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "'%s' bukan nama yang valid: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "'%s' bukan nama cabang yang valid: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Gunakan runtime Platform daripada Sdk"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr "Buat tujuan hanya baca"
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Tambah kait bind"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "DEST=SRC"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Mulai bangun di direktori ini"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "DIR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Di mana mencari direktori sdk tersuai (bawaan ke 'usr')"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Gunakan berkas alternatif untuk metadata"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Bunuh proses saat proses induk mati"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Ekspor direktori homedir aplikasi untuk membangun"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Catat log pemanggilan bus sesi"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Catat log pemanggilan bus sistem"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "DIREKTORI [PERINTAH [argumen ...]] - Bangun di direktori"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "DIREKTORI harus ditentukan"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "Direktori bangun %s tidak diinisialisasi, gunakan flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "metadata tidak valid, bukan aplikasi atau runtime"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Tidak ada titik ekstensi %s yang cocok pada %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Kehilangan '=' pada opsi kait bind '%s'"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Tidak dapat memulai aplikasi"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Direktori repo sumber"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "SRC-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Ref repo sumber"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "SRC-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Subjek satu baris"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "SUBJEK"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Deskripsi lengkap"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TUBUH"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Perbarui cabang appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Jangan perbarui ringkasan"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID kunci GPG untuk menandatangani komit dengan"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"DST-REPO [DST-REF]... - Buat komit baru berdasarkan komit yang sudah ada"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "DST-REPO harus ditentukan"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Jika --src-repo tidak ditentukan, tepatnya satu tujuan harus ditentukan"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr "Jika --src-ref ditentukan, salah satu tujuan ref harus ditentukan"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Entah --src-repo atau --src-ref harus ditentukan."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Tidak bisa melakukan komit dari sebagian sumber."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr "%s: tidak ada perubahan\n"
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Arsitektur tujuan ekspor (mesti kompatibel dengan host)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Runtime komit (/usr), bukan /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Gunakan direktori alternatif untuk berkas"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "SUBDIR"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Berkas untuk dikecualikan"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "POLA"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Sertakan berkas yang dikecualikan"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Menimpa timestamp dari komit"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ISO-8601-TIMESTAMP"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr "PERINGATAN: Galat menjalankan desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr "PERINGATAN: Galat membaca dari desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "PERINGATAN: Gagal memvalidasi berkas destop %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr "PERINGATAN: Tidak dapat menemukan kunci Exec di %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr "PERINGATAN: Biner tidak ditemukan untuk baris Exec di %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr "PERINGATAN: Ikon tidak cocok dengan id aplikasi di %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+"PERINGATAN: Ikon direferensikan dalam berkas destop tapi tidak diekspor: %s\n"
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Tipe uri %s tidak valid, hanya http/https yang didukung"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "Tidak dapat menemukan basename di %s, tentukan nama secara eksplisit"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Tidak ada garis miring yang diperbolehkan dalam nama data ekstra"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Format tidak valid untuk checksum sha256: '%s'"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Data tambahan berukuran nol tidak didukung"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "LOKASI DIREKTORI [CABANG] - Buat repositori dari direktori bangun"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "LOKASI dan DIREKTORI harus ditentukan"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Tidak ada nama yang ditentukan dalam metadata"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr "Komit: %s\n"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Total Metadata: %u\n"
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Metadata yang Ditulis: %u\n"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr "Total Isi: %u\n"
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr "Konten yang Ditulis: %u\n"
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr "Isi Byte yang Ditulis:"
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Perintah yang akan diatur"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "PERINTAH"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Versi Flatpak membutuhkan"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAYOR.MINOR.MIKRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Jangan memproses ekspor"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Info data ekstra"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Menambahkan info titik ekstensi"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NAMA=VARIABEL[=NILAI]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr "Atur prioritas ekstensi (hanya untuk ekstensi)"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr "0"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Ubah SDK yang digunakan untuk aplikasi"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Ubah runtime yang digunakan untuk aplikasi"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "RUNTIME"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Atur pilihan metadata generik"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUP=KUNCI[=NILAI]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr "Tidak mengekspor %s, salah awalan\n"
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr "Mengekspor %s\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr "Lebih dari satu yang bisa dieksekusi ditemukan\n"
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr "Menggunakan %s sebagai perintah\n"
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr "Tidak ada yang bisa dieksekusi ditemukan\n"
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Terlalu sedikit elemen dalam --extra-data argumen %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Terlalu sedikit elemen dalam argumen --metadata %s, format seharusnya "
+"GRUP=KUNCI[=NILAI]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Too few elements in --metadata argument %s, format should be "
+"NAMA=VAR[=NILAI]]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "DIREKTORI - Finalisasi direktori bangun"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Direktori bangun %s tidak diinisialisasi"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Direktori bangun %s sudah diselesaikan"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Harap tinjau berkas yang diekspor dan metadata\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Menimpa ref yang digunakan untuk bundel yang diimpor"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Impor citra oci, bukan bundel flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Ref '%s' tidak ditemukan di registri"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Beberapa gambar pada registry, tentukan ref dengan --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Mengimpor %s (%s)\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "LOKASI NAMABERKAS - Impor bundel berkas ke repositori lokal"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "LOKASI dan NAMABERKAS harus ditentukan"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Arsitektur yang digunakan"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Menginisialisasi var dari runtime yang disebut"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Menginisialisasi aplikasi dari aplikasi yang disebut"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APP"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Tentukan versi untuk --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSI"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Sertakan ekstensi dasar ini"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "EKSTENSI"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Menginisialisasi /usr dengan salinan yang ditulis dari sdk"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Tentukan tipe bangun (aplikasi, runtime, ekstensi)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TIPE"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Tambahkan tanda"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "TANDA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Sertakan ekstensi sdk ini di /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Di mana tempat menyimpan sdk (bawaannya ke 'usr')"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Menginisialisasi ulang sdk/var"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Ekstensi %s yang diminta hanya terpasang sebagian"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Ekstensi %s yang diminta tidak terpasang"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"DIREKTORI NAMAAPL SDK RUNTIME [CABANG] - Menginisialisasi direktori untuk "
+"membangun"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "RUNTIME harus ditentukan"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"'%s' bukan nama tipe bangun yang valid, gunakan app, runtime, atau ekstensi"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "'%s' bukan nama aplikasi yang valid: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Direktori bangun %s sudah diinisialisasi"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Arsitektur tujuan pemasangan"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Cari runtime dengan nama yang ditentukan"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "LOKASI [ID [CABANG]] - Menandatangani sebuah aplikasi atau runtime"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Tidak ada id kunci gpg yang ditentukan"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr "Buat daftar kunci dan nilai konfigurasi"
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr "Dapatkan konfigurasi untuk KUNCI"
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr "Atur konfigurasi untuk KUNCI ke NILAI"
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr "Batalkan konfigurasi untuk KUNCI"
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Kunci konfigurasi tidak dikenal '%s'"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr "Anda harus menentukan kunci"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr "Anda harus menentukan kunci dan nilai"
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr "[KUNCI [NILAI]] - Kelola konfigurasi"
+
+#: app/flatpak-builtins-config.c:223
+#, fuzzy
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr "Harus menentukan satu pada --list, --get, --set or --unset"
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Hapus remote meskipun digunakan"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NAMA - Menghapus repositori remote"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Buat referensi dokumen yang unik"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Buat dokumen sementara untuk sesi saat ini"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Tidak memerlukan berkas yang sudah ada"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Berikan aplikasi izin untuk membaca"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Berikan aplikasi izin untuk menulis"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Berikan aplikasi izin untuk menghapus"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Berikan izin aplikasi untuk memberikan izin lebih lanjut"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Cabut izin baca dari aplikasi"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Cabut izin tulis dari aplikasi"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Cabut izin hapus dari aplikasi"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Cabut izin untuk memberikan izin lebih lanjut"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Tambahkan izin untuk aplikasi ini"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "APPID"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "BERKAS - Ekspor berkas ke aplikasi"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "BERKAS harus ditentukan"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "BERKAS - Dapatkan informasi tentang berkas yang diekspor"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Tidak diekspor\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[APPID] - Daftar berkas yang diekspor"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "BERKAS - Tidak mengekspor berkas ke aplikasi"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [PERINTAH [argumen ...]] - Jalankan perintah di dalam sandbox "
+"yang sedang berjalan"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "SANDBOXEDPID dan PERINTAH harus ditentukan"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr "Tidak berjalan sebagai root, mungkin tidak bisa memasuki namespace"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Pid %s tidak valid"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Tidak ada pid %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Tidak bisa membaca cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Tidak bisa membaca root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Namespace %s tidak valid untuk pid %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Namespace %s tidak valid untuk diri sendiri"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Tidak dapat membuka namespace %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Tidak dapat memasuki namespace %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Tidak dapat chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Tidak dapat chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Tidak dapat berganti gid"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Tidak dapat berganti uid"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Tampilkan pemasangan pengguna"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Tampilkan pemasangan di seluruh sistem"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Tampilkan pemasangan tertentu di seluruh sistem"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Tampilkan ref"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Tampilkan komit"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Tampilkan asal"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Tampilkan ukuran"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Tampilkan metadata"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Tampilkan ekstensi"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NAMA [CABANG] - Dapatkan info tentang aplikasi dan/atau runtime yang "
+"terpasang"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "ref tidak ada di asal"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Ref:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Arsitektur:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Cabang:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Asal:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr "Tanggal:"
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr "Subjek:"
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Komit aktif:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Komit terbaru:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Komit:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alt-id:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr "Induk:"
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Lokasi:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Ukuran terpasang:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Runtime:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Subdirektori terpasang:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Ekstensi:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Subpath:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr "Komit untuk menunjukkan info untuk"
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "KOMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Cari aplikasi dengan nama yang ditentukan"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr "Tampilkan log"
+
+#: app/flatpak-builtins-info-remote.c:55
+msgid "Show parent"
+msgstr "Tampilkan induk"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+" REMOTE REF - Tampilkan informasi tentang aplikasi atau runtime pada remote"
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "REMOTE dan REF harus ditentukan"
+
+#: app/flatpak-builtins-info-remote.c:201
+msgid "Download size:"
+msgstr "Ukuran unduh:"
+
+#: app/flatpak-builtins-info-remote.c:214
+#, fuzzy
+msgid "History:\n"
+msgstr "Riwayat:"
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr " Subjek:"
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr " Tanggal:"
+
+#: app/flatpak-builtins-info-remote.c:237
+msgid " Commit:"
+msgstr " Komit:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Jangan tarik, hanya memasang dari cache lokal"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Jangan deploy, hanya mengunduh ke cache lokal"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Jangan pasang ref yang terkait"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Jangan memverifikasi/memasang dependensi runtime"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Jangan menggunakan delta statis"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Asumsikan LOKASI adalah bundel berkas tunggal .flatpak"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Asumsikan LOKASI adalah deskripsi aplikasi .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Periksa tanda tangan bundel dengan kunci GPG dari BERKAS (-untuk stdin)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Hanya pasang subpath ini"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "PATH"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Secara otomatis menjawab ya untuk semua pertanyaan"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s komit %s sudah terpasang"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Aplikasi ini tergantung pada runtime dari:\n"
+"   %s\n"
+"Konfigurasikan ini sebagai remote baru '%s'"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Mengonfigurasi %s sebagai remote baru '%s'"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Nama berkas bundel harus ditentukan"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Bundel remote tidak didukung"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"Remote '%s', pada lokasi %s berisi aplikasi tambahan.\n"
+"Haruskah remote disimpan untuk pemasangan di masa depan?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Nama berkas atau uri harus ditentukan"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Memasang: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "LOKASI/REMOTE [REF...] - Pasang aplikasi atau runtime"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Tampilkan informasi ekstra"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Daftar runtime yang terpasang"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Daftar aplikasi yang terpasang"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Arsitektur yang akan ditampilkan"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Daftar semua ref (termasuk lokal/awakutu)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Ref"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Asal"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Komit aktif"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Komit terbaru"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Ukuran terpasang"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Opsi"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Daftar aplikasi dan/atau runtimes yang terpasang"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Tampilkan detail remote"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Tampilkan remote yang dinonaktifkan"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Daftar repositori remote"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Nama"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Judul"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioritas"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Tampilkan arsitektur dan cabang"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Hanya tampilkan runtime"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Hanya tampilkan aplikasi"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Hanya tampilkan itu ketika pembaruan tersedia"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Batasi arsitektur ini (* untuk semua)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " [REMOTE] - Tampilkan runtime dan aplikasi yang tersedia"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Komit"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Ukuran unduh"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Tidak ada informasi ref yang tersedia dalam repositori"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Arsitektur seperti sekarang"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "APL CABANG - Buat cabang aplikasi saat ini"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "APL harus ditentukan"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "CABANG harus ditentukan"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Aplikasi %s cabang %s tidak terpasang"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "APL - Menimpa pengaturan untuk aplikasi"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr "Judul: %s\n"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr "ID koleksi: %s\n"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr "Cabang bawaan: %s\n"
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr "URL pengalihan: %s\n"
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "Mengalihkan ID koleksi: %s\n"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr "Hash kunci GPG: %s\n"
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr "%zd cabang\n"
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Terpasang"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Unduh"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Cetak informasi umum tentang repositori"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Daftar cabang di repositori"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Cetak metadata untuk cabang"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "LOKASI - Perbaikan repositori"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Arahkan ulang repo ini ke URL baru"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Nama yang bagus untuk digunakan pada repositori ini"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Cabang bawaan yang akan digunakan untuk repositori ini"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr "Deploy ID koleksi secara permanen ke konfigurasi klien remote"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Impor kunci publik GPG bawaan baru dari BERKAS"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "ID Kunci GPG untuk menandatangani ringkasan"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Bangkitkan berkas delta"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Pangkas objek yang tidak terpakai"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Hanya melintasi induk KEDALAMAN untuk setiap komit (bawaan: -1 = tak "
+"terbatas)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "KEDALAMAN"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr ""
+"Membangkitkan delta: %s (%.10s)\n"
+"\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Membangkitkan delta: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Gagal membangkitkan delta %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Gagal membangkitkan delta %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "LOKASI - Perbarui metadata repositori"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Memperbarui cabang appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Memperbarui ringkasan\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Total objek: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Tidak ada objek yang tidak terjangkau\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u objek dihapus, %s dibebaskan\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Perintah untuk menjalankan"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Cabang untuk digunakan"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Gunakan runtime pengembangan"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Runtime untuk digunakan"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Versi runtime untuk digunakan"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Catat log aksesibilitas bus sesi"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Aktifkan penerusan berkas"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "APL [argumen...] - Jalankan aplikasi"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr "TEXT - Cari aplikasi remote/runtime untuk teks"
+
+#: app/flatpak-builtins-search.c:220
+msgid "TEXT must be specified"
+msgstr "TEXT harus ditentukan"
+
+#: app/flatpak-builtins-search.c:270
+msgid "Application ID"
+msgstr "ID Aplikasi"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr "Versi"
+
+#: app/flatpak-builtins-search.c:273
+msgid "Branch"
+msgstr "Cabang"
+
+#: app/flatpak-builtins-search.c:275
+msgid "Remotes"
+msgstr "Remote"
+
+#: app/flatpak-builtins-search.c:276
+msgid "Description"
+msgstr "Deskripsi"
+
+#: app/flatpak-builtins-search.c:285
+msgid "No matches found"
+msgstr "Tidak ditemukan kecocokan"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Arsitektur untuk dihapus"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Simpan ref di repositori lokal"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Jangan hapus ref terkait"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Hapus berkas meski berjalan"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF... - Hapus aplikasi"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Harus menentukan setidaknya satu REF"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Peringatan: Masalah mencari ref terkait: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Mencopot: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Arsitektur untuk pembaruan"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Komit untuk deploy"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Hapus berkas lama meski berjalan"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Jangan tarik, hanya perbarui dari cache lokal"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Jangan memperbarui ref terkait"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Perbarui appstream untuk remote"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Hanya perbarui subpath ini"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Memperbarui appstream untuk remote %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Memperbarui appstream untuk remote %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr "Galat memperbarui: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF...] - Perbarui aplikasi atau runtime"
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr ""
+"Mencari pembaruan...\n"
+"\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Mana yang ingin Anda pasang (0 untuk membatalkan)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Mengelola aplikasi dan runtime yang terpasang"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Pasang aplikasi atau runtime"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Perbarui aplikasi yang terpasang atau runtime"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Hapus aplikasi yang terpasang atau runtime"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Daftar aplikasi dan/atau runtime yang terpasang"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Tampilkan info untuk aplikasi yang terpasang atau runtime"
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr "Konfigurasi flatpak"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr ""
+"\n"
+"Menemukan aplikasi dan runtime"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr "Cari aplikasi remote/runtime"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Menjalankan aplikasi"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Menjalankan aplikasi"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Timpa perizinan untuk aplikasi"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Tentukan versi bawaan untuk dijalankan"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Masukkan namespace aplikasi yang sedang berjalan"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Kelola akses berkas"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Berikan akses aplikasi ke berkas tertentu"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Cabut akses ke berkas tertentu"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Tampilkan informasi tentang berkas tertentu"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Daftar berkas yang diekspor"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Kelola repositori remote"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Daftar semua remote yang dikonfigurasi"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Tambahkan repositori remote baru (menurut URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modifikasi properti dari remote yang terkonfigurasi"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Hapus remote yang terkonfigurasi"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Daftar isi dari remote yang terkonfigurasi"
+
+#: app/flatpak-main.c:96
+msgid "Show information about a remote app or runtime"
+msgstr "Tampilkan informasi tentang aplikasi remote atau runtime"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Bangun aplikasi"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inisialisasi direktori untuk membangun"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Jalankan perintah bangun di dalam direktori bangun"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Selesaikan direktori bangun untuk ekspor"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Ekspor direktori bangun ke repositori"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Buat berkas bundel dari direktori bangun"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Impor berkas bundel"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Menandatangani sebuah aplikasi atau runtime"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Perbarui berkas ringkasan dalam repositori"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Buat komit baru berdasarkan ref yang ada"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Cetak informasi tentang repo"
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+"Cetak informasi awakutu selama pemrosesan perintah, -vv untuk detail lebih "
+"lanjut"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Cetak informasi awakutu OSTree selama pemrosesan perintah"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Tampilkan opsi bantuan"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Cetak informasi versi dan keluar"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Cetak arsitektur bawaan dan keluar"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Cetak arsitektur yang didukung dan keluar"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Cetak penggerak gl aktif dan keluar"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Bekerja pada pemasangan pengguna"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Bekerja pada pemasangan di seluruh sistem (bawaan)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Bekerja pada pemasangan seluruh sistem yang spesifik"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NAMA"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Perintah Terpasang:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Perintah tidak dikenal '%s'"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Tidak ada perintah yang ditentukan"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "galat:"
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr ""
+"Ditemukan di remote %s\n"
+"\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Ditemukan di remote %s, apakah Anda ingin memasangnya?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Ditemukan di beberapa remote:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Mana yang ingin Anda pasang (0 untuk membatalkan)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Diperlukan runtime untuk %s (%s) tidak terpasang, mencari...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Runtime %s yang dibutuhkan tidak ditemukan di remote yang dikonfigurasi.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s tidak terpasang"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Remote %s dinonaktifkan, mengabaikan pembaruan %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s sudah terpasang, melewati\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s komit %s sudah terpasang"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr "Peringatan: Tidak dapat menemukan dependensi: %s\n"
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr "Argumen require-flatpak %s tidak valid\n"
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s membutuhkan versi flatpak kelak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Galat memperbarui metadata remote untuk '%s': %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "pasang"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Memasang: %s dari %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Memasang: %s dari %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "pembaruan"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Memperbarui: %s dari %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Memperbarui: %s dari %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Sekarang di %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Tidak ada pembaruan.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "pasang bundel"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr ""
+"Memasang: %s dari bundel %s\n"
+"\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr ""
+"Memasang: %s dari bundel %s\n"
+"\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Peringatan: Gagal untuk %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Galat: Gagal untuk %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Satu atau beberapa operasi gagal"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Tidak ada penimpaan yang ditemukan untuk %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Saat membuka repositori %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Tidak dapat membuat direktori deploy"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Sha256 tidak valid untuk data ekstra uri %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Nama kosong untuk data ekstra uri %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Data ekstra yang tidak didukung uri %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Gagal memuat data-ekstra lokal %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Ukuran yang salah untuk data-ekstra %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Saat mengunduh %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Ukuran yang salah untuk data ekstra %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Checksum tidak valid untuk data ekstra %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr "Indeks remote OCI tidak memiliki registry uri"
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s komit %s sudah terpasang"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Saat menarik %s dari remote %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Tidak dapat menemukan %s di remote %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Memori tidak cukup"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Gagal membaca dari berkas yang diekspor"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Kesalahan saat membaca berkas xml mimetype"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Berkas xml mimetype tidak valid"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Saat mendapatkan metadata yang terpisah: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Saat membuat direktori ekstra: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Sha256 tidak valid untuk data ekstra"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Ukuran yang salah untuk data ekstra"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Checksum tidak valid untuk data ekstra"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Saat menulis berkas data ekstra '%s': "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Skrip apply_extra gagal, status keluar %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Saat mencoba menyelesaikan ref %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s tak tersedia"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s cabang %s sudah terpasang"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Gagal membaca komit %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Saat mencoba melakukan checkout %s ke %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Saat mencoba melakukan checkout metadata subpath: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Saat mencoba menghapus direktori tambahan yang ada: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Saat mencoba menerapkan data tambahan: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Ref %s yang dideploy tidak valid: "
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Komit ref %s tidak valid: "
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Jenis ref %s yang dideploy tidak cocok dengan komit (%s)"
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Nama ref %s yang dideploy tidak cocok dengan komit (%s)"
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "Arsitektur ref %s yang dideploy tidak cocok dengan komit (%s)"
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Cabang ref %s yang dideploy tidak cocok dengan komit (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Ref %s yang dideploy tidak cocok dengan komit (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Metadata yang dideploy tidak cocok dengan komit"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Versi %s ini sudah terpasang"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Tidak dapat mengubah remote saat memasang paket"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s cabang %s tidak terpasang"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s cabang %s tidak terpasang"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr "Repo pemangkasan gagal: %s"
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+"Beberapa cabang tersedia untuk %s, Anda harus menentukan salah satu dari: "
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Tidak ada yang cocok dengan %s"
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Tidak dapat menemukan ref %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Galat mencari remote %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Galat mencari repositori lokal: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s tidak terpasang"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Tidak dapat menemukan pemasangan %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Runtime %s, cabang %s telah terpasang"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Aplikasi %s, cabang %s sudah terpasang"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Judul remote tidak diatur"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Cabang bawaaan remote tidak diatur"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Tidak ada cache flatpak dalam ringkasan remote"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Tidak ada entri untuk %s dalam ringkasan remote cache flatpak "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Tipe berbagi %s tidak diketahui, tipe yang valid adalah: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Tipe kebijakan %s tidak diketahui, tipe yang valid adalah: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Nama dbus %s tidak valid\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Tipe soket %s tidak diketahui, tipe yang valid adalah: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Tipe perangkat %s tidak diketahui, tipe yang valid adalah: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Tipe fitur %s tidak diketahui, tipe yang valid adalah: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Lokasi sistem berkas %s tidak diketahui, lokasi yang valid adalah: host, "
+"home, xdg-*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Format env tidak valid %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Berbagi dengan host"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "BERBAGI"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Tidak berbagi dengan host"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Ekspos soket ke aplikasi"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Jangan ekspos soket ke aplikasi"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Ekspos perangkat ke aplikasi"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "PERANGKAT"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Jangan ekspos perangkat ke aplikasi"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Izinkan fitur"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FITUR"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Jangan izinkan fitur"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Ekspos sistem berkas ke aplikasi (:ro untuk hanya baca)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SISTEMBERKAS[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Jangan ekspos sistem berkas ke aplikasi"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SISTEMBERKAS"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Atur variabel lingkungan"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VAR=NILAI"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Izinkan aplikasi memiliki nama di bus sesi"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "DBUS_NAME"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Izinkan aplikasi berbicara dengan nama di bus sesi"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Izinkan aplikasi memiliki nama di bus sistem"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Izinkan aplikasi berbicara dengan nama di bus sistem"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Tambahkan opsi kebijakan umum"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSISTEM.KUNCI=NILAI"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Hapus opsi kebijakan umum"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Direktori home yang tetap"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NAMABERKAS"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Tidak memerlukan sesi berjalan (tidak ada pembuatan cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Gagal membuka berkas temporer flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Gagal membuka berkas temporer: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Tidak dapat membuat pipa sinkronisasi"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Gagal membuka berkas info aplikasi: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Gagal melakukan sinkronisasi dengan proksi dbus"
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "ldconfig gagal, status keluar %d"
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Migrasi %s ke %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr "Galat saat migrasi: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Tidak ada sumber data tambahan"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr "Mengunduh metadata: %u /(perkiraan) %s"
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr "Mengunduh: %s/%s"
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Mengunduh data ekstra: %s/%s"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Mengunduh berkas: %d/%d %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Pasang aplikasi yang ditandatangani"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Otentikasi diperlukan untuk memasang perangkat lunak"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Pasang runtime yang ditandatangani"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Perbarui aplikasi yang ditandatangani"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Otentikasi diperlukan untuk memperbarui perangkat lunak"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Perbarui runtime yang ditandatangani"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Perbarui metadata remote"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Otentikasi diperlukan untuk memperbarui info remote"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr "Perbarui repositori sistem"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr "Otentikasi diperlukan untuk memperbarui repositori sistem"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Pasang bundel"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Hapus runtime"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Otentikasi diperlukan untuk menghapus perangkat lunak"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Hapus aplikasi"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Mengkonfigurasi Remote"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Otentikasi diperlukan untuk mengkonfigurasi repositori perangkat lunak"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr "Konfigurasi"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr "Otentikasi diperlukan untuk mengkonfigurasi pemasangan perangkat lunak"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Perbarui appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Tidak ada remote %s"
+
+#~ msgid "Search only user installations"
+#~ msgstr "Cari hanya pemasangan pengguna"
+
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Cari hanya pemasangan di seluruh sistem"
+
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Cari pemasangan tertentu di seluruh sistem"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Gagal membuat berkas sementara"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Gagal menghapus tautan berkas sementara"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Gagal menulis ke berkas sementara"
+
+#~ msgid "Could not parse URI “%s”"
+#~ msgstr "Tidak dapat mengurai URI \"%s\""
+
+#~ msgid "Building %s"
+#~ msgstr "Membangun %s"
+
+#~ msgid "Installing %s"
+#~ msgstr "Memasang %s"
+
+#~ msgid "Post-Install %s"
+#~ msgstr "Setelah Pemasangan %s"
+
+#~ msgid "Cleanup %s"
+#~ msgstr "Bersihkan %s"
diff --git a/po/insert-header.sin b/po/insert-header.sin
new file mode 100644 (file)
index 0000000..b26de01
--- /dev/null
@@ -0,0 +1,23 @@
+# Sed script that inserts the file called HEADER before the header entry.
+#
+# At each occurrence of a line starting with "msgid ", we execute the following
+# commands. At the first occurrence, insert the file. At the following
+# occurrences, do nothing. The distinction between the first and the following
+# occurrences is achieved by looking at the hold space.
+/^msgid /{
+x
+# Test if the hold space is empty.
+s/m/m/
+ta
+# Yes it was empty. First occurrence. Read the file.
+r HEADER
+# Output the file's contents by reading the next line. But don't lose the
+# current line while doing this.
+g
+N
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/po/pl.gmo b/po/pl.gmo
new file mode 100644 (file)
index 0000000..13e06c9
Binary files /dev/null and b/po/pl.gmo differ
diff --git a/po/pl.po b/po/pl.po
new file mode 100644 (file)
index 0000000..1f89406
--- /dev/null
+++ b/po/pl.po
@@ -0,0 +1,2887 @@
+# Polish translation for flatpak.
+# Copyright © 2016-2017 the flatpak authors.
+# This file is distributed under the same license as the flatpak package.
+# Piotr Drąg <piotrdrag@gmail.com>, 2016-2017.
+# Aviary.pl <community-poland@mozilla.org>, 2016-2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-11-03 18:28+0100\n"
+"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
+"Language-Team: Polish <community-poland@mozilla.org>\n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Nie robi nic, jeśli podane repozytorium istnieje"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "POŁOŻENIE podaje plik konfiguracji, nie położenie repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Włącza sprawdzanie poprawności GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Oznacza repozytorium jako wyliczeniowe"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Oznacza repozytorium jako używane dla zależności"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Ustawia nowy adres URL"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Włącza repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Aktualizuje dodatkowe metadane z pliku podsumowania"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Wyłącza sprawdzanie poprawności GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Oznacza repozytorium jako niewyliczeniowe"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Oznacza repozytorium jako nieużywane dla zależności"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Ustawia priorytet (domyślnie 1, wyższy numer to wyższy priorytet)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORYTET"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Czytelna nazwa tego repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TYTUŁ"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Domyślna gałąź używana dla tego repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "GAŁĄŹ"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "Identyfikator kolekcji"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "IDENTYFIKATOR-KOLEKCJI"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importuje klucz GPG z PLIKU (- dla standardowego wejścia)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "PLIK"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Wyłącza repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Dodaje rejestr OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr "Nie można wczytać adresu URI %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Nie można wczytać pliku %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr "Nieznany format pliku"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Nieprawidłowa wersja %s, obsługiwana jest tylko wersja 1"
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr "Nieprawidłowy klucz GPG"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NAZWA POŁOŻENIE — dodaje zdalne repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "Należy podać NAZWĘ"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "Należy podać POŁOŻENIE"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Za dużo parametrów"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "„%s” nie jest prawidłowym identyfikatorem kolekcji: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "Sprawdzanie poprawności GPG jest wymagane, jeśli kolekcje są włączone"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Repozytorium %s już istnieje"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Nie podano adresu URL w pliku repozytorium Flatpak"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr ""
+"Ostrzeżenie: nie można zaktualizować dodatkowych metadanych dla „%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NAZWA — modyfikuje zdalne repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Należy podać NAZWĘ repozytorium"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+"Aktualizowanie dodatkowych metadanych z podsumowania repozytorium dla %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Błąd podczas aktualizowania dodatkowych metadanych dla „%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Nie można zaktualizować dodatkowych metadanych dla %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Eksportuje środowisko wykonawcze zamiast programu"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Architektura pakietu"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARCHITEKTURA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Adres URL do repozytorium"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Adres URL do pliku repozytorium Flatpak środowiska wykonawczego"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Dodaje klucz GPG z PLIKU (- dla standardowego wejścia)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Eksportuje obraz OCI zamiast pakietu Flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "Identyfikator klucza GPG do podpisania obrazu OCI"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "IDENTYFIKATOR-KLUCZA"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Katalog domowy GPG do wyszukiwania baz kluczy"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "KATALOG-DOMOWY"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"POŁOŻENIE NAZWA-PLIKU NAZWA [GAŁĄŹ] — tworzy pakiet w jednym pliku "
+"z lokalnego repozytorium"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "Należy podać POŁOŻENIE, NAZWĘ-PLIKU i NAZWĘ"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "„%s” nie jest prawidłowym repozytorium"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "„%s” nie jest prawidłową nazwą: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "„%s” nie jest prawidłową nazwą gałęzi: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr ""
+"Używa środowiska wykonawczego typu Platforma zamiast środowiska "
+"programistycznego"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Dodaje montowanie dowiązania"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "CEL=ŹRÓDŁO"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Rozpoczyna budowanie w tym katalogu"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "KATALOG"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr ""
+"Gdzie szukać niestandardowego katalogu środowiska programistycznego "
+"(domyślnie „usr”)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Używa alternatywnego pliku dla metadanych"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Usuwa procesy po usunięciu procesu nadrzędnego"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Eksportuje katalog domowy programu do budowania"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Zapisywanie wywołań magistrali sesji w dzienniku"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Zapisywanie wywołań magistrali systemu w dzienniku"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "KATALOG [POLECENIE [parametry…]] — buduje w katalogu"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "Należy podać KATALOG"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"Nie zainicjowano katalogu budowania %s, należy użyć „flatpak build-init”"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr ""
+"nieprawidłowe metadane, nie jest programem lub środowiskiem wykonawczym"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Brak punktu rozszerzeń pasującego do %s w %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Brak „=” w opcji montowania dowiązania „%s”"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Nie można uruchomić programu"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Źródłowy katalog repozytorium"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "REPOZYTORIUM-ŹRÓDŁOWE"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Źródłowe odniesienie repozytorium"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "ODNIESIENIE-ŹRÓDŁOWE"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Jednowierszowy temat"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "TEMAT"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Pełny opis"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TREŚĆ"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Aktualizuje gałąź AppStream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Bez aktualizowania podsumowania"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "Identyfikator klucza GPG do podpisania zatwierdzenia"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"REPOZYTORIUM-DOCELOWE [ODNIESIENIE-DOCELOWE]… — tworzy nowe zatwierdzenie na "
+"podstawie istniejących zatwierdzeń"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "Należy podać REPOZYTORIUM-DOCELOWE"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Jeśli nie podano --src-repo, to należy podać dokładnie jedno odniesienie "
+"docelowe"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Jeśli podano --src-ref, to należy podać dokładnie jedno odniesienie docelowe"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Należy podać --src-repo lub --src-ref."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Nie można zatwierdzić z częściowego zatwierdzenia źródłowego."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr "%s: brak zmian\n"
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Architektura eksportu (musi być zgodna z komputerem)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Zatwierdza środowisko wykonawcze (/usr), nie /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Używa alternatywnego katalogu dla plików"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "PODKATALOG"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Wykluczone pliki"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "WZÓR"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Wykluczone pliki do dołączenia"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Zastępuje czas zatwierdzenia"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "CZAS-ISO-8601"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+"OSTRZEŻENIE: błąd podczas wykonywania polecenia desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+"OSTRZEŻENIE: błąd podczas odczytywania z polecenia desktop-file-validate: "
+"%s\n"
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr ""
+"OSTRZEŻENIE: sprawdzenie poprawności pliku desktop %s się nie powiodło: %s\n"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr "OSTRZEŻENIE: nie można odnaleźć klucza Exec w %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+"OSTRZEŻENIE: nie odnaleziono pliku binarnego dla wiersza Exec w %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr "OSTRZEŻENIE: ikona nie pasuje do identyfikatora programu w %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+"OSTRZEŻENIE: ikona jest wymieniona w pliku desktop, ale nie jest "
+"eksportowana: %s\n"
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr ""
+"Nieprawidłowy typ adresu URI %s, obsługiwane są tylko adresy HTTP/HTTPS"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "Nie można odnaleźć podstawowej nazwy w %s, należy podać nazwę"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Ukośniki są niedozwolone w nazwach dodatkowych danych"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Nieprawidłowy format sumy kontrolnej SHA256: „%s”"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Dodatkowe dane o zerowym rozmiarze są nieobsługiwane"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "POŁOŻENIE KATALOG [GAŁĄŹ] — tworzy repozytorium z katalogu budowania"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "Należy podać POŁOŻENIE i KATALOG"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Nie podano nazwy w metadanych"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr "Zatwierdzenie: %s\n"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Razem metadanych: %u\n"
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Zapisane metadane: %u\n"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr "Razem treść: %u\n"
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr "Zapisana treść: %u\n"
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr "Zapisane bajty treści:"
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Ustawiane polecenie"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "POLECENIE"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Wymagana wersja Flatpak"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "WIĘKSZA.MNIEJSZA.MIKRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Bez przetwarzania eksportów"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Informacje o dodatkowych danych"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Dodaje informacje o punkcie rozszerzeń"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NAZWA=ZMIENNA[=WARTOŚĆ]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr "Ustawia priorytet rozszerzenia (tylko dla rozszerzeń)"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr "0"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Zmienia środowisko programistyczne używane dla programu"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "ŚRODOWISKO-PROGRAMISTYCZNE"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Zatwierdza środowisko wykonawcze używane dla programu"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "ŚRODOWISKO-WYKONAWCZE"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Ustawia opcję ogólnych metadanych"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPA=KLUCZ[=WARTOŚĆ]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr "%s nie zostanie wyeksportowane, błędny przedrostek\n"
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr "Eksportowanie %s\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr "Odnaleziono więcej niż jeden plik wykonywalny\n"
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr "Używanie %s jako polecenia\n"
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr "Nie odnaleziono żadnych plików wykonywalnych\n"
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Za mało elementów w parametrze %s opcji --extra-data"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Za mało elementów w parametrze %s opcji --metadata, musi być w formacie "
+"GRUPA=KLUCZ[=WARTOŚĆ]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Za mało elementów w parametrze %s opcji --extension, musi być w formacie "
+"NAZWA=ZMIENNA[=WARTOŚĆ]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "KATALOG — finalizuje katalog budowania"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Nie zainicjowano katalogu budowania %s"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Już sfinalizowano katalog budowania %s"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Proszę przejrzeć wyeksportowane pliki i metadane\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Zastępuje odniesienie dla zaimportowanego pakietu"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "ODNIESIENIE"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importuje obraz OCI zamiast pakietu Flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Nie odnaleziono odniesienia „%s” w rejestrze"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+"Wiele obrazów w rejestrze, należy podać odniesienie za pomocą opcji --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Importowanie %s (%s)\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+"POŁOŻENIE NAZWA-PLIKU — importuje pakiet plików do lokalnego repozytorium"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "Należy podać POŁOŻENIE i NAZWĘ-PLIKU"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Używana architektura"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Inicjuje zmienną z nazwanego środowiska wykonawczego"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Inicjuje programy z nazwanego programu"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "PROGRAM"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Podaje wersję dla opcji --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "WERSJA"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Dołącza to podstawowe rozszerzenie"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "ROZSZERZENIE"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Inicjuje /usr z zapisywalną kopią środowiska programistycznego"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr ""
+"Podaje typ budowania, jedno z „app” (program), „runtime” (środowisko "
+"wykonawcze) lub „extension” (rozszerzenie)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TYP"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Dodaje etykietę"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ETYKIETA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Dołącza to rozszerzenie środowiska programistycznego w /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Gdzie przechowywać środowisko programistyczne (domyślnie „usr”)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Ponownie inicjuje środowisko programistyczne/zmienną"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Żądane rozszerzenie %s jest tylko częściowo zainstalowane"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Nie zainstalowano żądanego rozszerzenia %s"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"KATALOG NAZWA-PROGRAMU ŚRODOWISKO-PROGRAMISTYCZNE [GAŁĄŹ] — inicjuje katalog "
+"do budowania"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "Należy podać ŚRODOWISKO-WYKONAWCZE"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"„%s” nie jest prawidłową nazwą typu budowania, należy użyć „app” (program), "
+"„runtime” (środowisko wykonawcze) lub „extension” (rozszerzenie)"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "„%s” nie jest prawidłową nazwą programu: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Już zainicjowano katalog budowania %s"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Instalowana architektura"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Wyszukuje środowisko wykonawcze o podanej nazwie"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr ""
+"POŁOŻENIE [IDENTYFIKATOR [GAŁĄŹ]] — podpisuje program lub środowisko "
+"wykonawcze"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Nie podano identyfikatorów kluczy GPG"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr "Wyświetla listę kluczy i wartości konfiguracji"
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr "Pobiera konfigurację KLUCZA"
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr "Ustawia konfigurację KLUCZA na WARTOŚĆ"
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr "Usuwa ustawienie konfiguracji KLUCZA"
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Nieznany klucz konfiguracji „%s”"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr "Należy podać klucz"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr "Należy podać klucz i wartość"
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr "[KLUCZ [WARTOŚĆ]] — zarządza konfiguracją"
+
+#: app/flatpak-builtins-config.c:223
+#, fuzzy
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr "Parametry --list, --get, --set i --unset wymagają jednego"
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Usuwa repozytorium nawet, jeśli jest używane"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NAZWA — usuwa zdalne repozytorium"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Tworzy unikalne odniesienie dokumentu"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Dokument jest przejściowy dla bieżącej sesji"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Plik nie musi już istnieć"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Nadaje programowi uprawnienia do odczytu"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Nadaje programowi uprawnienia do zapisu"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Nadaje programowi uprawnienia do usuwania"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Nadaje programowi uprawnienia do nadawania dalszych uprawnień"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Odbiera programowi uprawnienia do odczytu"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Odbiera programowi uprawnienia do zapisu"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Odbiera programowi uprawnienia do usuwania"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Odbiera programowi uprawnienia do nadawania dalszych uprawnień"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Dodaje uprawnienia programowi"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "IDENTYFIKATOR-PROGRAMU"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "PLIK — eksportuje plik do programów"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "Należy podać PLIK"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "PLIK — pobiera informacje o wyeksportowanym pliku"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Nie wyeksportowano\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[IDENTYFIKATOR-PROGRAMU] — wyświetla listę wyeksportowanych plików"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "PLIK — usuwa eksport pliku do programów"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"PID-W-PIASKOWNICY [POLECENIE [parametry…]] — wykonuje polecenie "
+"w działającej piaskownicy"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "Należy podać PID-W-PIASKOWNICY i POLECENIE"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+"Nie jest uruchomione jako root, przejście do przestrzeni nazw może być "
+"niemożliwe"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Nieprawidłowy PID %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Brak PID %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Nie można odczytać polecenia cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Nie można odczytać roota"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Nieprawidłowa przestrzeń nazw %s dla PID %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Nieprawidłowa przestrzeń nazw %s dla siebie"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Nie można otworzyć przestrzeni nazw %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Nie można przejść do przestrzeni nazw %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Nie można wykonać polecenia chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Nie można wykonać polecenia chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Nie można przełączyć GID"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Nie można przełączyć UID"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Wyświetla instalacje użytkownika"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Wyświetla instalacje systemowe"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Wyświetla podane instalacje systemowe"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Wyświetla odniesienie"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Wyświetla zatwierdzenie"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Wyświetla pochodzenie"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Wyświetla rozmiar"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Wyświetla metadane"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Wyświetla rozszerzenia"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NAZWA [GAŁĄŹ] — pobiera informacje o zainstalowanym programie lub środowisku "
+"wykonawczym"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "odniesienia nie ma w pochodzeniu"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Odniesienie:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "Identyfikator:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Architektura:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Gałąź:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Pochodzenie:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Aktywne zatwierdzenie:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Najnowsze zatwierdzenie:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Zatwierdzenie:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "Alternatywny identyfikator:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Położenie:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Rozmiar po instalacji:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Środowisko wykonawcze:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Zainstalowane podkatalogi:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Rozszerzenie:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Podścieżki:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "ZATWIERDZENIE"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Wyszukuje program o podanej nazwie"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Wyświetla odniesienie"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "Należy podać REPOZYTORIUM i ODNIESIENIE"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Rozmiar do pobrania"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Zatwierdzenie:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Bez pobierania, tylko instaluje z lokalnej pamięci podręcznej"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Bez wdrażania, tylko pobiera do lokalnej pamięci podręcznej"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Bez instalowania powiązanych odniesień"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Bez sprawdzania poprawności/instalowania zależności wykonawczych"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Bez używania statycznych delt"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Przyjmuje, że POŁOŻENIE to jednoplikowy pakiet .flatpak"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Przyjmuje, że POŁOŻENIE to opis programu .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Sprawdza podpisy pakietów za pomocą klucza GPG z PLIKU (- dla standardowego "
+"wejścia)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Instaluje tylko tę podścieżkę"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "ŚCIEŻKA"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Automatycznie odpowiada tak na wszystkie pytania"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "Już zainstalowano %s zatwierdzenie %s"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Ten program zależy od środowisk wykonawczych z:\n"
+"  %s\n"
+"Należy skonfigurować jako nowe repozytorium „%s”"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Konfigurowanie %s jako nowe repozytorium „%s”"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Należy podać nazwę pliku pakietu"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Zdalne pakiety nie są obsługiwane"
+
+#: app/flatpak-builtins-install.c:338
+#, fuzzy, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"Repozytorium „%s” w położeniu %s zawiera dodatkowe programy.\n"
+"Zainstalować pozostałe programy z tego repozytorium?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Należy podać nazwę pliku lub adres URI"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Instalowanie: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr ""
+"POŁOŻENIE/REPOZYTORIUM [ODNIESIENIE…] — instaluje programy lub środowiska "
+"wykonawcze"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Wyświetla dodatkowe informacje"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Wyświetla listę zainstalowanych środowisk wykonawczych"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Wyświetla listę zainstalowanych programów"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Wyświetlana architektura"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Wyświetla listę wszystkich odniesień (także lokalizacji/debugowania)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Odniesienie"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Pochodzenie"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Aktywne zatwierdzenie"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Najnowsze zatwierdzenie"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Rozmiar po instalacji"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Opcje"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr ""
+" — wyświetla listę zainstalowanych programów lub środowisk wykonawczych"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Wyświetla informacje o repozytorium"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Wyświetla wyłączone repozytoria"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " — wyświetla listę zdalnych repozytoriów"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Nazwa"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Tytuł"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Priorytet"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Wyświetla architektury i gałęzie"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Wyświetla tylko środowiska wykonawcze"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Wyświetla tylko programy"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Wyświetla tylko z dostępnymi aktualizacjami"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Ogranicza do tej architektury (* dla wszystkich)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr ""
+" REPOZYTORIUM — wyświetla listę dostępnych środowisk wykonawczych i programów"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Zatwierdzenie"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Rozmiar do pobrania"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Brak dostępnych informacji o odniesieniu w repozytorium"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Architektura ustawiania na bieżącą"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "PROGRAM GAŁĄŹ — ustawia gałąź programu jako bieżącą"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Należy podać PROGRAM"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Należy podać GAŁĄŹ"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Nie zainstalowano programu %s gałęzi %s"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "PROGRAM — zastępuje ustawienia programu"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr "Tytuł: %s\n"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr "Identyfikator kolekcji: %s\n"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr "Domyślna gałąź: %s\n"
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr "Adres URL przekierowania: %s\n"
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "Identyfikator przekierowania kolekcji: %s\n"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr "Suma klucza GPG: %s\n"
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr "Gałęzie: %zd\n"
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Zainstalowano"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Pobieranie"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Wyświetla ogólne informacje o repozytorium"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Wyświetla listę gałęzi w repozytorium"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Wyświetla metadane gałęzi"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "POŁOŻENIE — zarządzanie repozytorium"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Przekierowuje to repozytorium do nowego adresu URL"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Czytelna nazwa używana dla tego repozytorium"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Domyślna gałąź używana dla tego repozytorium"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+"Trwale wdraża identyfikator kolekcji do konfiguracji repozytoriów klienta"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importuje nowy domyślny klucz publiczny GPG z PLIKU"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "Identyfikator klucza GPG do podpisania podsumowania"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Tworzy pliki delty"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Usuwa nieużywane obiekty"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Przechodzi tylko przez podaną GŁĘBIĘ elementów nadrzędnych każdego "
+"zatwierdzenia (domyślnie: -1=nieskończoność)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "GŁĘBIA"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Tworzenie delty: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Tworzenie delty: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Utworzenie delty %s się nie powiodło (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Utworzenie delty %s się nie powiodło (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "POŁOŻENIE — aktualizuje metadane repozytorium"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Aktualizowanie danych AppStream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Aktualizowanie podsumowania\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Razem obiektów: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Brak nieosiągalnych obiektów\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Usunięto %u obiektów, uwolniono %s\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Wykonywane polecenie"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Używana gałąź"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Używa programistycznego środowiska wykonawczego"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Używane środowisko wykonawcze"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Używana wersja środowiska wykonawczego"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Zapisywanie wywołań magistrali ułatwień dostępu w dzienniku"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Włącza przekazywanie plików"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "PROGRAM [parametry…] — uruchamia program"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr "TEKST — wyszukuje zdalne programy/środowiska wykonawcze według tekstu"
+
+#: app/flatpak-builtins-search.c:220
+msgid "TEXT must be specified"
+msgstr "Należy podać TEKST"
+
+#: app/flatpak-builtins-search.c:270
+msgid "Application ID"
+msgstr "Identyfikator programu"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr "Wersja"
+
+#: app/flatpak-builtins-search.c:273
+msgid "Branch"
+msgstr "Gałąź"
+
+#: app/flatpak-builtins-search.c:275
+msgid "Remotes"
+msgstr "Repozytoria"
+
+#: app/flatpak-builtins-search.c:276
+msgid "Description"
+msgstr "Opis"
+
+#: app/flatpak-builtins-search.c:285
+msgid "No matches found"
+msgstr "Brak wyników"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Odinstalowywana architektura"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Zachowywanie odniesienia w lokalnym repozytorium"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Bez odinstalowywania powiązanych odniesień"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Usuwa nawet uruchomione pliki"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "ODNIESIENIE… — odinstalowuje program"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Należy podać co najmniej jedno ODNIESIENIE"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Ostrzeżenie: problem podczas wyszukiwania powiązanych odniesień: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Instalowanie: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Aktualizowana architektura"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Wdrażane zatwierdzenie"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Usuwa stare pliki nawet, jeśli są uruchomione"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Bez pobierania, tylko aktualizuje z lokalnej pamięci podręcznej"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Bez aktualizowania powiązanych odniesień"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Aktualizuje AppStream dla repozytorium"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Aktualizuje tylko tę podścieżkę"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Aktualizuje AppStream dla repozytorium %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Aktualizuje AppStream dla repozytorium %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr "Błąd podczas aktualizowania: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[ODNIESIENIE…] — aktualizuje programy lub środowiska wykonawcze"
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr "Wyszukiwanie aktualizacji…\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Które zainstalować (0 przerwie)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Zarządza zainstalowanymi programami i środowiskami wykonawczymi"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Instaluje program lub środowisko wykonawcze"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Aktualizuje zainstalowany program lub środowisko wykonawcze"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Odinstalowuje zainstalowany program lub środowisko wykonawcze"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Wyświetla listę zainstalowanych programów lub środowisk wykonawczych"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+"Wyświetla informacje o zainstalowanym programie lub środowisku wykonawczym"
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr "Konfiguruje Flatpak"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr ""
+"\n"
+" Wyszukiwanie programów i środowisk wykonawczych"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr "Wyszukuje zdalne programy/środowiska wykonawcze"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Uruchamianie programów"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Uruchamia program"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Zastępuje uprawnienia programu"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Podaje domyślnie uruchamianą wersję"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Przestrzeń nazw działającego programu"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Zarządza dostępem do plików"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Nadaje programowi dostęp do podanego pliku"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Odbiera dostęp do podanego pliku"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Wyświetla informacje o podanym pliku"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Wyświetla listę wyeksportowanych plików"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Zarządza zdalnymi repozytoriami"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Wyświetla listę wszystkich skonfigurowanych repozytoriów"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Dodaje nowe zdalne repozytorium (według adresu URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modyfikuje właściwości skonfigurowanego repozytorium"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Usuwa skonfigurowane repozytorium"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Wyświetla listę zawartości skonfigurowanego repozytorium"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr ""
+"Wyświetla informacje o zainstalowanym programie lub środowisku wykonawczym"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Buduje programy"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inicjuje katalog do budowania"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Wykonuje polecenie budowania w katalogu budowania"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Kończy katalog budowania do eksportu"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Eksportuje katalog budowania do repozytorium"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Tworzy pakiet z katalogu budowania"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importuje pakiet"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Podpisuje program lub środowisko wykonawcze"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Aktualizuje plik podsumowania w repozytorium"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Tworzy nowe zatwierdzenie na podstawie istniejącego odniesienia"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Wyświetla informacje o repozytorium"
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+"Wyświetla informacje debugowania podczas przetwarzania poleceń, -vv "
+"wyświetla więcej"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Wyświetla informacje debugowania OSTree podczas przetwarzania poleceń"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Wyświetla opcje pomocy"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Wyświetla informacje o wersji i kończy działanie"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Wyświetla domyślną architekturę i kończy działanie"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Wyświetla obsługiwane architektury i kończy działanie"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Wyświetla aktywne sterowniki GL i kończy działanie"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Działa na instalacjach użytkownika"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Działa na instalacjach systemowych (domyślnie)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Działa na podanej instalacji systemowej"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NAZWA"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Wbudowane polecenia:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Nieznane polecenie „%s”"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Nie podano polecenia"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "błąd:"
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr "Odnaleziono w repozytorium %s\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Odnaleziono w repozytorium %s, zainstalować?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Odnaleziono w kilku repozytoriach:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Które zainstalować (0 przerwie)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr ""
+"Wymagane środowisko wykonawcze dla %s (%s) nie jest zainstalowane, "
+"wyszukiwanie…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Nie odnaleziono wymaganego środowiska wykonawczego %s w skonfigurowanym "
+"repozytorium.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "Nie zainstalowano %s"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Repozytorium %s jest wyłączone, ignorowanie aktualizacji %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "Już zainstalowano %s, pomijanie\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "Już zainstalowano %s zatwierdzenie %s"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr "Ostrzeżenie: nie można odnaleźć zależności: %s\n"
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr "Nieprawidłowy parametr „require-flatpak” %s\n"
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s wymaga późniejszej wersji Flatpak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Błąd podczas aktualizowania zdalnych metadanych dla „%s”: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "instalacja"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Instalowanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Instalowanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "aktualizacja"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Aktualizowanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Aktualizowanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Teraz: %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Brak aktualizacji.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "instalacja pakietu"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Instalowanie: %s z pakietu %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Instalowanie: %s z pakietu %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Ostrzeżenie: %s %s się nie powiodła: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Błąd: %s %s się nie powiodła: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Jedno lub więcej działań się nie powiodło"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Nie odnaleziono zastępników dla %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Podczas otwierania repozytorium %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Nie można utworzyć katalogu wdrażania"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Nieprawidłowa suma SHA256 dla adresu URI %s dodatkowych danych"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Pusta nazwa dla adresu URI %s dodatkowych danych"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Nieobsługiwany adres URI %s dodatkowych danych"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Wczytanie lokalnych dodatkowych danych %s się nie powiodło: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Błędny rozmiar dodatkowych danych %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Podczas pobierania %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Błędny rozmiar dodatkowych danych %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Nieprawidłowa suma kontrolna dodatkowych danych %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "Już zainstalowano %s zatwierdzenie %s"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Podczas pobierania %s z repozytorium %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Nie można odnaleźć %s w repozytorium %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Za mało pamięci"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Odczytanie z wyeksportowanego pliku się nie powiodło"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Błąd podczas odczytywania pliku XML typu MIME"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Nieprawidłowy plik XML typu MIME"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Podczas pobierania odłączonych metadanych: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Podczas tworzenia dodatkowego katalogu: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Nieprawidłowa suma SHA256 dodatkowych danych"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Błędny rozmiar dodatkowych danych"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Nieprawidłowa suma kontrolna dodatkowych danych"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Podczas zapisywania pliku dodatkowych danych „%s”: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Skrypt „apply_extra” się nie powiódł, stan wyjścia %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Podczas rozwiązywania odniesienia %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s jest niedostępne"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "Już zainstalowano %s gałąź %s"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Odczytanie zatwierdzenia %s się nie powiodło: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Podczas wymeldowywania %s do %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Podczas wymeldowywania podścieżki metadanych: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Podczas usuwania istniejącego dodatkowego katalogu: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Podczas zastosowywania dodatkowych danych: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Nieprawidłowe wdrożone odniesienie %s: "
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Nieprawidłowe odniesienie zatwierdzenia %s: "
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Rodzaj wdrożonego odniesienia %s nie pasuje do zatwierdzenia (%s)"
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Nazwa wdrożonego odniesienia %s nie pasuje do zatwierdzenia (%s)"
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+"Architektura wdrożonego odniesienia %s nie pasuje do zatwierdzenia (%s)"
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Gałąź wdrożonego odniesienia %s nie pasuje do zatwierdzenia (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Wdrożone odniesienie %s nie pasuje do zatwierdzenia (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Wdrożone metadane nie pasują do zatwierdzenia"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Ta wersja programu %s jest już zainstalowana"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Nie można zmienić repozytorium podczas instalacji pakietu"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "Nie zainstalowano %s gałęzi %s"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "Nie zainstalowano %s gałęzi %s"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr "Usuwanie nieużywanych obiektów z repozytorium się nie powiodło: %s"
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr "Dla %s dostępnych jest wiele gałęzi, należy podać jedną z: "
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Nic nie pasuje do %s"
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Nie można odnaleźć odniesienia %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Błąd podczas wyszukiwania repozytorium %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Błąd podczas wyszukiwania lokalnego repozytorium: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "Nie zainstalowano %s %s"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Nie można odnaleźć instalacji %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Już zainstalowano środowisko wykonawcze %s, gałąź %s"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Już zainstalowano program %s, gałąź %s"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Nie ustawiono tytułu repozytorium"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Nie ustawiono domyślnej gałęzi repozytorium"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Brak pamięci podręcznej Flatpak w podsumowaniu repozytorium"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr ""
+"Brak wpisu dla %s w pamięci podręcznej Flatpak podsumowania repozytorium "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Nieznany typ udziału %s, prawidłowe typy: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Nieznany typ polityki %s, prawidłowe typy: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Nieprawidłowa nazwa D-Bus %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Nieznany typ gniazda %s, prawidłowe typy: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Nieznany typ urządzenia %s, prawidłowe typy: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Nieznany typ funkcji %s, prawidłowe typy: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Nieznane położenie systemu plików %s, prawidłowe położenia: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Nieznany format środowiska %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Udostępnia temu komputerowi"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "UDZIAŁ"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Przestaje udostępniać temu komputerowi"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Udostępnia gniazdo programowi"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "GNIAZDO"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Nie udostępnia gniazda programowi"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Udostępnia urządzenie programowi"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "URZĄDZENIE"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Nie udostępnia urządzenia programowi"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Zezwala na funkcję"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNKCJA"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Bez zezwolenia na funkcję"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Udostępnia system plików programowi (:ro dla tylko do odczytu)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SYSTEM-PLIKÓW[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Nie udostępnia systemu plików programowi"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SYSTEM-PLIKÓW"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Ustawia zmienną środowiskową"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "ZMIENNA=WARTOŚĆ"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Zezwala programowi na posiadanie nazwy na magistrali sesji"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NAZWA_D-BUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Umożliwia programowi rozmawianie z nazwą na magistrali sesji"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Zezwala programowi na posiadanie nazwy na magistrali systemu"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Umożliwia programowi rozmawianie z nazwą na magistrali systemu"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Dodaje ogólną opcję polityki"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "PODSYSTEM.KLUCZ=WARTOŚĆ"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Usuwa ogólną opcję polityki"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Trwały katalog domowy"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NAZWA-PLIKU"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Bez wymagania działającej sesji (bez tworzenia cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Otwarcie pliku tymczasowego „flatpak-info” się nie powiodło: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Otwarcie pliku tymczasowego się nie powiodło: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Utworzenie potoku synchronizacji się nie powiodło"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Otwarcie pliku informacji o programie się nie powiodło: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Synchronizacja z pośrednikiem D-Bus się nie powiodła"
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "ldconfig się nie powiodło, stan wyjścia %d"
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Migrowanie %s do %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr "Błąd podczas migracji: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Brak źródeł dodatkowych danych"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr "Pobieranie metadanych: %u/(szacowanie) %s"
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr "Pobieranie: %s/%s"
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Pobieranie dodatkowych danych: %s/%s"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Pobieranie plików: %d/%d %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Instalacja podpisanego programu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Wymagane jest uwierzytelnienie, aby zainstalować oprogramowanie"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Instalacja podpisanego środowiska wykonawczego"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Aktualizacja podpisanego programu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Wymagane jest uwierzytelnienie, aby zaktualizować oprogramowanie"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Aktualizacja podpisanego środowiska wykonawczego"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Aktualizacja metadanych repozytorium"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr ""
+"Wymagane jest uwierzytelnienie, aby zaktualizować informacje o repozytorium"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr "Aktualizacja repozytorium systemu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr "Wymagane jest uwierzytelnienie, aby zaktualizować repozytorium systemu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Instalacja pakietu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Odinstalowanie środowiska wykonawczego"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Wymagane jest uwierzytelnienie, aby odinstalować oprogramowanie"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Odinstalowanie programu"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Konfiguracja repozytorium"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+"Wymagane jest uwierzytelnienie, aby skonfigurować repozytoria oprogramowania"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr "Konfiguracja"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr ""
+"Wymagane jest uwierzytelnienie, aby skonfigurować instalację oprogramowania"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Aktualizacja danych AppStream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Brak repozytorium %s"
+
+#~ msgid "Search only user installations"
+#~ msgstr "Wyszukuje tylko instalacje użytkownika"
+
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Wyszukuje tylko instalacje systemowe"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Wyświetla podane instalacje systemowe"
diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo
new file mode 100644 (file)
index 0000000..c93adaa
Binary files /dev/null and b/po/pt_BR.gmo differ
diff --git a/po/pt_BR.po b/po/pt_BR.po
new file mode 100644 (file)
index 0000000..41230de
--- /dev/null
@@ -0,0 +1,2880 @@
+# Brazilian Portuguese translation for flatpak.
+# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Fábio Nogueira <fnogueira@gnome.org>, 2017.
+# Rafael Fontenelle <rafaelff@gnome.org>, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-09-08 21:48-0200\n"
+"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
+"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Virtaal 1.0.0-beta1\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Faz nada se o remoto fornecido existir"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr ""
+"LOCALIZAÇÃO especifica um arquivo de configuração, não a localização do repo"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Habilita verificação GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Marca o remoto como enumerado"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Marca o repositório como usado para dependências"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Define uma nova url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Habilita o remoto"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Atualiza metadados extras de um arquivo de resumo"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Desabilita verificação GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Marca o remoto como não enumerado"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Marca o remoto como não usar para dependências"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Define prioridade (padrão 1, maior é mais prioritário)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORIDADE"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Um nome legal para usar para este remoto"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TÍTULO"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Ramo padrão para usar para este remoto"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "RAMO"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "ID de coleção"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "ID-COLEÇÃO"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importa uma chave GPG do ARQUIVO (- para stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "ARQUIVO"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Desabilita o remoto"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Adiciona registro OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Não foi possível abrir o espaço de nome %s: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Formato de env inválido %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Tipo de uri inválida %s, há suporte apenas a http/https"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Pid inválido %s"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NOME LOCALIZAÇÃO – Adiciona um repositório remoto"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NOME deve ser especificado"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "LOCALIZAÇÃO deve ser especificada"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Número excessivo de argumentos"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "“%s” não é um ID de coleção válido: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "Verificação GPG é exigida se coleções estiverem habilitadas"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "O remoto %s já existe"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Nenhuma url especificada no arquivo flatpakrepo"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Aviso: Não foi possível atualizar metadados extras para “%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NOME – Modifica um repositório remoto"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "NOME remoto deve ser especificado"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Atualizando metadados extras para resumo de remoto para %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Erro ao atualizar metadados extras para “%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Não foi possível atualizar metadados extras para %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exporta runtime em vez do aplicativo"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Arquitetura para a qual será empacotada"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARQUITETURA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url para o repo"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url para o arquivo de flatpakrepo de runtime"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Adiciona uma chave GPG do ARQUIVO (- para stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Exporta a imagem oci em vez do pacote flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID da chave GPG para assinar a imagem OCI"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ID-CHAVE"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Diretório do GPG para usar quando estiver procurando por chaveiros"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "DIRETÓRIO"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"LOCALIZAÇÃO ARQUIVO NOME [RAMO] – Cria um único arquivo de pacote de um "
+"repositório local"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "LOCALIZAÇÃO, ARQUIVO e NOME devem ser especificados"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "“%s” não é um repositório válido"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "“%s” não é um nome válido: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "“%s” não é um nome de ramo válido: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Usa runtime Platform em vez de Sdk"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Adiciona montagem associativa (bind)"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "DEST=ORIG"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Começa compilação neste diretório"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "DIR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Onde procurar por diretório de sdk personalizado (padrão é “usr”)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Usa um arquivo alternativo para os metadados"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Mata processos quando o processo pai morre"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Registra o log das chamadas de barramento de sessão"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Registra o log das chamadas de barramento de sistema"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "DIRETÓRIO [COMANDO [args…]] – Compila no diretório"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "DIRETÓRIO deve ser especificado"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "Diretório de compilação %s não inicializado, use flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "metadados inválido, não é aplicativo ou runtime"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Nenhum ponto de extensão correspondendo %s em %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Faltando “=” na opção de montagem associativa “%s”"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Não foi possível iniciar o aplicativo"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Diretório fonte do repositório"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "SRC-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Referência fonte do repositório"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "SRC-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Assunto em uma linha"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "ASSUNTO"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Descrição completa"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "CORPO"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Atualiza o ramo de appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Não atualiza o sumário"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID da chave GPG para assinar o commit"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"DST-REPO [DST-REF]… – Faz um novo commit baseado em commit(s) existente(s)"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "DST-REPO deve ser especificado"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Se --src-repo não for especificado, exatamente uma referência destino deve "
+"ser especificado"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Se --src-ref for especificado, exatamente uma referência destino deve ser "
+"especificado"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "--src-repo ou --src-ref deve ser especificado."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Não foi possível fazer commit de commit fonte parcial."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Arquitetura alvo da exportação (deve ser compatível com o hospedeiro)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Faz commit de runtime (/usr), não /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Usa o dicionário alternativo para os arquivo"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "SUBDIR"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Arquivos para excluir"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "PADRÃO"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Arquivos excluídos para incluir"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Sobrepõe o carimbo de tempo do commit"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "CARIMBO-TEMPO-ISO-8601"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Falha ao abrir arquivo temporário: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Tipo de uri inválida %s, há suporte apenas a http/https"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+"Não foi possível localizar o nome base em %s, especifique explicitamente um "
+"nome base"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Nenhuma barra permitida no nome de dados extras"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Formato inválido para a soma de verificação sha256: “%s”"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Tamanhos zerado de dados extras sem suporte"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+"LOCALIZAÇÃO DIRETÓRIO [RAMO] – Cria um repositório de um diretório de "
+"compilação"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "LOCALIZAÇÃO e DIRETÓRIO devem ser especificados"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Nenhum nome especificado nos metadados"
+
+#: app/flatpak-builtins-build-export.c:976
+#, fuzzy, c-format
+msgid "Commit: %s\n"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Mostra metadados"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Mostra metadados"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Comando para definir"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "COMANDO"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Versão do Flatpak para exigir"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAIOR.MENOR.MICRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Não processa exportações"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Info de dados extras"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Adiciona info do ponto de extensão"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NOME=VARIÁVEL[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Altera o sdk usado para o aplicativo"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Altera o runtime usado para o aplicativo"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "RUNTIME"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Define a opção de metadados genérica"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPO=CHAVE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Atualizando resumo\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Elementos insuficientes no argumento de --extra-data %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Elementos insuficientes no argumento de --metadata %s, formato deve ser "
+"GRUPO=CHAVE[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Elementos insuficientes no argumento de --extension %s, formato deve ser "
+"NOME=VAR[=VALOR]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "DIRETÓRIO – Finaliza um diretório de compilação"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Diretório de compilação %s não inicializado"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Diretório de compilação %s já finalizado"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Por favor, reveja os arquivos exportados e os metadados\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Sobrepõe o ref usado para o pacote importado"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importa a imagem oci em vez do pacote flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Referência “%s” não localizado no registro"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Múltiplas imagens no registro, especifique um ref com --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Atualizando: %s de %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+"LOCALIZAÇÃO ARQUIVO – Importa um arquivo de pacote para um repositório local"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "LOCALIZAÇÃO e ARQUIVO devem ser especificados"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Arquitetura para usar"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Inicializa variável a partir do runtime nomeado"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Inicializa aplicativos a partir do aplicativo nomeado"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APLICATIVO"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Especifica a versão para --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSÃO"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Inclui essa extensão base"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "EXTENSÃO"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Inicializa /usr com uma cópia do sdk com permissão de escrita"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Especifica o tipo de compilação (app, runtime, extension)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TIPO"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Adiciona uma etiqueta"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ETIQUETA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Inclui essa extensão de sdk em /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Onde armazenar sdk (padrão é “usr”)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Reinicializa o/a sdk/var"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Extensão %s exigida está apenas parcialmente instalada"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Extensão %s exigida não está instalada"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"DIRETÓRIO NOMEAPLICATIVO SDK RUNTIME [RAMO] – Inicializa um diretório para "
+"compilação"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "RUNTIME deve ser especificado"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"“%s” não é um nome de tipo de compilação válido, use app, runtime ou "
+"extension"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "“%s” não é um nome de aplicativo válido: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Diretório de compilação %s já inicializado"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Arquitetura para a qual será instalada"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Procura pelo runtime com o nome especificado"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "LOCALIZAÇÃO [ID [RAMO]] – Assina um aplicativo ou runtime"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Nenhum id de chave gpg especificado"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Comando desconhecido “%s”"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "APLICATIVO deve ser especificado"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Remove remoto ainda que ele esteja em uso"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NOME – Exclui um repositório remoto"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Cria uma referência única de documento"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Faz o documento transiente para a sessão atual"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Não exige que o arquivo já exista"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Concede ao aplicativo permissões de leitura"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Concede ao aplicativo permissões de escrita"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Concede ao aplicativo permissões de exclusão"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Concede ao aplicativo permissões para conceder permissões"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Revoga permissões de leitura do aplicativo"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Revoga permissões de escrita do aplicativo"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Revoga permissões de exclusão do aplicativo"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Revoga a permissão para conceder permissões"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Adiciona permissões para este aplicativo"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "APPID"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "ARQUIVO – Exporta um arquivo para aplicativos"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "ARQUIVO deve ser especificado"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "ARQUIVO – Obtém informações sobre um arquivo exportado"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Não exportado\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[APPID] – Lista arquivos exportados"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "ARQUIVO – Desfaz exportação de um arquivo para aplicativos"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDBOXEDPID [COMANDO [args…]] – Executa um comando dentro de um sandbox"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "SANDBOXEDPID e COMANDO devem ser especificados"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr "Não executando como root, pode ser impossível entrar no espaço de nome"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Pid inválido %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Pid inexistente %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Não foi possível ler cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Não foi possível ler root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Espaço de nome inválido %s para pid %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Espaço de nome inválido %s para si próprio"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Não foi possível abrir o espaço de nome %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Não foi possível entrar no espaço de nome %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Não foi possível executar chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Não foi possível fazer chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Não foi possível trocar o gid"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Não foi possível trocar o uid"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Mostra instalações do usuário"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Mostra instalações do sistema"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Mostra instalações específicas do sistema"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Mostra referência"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Mostra commit"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Mostra origem"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Mostra tamanho"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Mostra metadados"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Mostra extensões"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr "NOME [RAMO] – Obtém info sobre aplicativo e/ou runtime instalados"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "ref não presento na origem"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Ref:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Arq.:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Ramo:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Origem:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Commit ativo:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Último commit:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alt-id:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Localização:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Tamanho instalado:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Runtime:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Subdiretórios instalados:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Extensões:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Subcaminhos:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "COMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Procura pelo aplicativo com o nome especificado"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Mostra referência"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "REMOTO e REF devem ser especificados"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Tamanho baixado"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Commit:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Não faz pull, apenas instala do cache local"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Não implementa (deploy), apenas baixa para o cache local"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Não instala referências relacionadas"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Não verifica/instala dependências de runtime"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Não usa deltas estáticos"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Presume LOCALIZAÇÃO como sendo um pacote de arquivo único .flatpak"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Presume LOCALIZAÇÃO como sendo uma descrição de aplicativo .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr "Verifica assinaturas de pacote com chave GPG do ARQUIVO (- para stdin)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Instala apenas esse subcaminho"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "CAMINHO"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Responde sim automaticamente para todas as perguntas"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s commit %s já está instalado"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Esse aplicativo depende de runtimes de:\n"
+"  %s\n"
+"Configure esse como o novo remoto “%s”"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Configurando %s como novo remoto “%s”"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Arquivo do pacote deve ser especificado"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Não há suporte a pacotes remotos"
+
+#: app/flatpak-builtins-install.c:338
+#, fuzzy, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"O remoto “%s”, na localização %s contém aplicativos adicionais.\n"
+"Você deseja instalar outros aplicativos daqui?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Arquivo ou uri deve ser especificado"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "LOCALIZAÇÃO/REMOTO [REF…] – Instala aplicativos ou runtimes"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Mostra informações extras"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Lista runtimes instalados"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Lista aplicativos instalados"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Arquitetura para mostrar"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Lista todos os refs (incluindo localidade/depuração)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Ref"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Origem"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Commit ativo"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Último commit"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Tamanho instalado"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Opções"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " – Lista os aplicativos e/ou runtimes instalados"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Mostra os detalhes do remoto"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Mostra remotos desabilitados"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " – Lista repositórios remotos"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Nome"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Título"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioridade"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Mostra arquiteturas e ramos"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Mostra apenas runtimes"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Mostra apenas aplicativos"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Mostra apenas aqueles com atualizações disponíveis"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Limita a essa arquitetura (* para todas)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " REMOTO – Mostra runtimes e aplicativos disponíveis"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Commit"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Tamanho baixado"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Nenhuma informação de ref disponível no repositório"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Arquitetura para a qual será tornada atual"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "APLICATIVO RAMO – Faz o ramo do aplicativo atual"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "APLICATIVO deve ser especificado"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "RAMO deve ser especificado"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Aplicativo %s ramo %s não está instalado"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "APLICATIVO – Sobrepõe as configurações para um aplicativo"
+
+#: app/flatpak-builtins-repo.c:48
+#, fuzzy, c-format
+msgid "Title: %s\n"
+msgstr "Título"
+
+#: app/flatpak-builtins-repo.c:51
+#, fuzzy, c-format
+msgid "Collection ID: %s\n"
+msgstr "ID de coleção"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, fuzzy, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "ID de coleção"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Instalado"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Baixar"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Mostra informações gerais sobre um repositório"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Lisa os ramos no repositório"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Mostra metadados para um ramo"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "LOCALIZAÇÃO – Manutenção de repositório"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Redireciona esse repositório a uma nova URL"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Um nome legal para usar para este repositório"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Ramo padrão para usar para este repositório"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+"Implementa permanentemente ID de coleção em configurações remotas de cliente"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importa nova chave pública GPG padrão do ARQUIVO"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "ID da chave GPG para assinar o sumário"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Gera arquivos delta"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Suprime objetos não usados"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr "Atravessa apenas NÍVEL pais para cada commit (padrão: -1=infinito)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "NÍVEL"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Gerando delta: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Gerando delta: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Falha ao gerar delta %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Falha ao gerar delta %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "LOCALIZAÇÃO – Atualiza metadados de um repositório"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Atualizando ramo do appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Atualizando resumo\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Objetos totais: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Nenhum objeto alcançável\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u objetos excluídos, %s liberado\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Comando para executar"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Ramo para usar"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Usa runtime de desenvolvimento"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Runtime para usar"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Versão do runtime para usar"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Registra o log das chamadas de barramento de acessibilidade"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Habilita encaminhamento de arquivo"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "APLICATIVO [args…] – Executa um aplicativo"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "REMOTO deve ser especificado"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "ID de coleção"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Ramo:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Nenhum remoto %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Descrição completa"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Sem combinações com %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Arquitetura para desinstalar"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Mantém referência no repositório local"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Não desinstala referências relacionadas"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Remove arquivos ainda que estejam em execução"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF… – Desinstala um aplicativo"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Deve especificar pelo menos uma REF"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Aviso: Problema ao procurar por refs relacionadas: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Instalando: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Arquitetura para a qual será atualizada"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Commit para implementar"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Remove arquivos antigos ainda que estejam em execução"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Não faz pull, apenas atualiza do cache local"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Não atualiza refs relacionadas"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Atualiza appstream para remoto"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Atualiza apenas esse subcaminho"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Atualizando appstream para remoto %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Atualizando appstream para remoto %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Atualizando resumo\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF…] – Atualiza aplicativos ou runtimes"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Nenhuma atualização.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Qual você deseja instalar (0 para abortar)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Gerência de aplicativos e runtimes instalados"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Instala um aplicativo ou runtime"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Atualiza um aplicativo ou runtime instalado"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Desinstala um aplicativo ou runtime instalado"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Lista aplicativos e/ou runtimes instalados"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Mostra informações do aplicativo ou runtime instalado"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Configurar remoto"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Assina um aplicativo ou runtime"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Execução de aplicativos"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Executa um aplicativo"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Sobrepõe as permissões para um aplicativo"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Especifica a versão padrão para executar"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Insere o espaço de nome de um aplicativo em execução"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Gerência de acesso a arquivos"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Concede a um aplicativo acesso a um arquivo específico"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Revoga o acesso a um arquivo específico"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Mostra informações sobre um arquivo específico"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Lista arquivos exportados"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Gerência de repositórios remotos"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Lista todos os remotos configurados"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Adiciona um novo repositório remoto (via URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modifica as propriedades de um remoto configurado"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Exclui um remoto configurado"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Lista o conteúdo de um remoto configurado"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Mostra informações do aplicativo ou runtime instalado"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Compilação de aplicativos"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Inicializa um diretório para compilação"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Executa um comando de compilar dentro do diretório de compilação"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Finaliza um diretório de compilação para exportar"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exporta um diretório de compilação para um repositório"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Cria um arquivo de pacote a partir de um diretório de compilação"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importa um arquivo de pacote"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Assina um aplicativo ou runtime"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Atualiza o arquivo de sumário num repositório"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Cria um novo commit baseado numa referência existente"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Mostra informações sobre um repo"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Exibe informações de depuração durante o processamento de comandos"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr ""
+"Exibe a informações de depuração da árvore do sistema durante o "
+"processamento de comandos"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Mostra opções de ajuda"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Exibe informações sobre a versão e sai"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Exibe a arquitetura padrão e sai"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Exibe arquiteturas para as quais há suporte e sai"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Exibe drivers gl ativos e sai"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Trabalha em instalações do usuário"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Trabalha em instalações do sistema (padrão)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Trabalha instalações específicas do sistema"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NOME"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Comandos embutidos:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Comando desconhecido “%s”"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Nenhum comando especificado"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "erro:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Localizado em diversos remotos:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Localizado no remoto %s, você deseja instalá-lo?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Localizado em diversos remotos:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Qual você deseja instalar (0 para abortar)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Runtime exigido para %s (%s) não está instalado, pesquisando…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr "O runtime exigido %s não foi localizado em um remoto configurado.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s não instalado"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Remoto %s desabilitado, ignorando atualização de %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s já instalado, ignorando\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s commit %s já está instalado"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s precisa de uma versão posterior do flatpak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Erro ao atualizar metadados extras para “%s”: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "instalar"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Instalando: %s de %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Instalando: %s de %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "atualizar"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Atualizando: %s de %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Atualizando: %s de %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Agora em %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Nenhuma atualização.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "instala pacote"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Instalando: %s do pacote %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Instalando: %s do pacote %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Aviso: Falha ao %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Erro: Falha ao %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Uma ou mais operações falharam"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Nenhuma substituição localizada para %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Ao abrir o repositório %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Não foi possível criar um diretório de deploy"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "sha256 inválido para uri de dados extras %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Nome vazio para uri de dados extras %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Sem suporte à uri de dados extras %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Falha ao carregar extra-data local %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Tamanho inválido para extra-data %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Enquanto baixava %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Tamanho inválido para dados extras %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Soma de verificação inválida para dados extras %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr ""
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s commit %s já está instalado"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Enquanto executava pull de %s a partir do remoto %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Não foi possível localizar %s no remoto %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Memória insuficiente"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Falha ao ler do arquivo exportado"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Erro ao ler o arquivo xml de tipo mime"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Arquivo inválido de xml de tipo mim"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Enquanto obtinha metadados destacados: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Enquanto criava extradir: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "sha256 inválido para dados extras"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Tamanho inválido para dados extras"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Soma de verificação inválida para dados extras"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Enquanto escrevia o arquivo de dados extras “%s”: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "script apply_extra falhou, status de saída %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Enquanto tentava resolver ref %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s não está disponível"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s ramo %s já está instalado"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Falha ao ler commit %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Enquanto tentava fazer checkout de %s para %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Enquanto tentava fazer checkout do subcaminho de metadados: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Enquanto tentava remover diretório extra existente: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Enquanto tentava aplicar dados extras: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Pid inválido %s"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Pid inválido %s"
+
+#: common/flatpak-dir.c:5448
+#, fuzzy, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Ref implementado %s não coincide com o commit (%s)"
+
+#: common/flatpak-dir.c:5456
+#, fuzzy, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Ref implementado %s não coincide com o commit (%s)"
+
+#: common/flatpak-dir.c:5464
+#, fuzzy, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "Ref implementado %s não coincide com o commit (%s)"
+
+#: common/flatpak-dir.c:5470
+#, fuzzy, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Ref implementado %s não coincide com o commit (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Ref implementado %s não coincide com o commit (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Metadados implementados não coincidem com o commit"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Essa versão de %s já está instalada"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Não é possível alterar remoto durante instalação de pacote"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s ramo %s não está instalado"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s ramo %s não está instalado"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Sem combinações com %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Não foi possível localizar %s%s%s%s%s no remoto %s"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Erro: Falha ao %s %s: %s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Mantém referência no repositório local"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s não instalado"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Não foi possível localizar instalação de %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Runtime %s, ramo %s já está instalado"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Aplicativo %s, ramo %s já está instalado"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Título remoto não definido"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Ramo padrão remoto não definido"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Nenhum cache de flatpak no sumário remoto"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Nenhuma entrada para %s no cache de flatpak de sumário remoto "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Tipo de compartilhamento desconhecido %s, tipos válidos são: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Tipo de política desconhecida %s, tipos válidos são: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Nome de dbus inválido %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Tipo de soquete desconhecido %s, tipos válidos são: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Tipo de dispositivo desconhecido %s, tipos válidos são: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Tipo de recurso desconhecido %s, tipos válidos são: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Localização de sistema de arquivos desconhecida %s, localizações válidas "
+"são: host, home, xdg-*[/…], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Formato de env inválido %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Compartilha com o host"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "COMPARTILHAR"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Desfaz compartilhamento com o host"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Expõe o soquete para o aplicativo"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOQUETE"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Não expõe o soquete para o aplicativo"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Expõe o dispositivo para o aplicativo"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "DISPOSITIVO"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Não expõe o dispositivo para o aplicativo"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Permiti a funcionalidade"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNCIONALIDADE"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Não permite funcionalidade"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+"Expõe o sistema de arquivos para o aplicativo (:ro para somente leitura)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "SISTEMA_DE_ARQUIVOS[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Não expõe o sistema de arquivos para o aplicativo"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SISTEMA_DE_ARQUIVOS"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Define uma variável de ambiente"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VAR=VALOR"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Permite o aplicativo ter um nome no barramento de sessão"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NOME_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Permite o aplicativo falar com um nome no barramento de sessão"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Permite o aplicativo ter um nome no barramento de sistema"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Permite o aplicativo falar com um nome no barramento de sistema"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Adiciona uma opção de política genérica"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSISTEMA.CHAVE=VALOR"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Remove uma opção de política genérica"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Persiste o diretório pessoal"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "ARQUIVO"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Não exige uma sessão em execução (sem criação de cgroups)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Falha ao abrir arquivo temporário de flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Falha ao abrir arquivo temporário: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Não foi possível criar um pipe de sincronização"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Falha ao abrir arquivo informação do aplicativo: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Falha ao sincronizar com proxy de dbus"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "script apply_extra falhou, status de saída %d"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Atualizando: %s de %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Erro: Falha ao %s %s: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Nenhuma fonte de dados extras"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Mostra tamanho"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Mostra tamanho"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Mostra tamanho"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Instalar aplicativo assinado"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Autenticação é necessária para instalar software"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Instalar runtime assinado"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Atualizar aplicativo assinado"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Autenticação é necessária para atualizar software"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Atualizar runtime assinado"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Atualizar metadados remotos"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Autenticação é necessária para atualizar informações remotas"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Atualiza o arquivo de sumário num repositório"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Autenticação é necessária para atualizar informações remotas"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Instalar pacote"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Desinstalar runtime"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Autenticação é necessária para desinstalar software"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Desinstalar aplicativo"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Configurar remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Autenticação é necessária para configurar os repositórios de software"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Configurar remoto"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr "Autenticação é necessária para configurar os repositórios de software"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Atualizar appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Nenhum remoto %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Mostra instalações do usuário"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Mostra instalações do sistema"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Mostra instalações específicas do sistema"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Falha ao criar arquivo temporário"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Falha ao desvincular arquivo temporário"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Falha ao escrever para arquivo temporário"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Instalando: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Instalando: %s\n"
diff --git a/po/quot.sed b/po/quot.sed
new file mode 100644 (file)
index 0000000..0122c46
--- /dev/null
@@ -0,0 +1,6 @@
+s/"\([^"]*\)"/“\1”/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“”/""/g
diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin
new file mode 100644 (file)
index 0000000..2436c49
--- /dev/null
@@ -0,0 +1,19 @@
+# Sed script that remove the POT-Creation-Date line in the header entry
+# from a POT file.
+#
+# The distinction between the first and the following occurrences of the
+# pattern is achieved by looking at the hold space.
+/^"POT-Creation-Date: .*"$/{
+x
+# Test if the hold space is empty.
+s/P/P/
+ta
+# Yes it was empty. First occurrence. Remove the line.
+g
+d
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/po/ru.gmo b/po/ru.gmo
new file mode 100644 (file)
index 0000000..30e0c4e
Binary files /dev/null and b/po/ru.gmo differ
diff --git a/po/ru.po b/po/ru.po
new file mode 100644 (file)
index 0000000..85997c3
--- /dev/null
+++ b/po/ru.po
@@ -0,0 +1,2933 @@
+# Russian translation for flatpak.
+# Copyright (C) 2016 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+#
+# Roman Kharin <romiq.kh@gmail.com>, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-02-10 11:59+0300\n"
+"Last-Translator: Roman Kharin <romiq.kh@gmail.com>\n"
+"Language-Team: romiq.kh@gmail.com\n"
+"Language: ru\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"X-Generator: Poedit 1.8.7.1\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Ничего не делать если удалённый репозиторий уже существует"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "ПУТЬ указывает на файл с конфигурацией, а не на репозиторий"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Включить проверку GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Пометить удалённый репозиторий как просматриваемый"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr ""
+"Пометить удалённый репозиторий как используемый для поиска зависимостей"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Указать новый адрес url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "АДРЕС"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Включить удалённый репозиторий"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr ""
+"Обновить метаданные дополнительных данных из файла со сводной информацией"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Отключить проверку GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Пометить удалённый репозиторий как не просматриваемый"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr ""
+"Пометить удалённый репозиторий как не используемый для поиска зависимостей"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Установить приоритет (по умолчанию 1, чем больше тем выше приоритет)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "ПРИОРИТЕТ"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Красивое имя для удалённого репозитория"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "ЗАГОЛОВОК"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Указать ветку по умолчанию для удалённого репозитория"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "ВЕТКА"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Импортировать ключ GPG из ФАЙЛА (- из стандартного потока ввода)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "ФАЙЛ"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Отключить удалённый репозиторий"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Невозможно открыть пространство имён %s: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Неверный формат переменной окружения %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Некорректный тип uri %s, поддерживается только http/https"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Неверный pid %s"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "ИМЯ ПУТЬ - Добавить удалённый репозиторий"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "Должно быть указано ИМЯ"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "Должен быть указан ПУТЬ"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Слишком много аргументов"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, fuzzy, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "'%s' не является корректным именем приложения: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Удалённый репозиторий %s уже существует"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Не указан адрес в файле flatpakrepo"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, fuzzy, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Невозможно обновить метаданные дополнительных данных для %s"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "ИМЯ - Изменить удалённый репозиторий"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Должно быть указано ИМЯ для удалённого репозитория"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+"Обновление метаданных дополнительных данных из файла со сводной информацией "
+"в удалённом репозитории для %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Ошибка при обновлении метаданных дополнительных данных для '%s': %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Невозможно обновить метаданные дополнительных данных для %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Экспортировать среду исполнения вместо приложения"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Архитектура для пакета"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "АРХ"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Адрес url для репозитория"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Адрес среды исполнения файла flatpakrepo"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Добавить ключ GPG из ФАЙЛА (- из стандартного потока ввода)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Экспортировать образ oci вместо пакета flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#, fuzzy
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "ID Ключа GPG для подписи сводной информации"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "КЛЮЧ-ID"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Домашний каталог GPG для поиска связок ключей"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "ДОМАШНИЙ_КАТАЛОГ"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"ПУТЬ ИМЯ_ФАЙЛА ИМЯ [ВЕТКА] - создать один файл с пакетом из локального "
+"репозитория"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "Должны быть указаны ПУТЬ, ИМЯ_ФАЙЛА и ИМЯ"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "'%s' не является корректным репозиторием"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "'%s' не является корректным именем: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "'%s' не является корректным именем ветки: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Использовать обычную среду исполнения вместо отладочной"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Добавить связанную точку монтирования"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "НАЗНАЧЕНИЕ=ИСТОЧНИК"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Начать сборку в указанном каталоге"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "КАТАЛОГ"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Каталог для поиска других sdk (по умолчанию 'usr')"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Использовать другой файл метаданных"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Журналировать вызовы пользовательской шины"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Журналировать вызовы системной шины"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "КАТАЛОГ [КОМАНДА [параметры...]] - Сборка в каталоге"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "Должен быть указан КАТАЛОГ"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"Каталог сборки %s не инициализирован, воспользуйтесь flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr ""
+"некорректные метаданные, не является ни приложением, ни средой выполнения"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Не найдена точка расширения подходящая для %s в %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Отсутствует '=' в параметре связанного монтирования '%s'"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Невозможно запустить приложение"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Исходный каталог репозитория"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "ИСТОЧНИК-РЕПОЗИТОРИЙ"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Ссылка на репозиторий"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "ИСТОЧНИК-ССЫЛКА"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Тема в одну строку"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "ТЕМА"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Полное описание"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "ТЕЛО"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Обновить ветку appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Не обновлять сводную информацию"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "ID ключа GPG для подписи изменения"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"НАЗН-РЕПО [НАЗН-ССЫЛКА]... - Зафиксировать изменение на основе существующего "
+"изменения (или изменений)"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "Должен быть указан НАЗН-РЕПО"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Если --src-repo не задана, должна быть указана ровно одна ссылка назначения"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Если --src-ref задана, должна быть указана ровно одна ссылка назначения"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Должны быть задана --src-repo либо --src-ref."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Невозможно зафиксировать частичное изменение источника"
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Имя архитектуры для экспорта (должна быть совместима с хостом)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Зафиксировать среду исполнения (/usr) вместо приложения (/app)"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Использовать другой каталог для файлов"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "ПОДКАТАЛОГ"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Исключить файлы"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "ШАБЛОН"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Исключенные файлы для добавления"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Ошибка при открытии временного файла: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Некорректный тип uri %s, поддерживается только http/https"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "Не возможно найти базовое имя в %s, укажите имя явно"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr ""
+"Не разрешается использовать символ '/' в названии дополнительных данных "
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Неверный формат контрольной суммы sha256: '%s'"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Дополнительные данные нулевого размера не поддерживаются"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "ПУТЬ КАТАЛОГ [ВЕТКА] - Создать репозиторий из каталога сборки"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "Должны быть указаны ПУТЬ и КАТАЛОГ"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Не указано имя в метаданных"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Показать подробности про удалённый репозиторий"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Показать подробности про удалённый репозиторий"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Указать команду"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "КОМАНДА"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Требовать версию flatpak"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Не делать экспорт"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Информация о дополнительных данных"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Добавить информацию о точке расширения"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "ИМЯ=ПЕРЕМЕННАЯ[=ЗНАЧЕНИЕ]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Заменить sdk, используемое приложением"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Заменить среду выполнения, используемую приложением"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "СРЕДА_ИСПОЛНЕНИЯ"
+
+#: app/flatpak-builtins-build-finish.c:56
+#, fuzzy
+msgid "Set generic metadata option"
+msgstr "Удалить параметр обобщенной политики"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Обновление сводной информации\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Слишком мало элементов у параметра --extra-data %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, fuzzy, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Слишком мало элементов у параметра --extension %s, формат должен иметь вид "
+"ИМЯ=ПЕРЕМЕННАЯ[=ЗНАЧЕНИЕ]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Слишком мало элементов у параметра --extension %s, формат должен иметь вид "
+"ИМЯ=ПЕРЕМЕННАЯ[=ЗНАЧЕНИЕ]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "КАТАЛОГ - Финализировать каталог сборки"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Каталог сборки %s не инициализирован"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Каталог сборки %s уже финализирован"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Пожалуйста, перепроверьте экспортированные файлы и метаданные\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Переопределить ссылку на импортированный пакет"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "ССЫЛКА"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Импортировать образ oci вместо пакета flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, fuzzy, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "'%s' не является корректным репозиторием"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Обновление: %s из %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "ПУТЬ ИМЯ_ФАЙЛА - Импортировать файл с пакетом в локальный репозиторий"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "Должны быть указаны ПУТЬ и ИМЯ_ФАЙЛА"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Использовать архитектуру"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Инициализировать окружение из названной среды исполнения"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Инициализировать приложения из названного приложения"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "ПРИЛОЖЕНИЕ"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Версия приложения для параметра --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "ВЕРСИЯ"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Включить указанное базовое расширение"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "РАСШИРЕНИЕ"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Инициализировать каталог /usr с доступной для записи копией sdk"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Укажите тип сборки (app, runtime, extension)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "ТИП"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Добавить метку"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "МЕТКА"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Включить указанное расширение sdk в каталог /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Путь к sdk (по умолчанию 'usr')"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Переинициализировать sdk/окружение"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Требуемое расширение %s установлено частично"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Требуемое расширение %s не установлено"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"КАТАЛОГ ИМЯ_ПРИЛОЖЕНИЯ SDK СРЕДА_ИСП [ВЕТКА] - Инициализировать каталог для "
+"сборки"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "Должна быть указана СРЕДА_ИСП"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"'%s' не является корректным именем для типа сборки, укажите app, runtime или "
+"extension"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "'%s' не является корректным именем приложения: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Каталог сборки %s уже инициализирован"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Архитектура для установки"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Искать среду исполнения с указанным именем"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "ПУТЬ [ID [ВЕТКА]] -  Подписать приложение или среду разработки"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Ключ/кличи GPG не указаны"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Неизвестная команда '%s'"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "Должно быть указано ПРИЛОЖЕНИЕ"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Удалить удаленный репозиторий даже если он используется"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "ИМЯ - Удалить удалённый репозиторий"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Создать уникальную ссылку на документ"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Сделать документ временным для текущей сессии"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Не требовать чтобы файл уже существовал"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Дать приложению право на чтение"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Дать приложению право на запись"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Дать приложению право на удаление"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Дать приложению право на изменение разрешений"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Отозвать у приложения право на чтение"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Отозвать у приложения право на запись"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Отозвать у приложения право на удаление"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Отозвать у приложения право на изменение разрешений"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Добавить разрешения приложению"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "ID_ПРИЛ"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "ФАЙЛ - Экспортировать файл приложениям"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "Должно быть указано ИМЯ_ФАЙЛА"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "ФАЙЛ - Получить информацию об экспортированном файле"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Не экспортирован\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[ID_ПРИЛ] - Показать список экспортированных файлов"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "ФАЙЛ - Убрать файл из экспортрованных"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"ID_ИЗОЛ_ПРОЦ [КОМАНДА [параметры...]] - Выполнить команду внутри "
+"изолированного окружения"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "Должны быть указаны ID_ИЗОЛ_ПРОЦ и КОМАНДА"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Неверный pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Не такого процесса %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Невозможно прочитать текущий каталог"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Невозможно прочитать корневой каталог"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Неверное пространство имён %s для процесса %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Неверное %s пространство имён для текущего процесса"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Невозможно открыть пространство имён %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Невозможно войти в пространство имён %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Невозможно сменить текущий каталог"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Невозможно сменить корневой каталог"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Невозможно изменить группу пользователя"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Невозможно сменить пользователя"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Показать установленное только для пользователя"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Показать установленное для всех пользователей"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Показать установленное в указанном каталоге"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Показать ссылки"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Показать зафиксированные изменения"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Показать происхождение"
+
+#: app/flatpak-builtins-info.c:55
+#, fuzzy
+msgid "Show size"
+msgstr "Показать ссылки"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+#, fuzzy
+msgid "Show metadata"
+msgstr "Показать подробности про удалённый репозиторий"
+
+#: app/flatpak-builtins-info.c:57
+#, fuzzy
+msgid "Show extensions"
+msgstr "Показать параметры справки"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"ИМЯ [ВЕТКА] - Получить информацию об установленных приложениях и/или средах "
+"исполнения"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+#, fuzzy
+msgid "Branch:"
+msgstr "Используемая ветка"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+#, fuzzy
+msgid "Installed size:"
+msgstr "Установка: %s\n"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+#, fuzzy
+msgid "Runtime:"
+msgstr "Используемая среда исполнения"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:308
+#, fuzzy
+msgid "Extension:"
+msgstr "Показать параметры справки"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "ИЗМЕНЕНИЕ"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Искать приложение с указанным именем"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Показать ссылки"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "Должны быть указаны УДАЛЁННЫЙ_РЕПО и ССЫЛКА"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Показать ссылки"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Показать зафиксированные изменения"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Не обращаться к репозиторию, устанавливать из локального кеша"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Не начинать установку, только скачать в кеш"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Не устанавливать связанные ссылки"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Не проверять и не устанавливать зависимости среды исполнения"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "ПУТЬ является файлом с пакетом"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "ПУТЬ является описанием приложения в формате .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr "Проверять подписи пакета ключом GPG из ФАЙЛА (- из стандартного ввода)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Устанавливать только указанный подкаталог"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "ПУТЬ"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Автоматически отвечать да на все вопросы"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s ветка %s уже установлено"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Это приложение зависит от сред исполнения из:\n"
+"  %s\n"
+"Добавить его как новый удалённый репозиторий '%s'"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Настройка %s как новый удаленный репозиторий '%s'"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Должно быть указано  имя файла с пакетом"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Пакеты из удалённых репозиториев не поддерживаются"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Должно быть указано имя файла или адрес"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Установка: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr ""
+"ПУТЬ/УДАЛЁННЫЙ_РЕПО [ССЫЛКА] - Установить приложения или среды исполнения"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Показать дополнительную информацию"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Показать установленные среды исполнения"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Показать установленные приложения"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Показать архитектуры"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+#, fuzzy
+msgid "Installed size"
+msgstr "Установка: %s\n"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Показать список установленных приложений и/или сред исполнения"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Показать подробности про удалённый репозиторий"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Показать отключённые удалённые репозитории"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Показать удалённые репозитории"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Показать архитектуры и ветки"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Показать только среды исполнения"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Показать только приложения"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Показать элементы с доступными обновлениями"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Показать только указанные архитектуры (* для всех)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " УДАЛЁННЫЙ_РЕПО - Показать доступные среды исполнения и приложения"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:179
+#, fuzzy
+msgid "Download size"
+msgstr "Показать ссылки"
+
+#: app/flatpak-builtins-ls-remote.c:301
+#, fuzzy
+msgid "No ref information available in repository"
+msgstr "ФАЙЛ - Получить информацию об экспортированном файле"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Архитектура, которая станет текущей"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "ПРИЛОЖЕНИЕ ВЕТКА - Сделать ветку текущей для приложения"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Должно быть указано ПРИЛОЖЕНИЕ"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Должна быть указана ВЕТКА"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Приложение %s ветка %s не установлено"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "ПРИЛОЖЕНИЕ - Переопределить настройки для приложения"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+#, fuzzy
+msgid "Installed"
+msgstr "установить"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:151
+#, fuzzy
+msgid "Print general information about the repository"
+msgstr "ФАЙЛ - Получить информацию об экспортированном файле"
+
+#: app/flatpak-builtins-repo.c:152
+#, fuzzy
+msgid "List the branches in the repository"
+msgstr "Ветка по умолчанию для репозитория"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:168
+#, fuzzy
+msgid "LOCATION - Repository maintenance"
+msgstr "ПУТЬ - Обновить метаданные репозитория"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Красивое имя для репозитория"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Ветка по умолчанию для репозитория"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "ID Ключа GPG для подписи сводной информации"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Создать дельта файлы"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Очистить неиспользуемые объекты"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Следовать только до ГЛУБИНЫ при поиске родителей для каждого "
+"зафиксированного изменения (по умолчанию: -1=бесконечно)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "ГЛУБИНА"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Создание дельты: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Создание дельты: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Ошибка при создании дельты %s (%.10s): %s\n"
+
+#: app/flatpak-builtins-repo-update.c:206
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Ошибка при создании дельты %s (%.10s-%.10s): %s\n"
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "ПУТЬ - Обновить метаданные репозитория"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Обновление ветки appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Обновление сводной информации\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Всего объектов: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Нет недоступных объектов\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Удалено %u объектов, %s освобождено\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Команда для исполнения"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Используемая ветка"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Использовать среду исполнения для разработчиков"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Используемая среда исполнения"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Версия среды исполнения"
+
+#: app/flatpak-builtins-run.c:60
+#, fuzzy
+msgid "Log accessibility bus calls"
+msgstr "Журналировать вызовы пользовательской шины"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "ПРИЛОЖЕНИЕ [параметры...] - Запустить приложение"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "Должен быть указан УДАЛЕННЫЙ_РЕПО"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Запустить приложение"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Используемая ветка"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Нет удалённого репозитория %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Полное описание"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Совпадений не обнаружено %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Удаляемая архитектура"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Сохранить ссылку в локальном репозитории"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Не удалять связанные ссылки"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Удалять файлы даже если запущено"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "ССЫЛКА... - Удалить приложение"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Должна быть указана как минимум одна ССЫЛКА"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Предупреждение: Проблема при поиске связанных ссылок: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Установка: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Обновляемая архитектура"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Зафиксировать изменения для развёртывания"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Удалять старые файлы даже если запущено"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Не скачивать, обновлять только из локального кеша"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Не обновлять связанные ссылки"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Обновить ветку appstream для удалённого репозитория"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Обновлять только указанный подкаталог"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Обновление ветки appstream для удалённого репозитория %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Обновление ветки appstream для удалённого репозитория %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Обновление сводной информации\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[ССЫЛКА...] - Обновить приложения или среды исполнения"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Нет обновлений\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Которую версию установить (0 - отмена)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Управление установленными приложениями и средами исполнения"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Установить приложение или среду исполнения"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Обновить установленное приложение или среду исполнения"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Удалить установленное приложение или среду исполнения"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Показать список установленных приложений и/или сред исполнения"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Показать информацию об установленных приложениях или средах исполнения"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Удалить настроенный удалённый репозиторий"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Подписать приложение или среду исполнения"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Запуск приложений"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Запустить приложение"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Переопределить разрешения для приложения"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Указать версию по умолчанию для запуска"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Войти в пространство имён запущенного приложения"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Управление доступом к файлам"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Разрешить доступ приложения к указанному файлу"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Отозвать разрешение на доступ к указанному файлу"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Показать информацию об указанном файле"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Список экспортированных файлов"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Управление удалёнными репозиториями"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Список всех настроенных удалённых репозиториев"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Добавить новый удалённый репозиторий (по АДРЕСУ)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Изменить свойства настроенного удалённого репозитория"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Удалить настроенный удалённый репозиторий"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Список содержимого удалённого репозитория"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Показать информацию об установленных приложениях или средах исполнения"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Сборка приложений"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Инициализировать каталог для сборки"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Запустить команду сборки в каталоге сборки"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Финализировать каталог сборки для экспорта"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Экспортировать из каталога сборки в репозиторий"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Создать файл с пакетом из каталога сборки"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Импортировать файл с пакетом"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Подписать приложение или среду исполнения"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Обновить файл со сводной информацией в репозитории"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Создать новое изменение на базе существующей ссылки"
+
+#: app/flatpak-main.c:109
+#, fuzzy
+msgid "Print information about a repo"
+msgstr "ФАЙЛ - Получить информацию об экспортированном файле"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Печатать отладочную информацию во время обработки команд"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Печатать отладочную информацию OSTree во время обработки команд"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Показать параметры справки"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Напечатать информацию о версии и выйти"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Напечатать архитектуру по умолчанию и выйти"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Напечатать поддерживаемые архитектуры и выйти"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Показать версию gl драйверов и выйти"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Работать с  установленным только для пользователя"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Работать с установленным для всех пользователей (по умолчанию)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Работать с установленным в указанном каталоге"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "NAME"
+msgstr "ИМЯ_ФАЙЛА"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Встроенные команды:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Неизвестная команда '%s'"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Команда не указана"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "ошибка:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Обнаружено несколько удалённых репозиториев:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Обнаружен удалённый репозиторий %s, установить?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Обнаружено несколько удалённых репозиториев:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Которую версию установить (0 - отмена)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Требуемая среда исполнения для %s (%s) не установлена, поиск...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Требуемая среда исполнения %s не найдена в настроенных удалённых "
+"репозиториях.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s не установлено"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Удалённый репозиторий %s отключен, обновление %s пропущено"
+
+#: app/flatpak-transaction.c:525
+#, fuzzy, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s уже установлено"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s ветка %s уже установлено"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s требует более новую версию flatpak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Ошибка при обновлении метаданных дополнительных данных для '%s': %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "установить"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Установка: %s из %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Установка: %s из %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "обновить"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Обновление: %s из %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Обновление: %s из %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "В настоящее время на %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Нет обновлений\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "установить пакет"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Установка: %s из пакета %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Установка: %s из пакета %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Предупреждение: Не удалось %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Ошибка: Не удалось %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Одна или более операций закончилась с ошибкой"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Не найдено переопределений для %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Во время открытия репозитория %s:"
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Невозможно создать каталог для развёртывания"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Некорректная сумма sha256 для дополнительных данных по адресу %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Пустое имя для дополнительных данных по адресу %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Не поддерживаемые дополнительные данные по адресу %s"
+
+#: common/flatpak-dir.c:2647
+#, fuzzy, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Ошибка чтения зафиксированного изменения %s: "
+
+#: common/flatpak-dir.c:2650
+#, fuzzy, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Неправильный размер дополнительных данных по адресу %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Во время загрузки %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Неправильный размер дополнительных данных по адресу %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Некорректная контрольная сумма дополнительных данных по адресу %s"
+
+#: common/flatpak-dir.c:2742
+#, fuzzy
+msgid "Remote OCI index has no registry uri"
+msgstr "ПУТЬ является реестром oci"
+
+#: common/flatpak-dir.c:2958
+#, fuzzy, c-format
+msgid "%s commit %s already installed"
+msgstr "%s ветка %s уже установлено"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Во время получения %s из удалённого репозитория %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Не найден %s в удалённом репозитории %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Не достаточно памяти"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Ошибка чтения из экспортированного файла"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Во время получения отсоединённых метаданных:"
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Во время создания каталога с дополнительными данными:"
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Некорректная контрольная сумма sha256 для дополнительных данных"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Некорректный размер дополнительных данных"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Некорректная контрольная сумма для дополнительных данных"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Во время записи в файл дополнительных данных '%s': "
+
+#: common/flatpak-dir.c:5181
+#, fuzzy, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "скрипт apply_extra закончился с ошибкой"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Во время поиска назначения ссылки %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s не доступно"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s ветка %s уже установлено"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Ошибка чтения зафиксированного изменения %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Во время получения %s в %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Во время получения метаданных подкаталога "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Во время удаления существующего каталога с дополнительными данными: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Во время применения дополнительных данных: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Неверный pid %s"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Неверный pid %s"
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Указанная версия %s уже установлена"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Невозможно изменить удалённый репозиторий во время установки пакета"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s ветка %s не установлено"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s ветка %s не установлена"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Совпадений не обнаружено %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Невозможно найти %s%s%s%s%s в удалённом репозитории %s"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Ошибка: Не удалось %s %s: %s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Сохранить ссылку в локальном репозитории"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s не установлено"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Не возможно найти %s в установленных"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Среда исполнения %s, ветка %s уже установлена"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Приложение %s, ветка %s уже установлено"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Заголовок удаленного репозитория не установлен"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Ветка по умолчанию в удалённом репозитории не установлена"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Отсутствует путь к кэшу в сводной информации удалённого репозитория"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Нет записи для %s в сводной информации кэша flatpak"
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Неизвестный тип общего каталога %s, доступные типы: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Неизвестный тип политики %s, доступные типы: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Некорректное имя dbus %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Неизвестный тип сокета %s, доступные типы: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Неизвестный тип устройства %s, доступные типы: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Неизвестный тип функционала %s, доступные типы: %s"
+
+#: common/flatpak-run.c:774
+#, fuzzy, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Неизвестный путь файловой системы %s, доступные типы: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Неверный формат переменной окружения %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Добавить общий каталог с хостом"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "ОБЩ_КАТАЛОГ"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Убрать общий каталог с хостом"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Пробросить сокет приложению"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "СОКЕТ"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Убрать проброс сокета приложению"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Пробросить устройство приложению"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "УСТРОЙСТВО"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Убрать проброс устройства приложению"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Разрешить функционал"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "ФУНКЦИОНАЛ"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Запретить функционал"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Пробросить файловую систему приложению (:ro только для чтения)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "ФАЙЛ_СИСТЕМА[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Не пробрасывать файловую систему для приложения"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "ФАЙЛ_СИСТЕМА"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Установить переменную окружения"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "ПЕРЕМЕННАЯ=ЗНАЧЕНИЕ"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Разрешить приложению владеть именем на сессионной шине"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr ""
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Разрешить приложению обмениваться с именем на сессионной шине"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Разрешить приложению владеть именем на системной шине"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Разрешить приложению обмениваться с именем на системной шине"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Добавить параметр обобщенной политики"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "ПОДСИСТЕМА.КЛЮЧ=ЗНАЧЕНИЕ"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Удалить параметр обобщенной политики"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Сохранять домашний каталог"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "ИМЯ_ФАЙЛА"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr ""
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Ошибка при открытии временного файла flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Ошибка при открытии временного файла: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Невозможно создать канал синхронизации"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Ошибка при открытии файла с информацией о приложении: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Ошибка при синхронизации с прокси dbus"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "скрипт apply_extra закончился с ошибкой"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Обновление: %s из %s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Ошибка: Не удалось %s %s: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Нет источников дополнительных данных"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Показать ссылки"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Показать ссылки"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Показать ссылки"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+#, fuzzy
+msgid "Install signed application"
+msgstr "Показать установленные приложения"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+#, fuzzy
+msgid "Install signed runtime"
+msgstr "Показать установленные среды исполнения"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+#, fuzzy
+msgid "Update signed application"
+msgstr "Показать установленные приложения"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+#, fuzzy
+msgid "Update signed runtime"
+msgstr "Показать установленные среды исполнения"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+#, fuzzy
+msgid "Update remote metadata"
+msgstr "ПУТЬ - Обновить метаданные репозитория"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Обновить файл со сводной информацией в репозитории"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+#, fuzzy
+msgid "Install bundle"
+msgstr "установить пакет"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+#, fuzzy
+msgid "Uninstall runtime"
+msgstr "Показать установленные среды исполнения"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+#, fuzzy
+msgid "Uninstall app"
+msgstr "установить"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+#, fuzzy
+msgid "Configure Remote"
+msgstr "Удалить настроенный удалённый репозиторий"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Удалить настроенный удалённый репозиторий"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr ""
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+#, fuzzy
+msgid "Update appstream"
+msgstr "Обновить ветку appstream для удалённого репозитория"
+
+#~ msgid "No remote %s"
+#~ msgstr "Нет удалённого репозитория %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Показать установленное только для пользователя"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Показать установленное для всех пользователей"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Показать установленное в указанном каталоге"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Ошибка при создании временного файла"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Ошибка удаления временного файла"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Ошибка записи во временный файла"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Установка: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Установка: %s\n"
+
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "Должно быть указано имя файла репозитория OCI или его адрес"
+
+#~ msgid "OCI image is not a flatpak (missing ref)"
+#~ msgstr "образ OCI не предназначен для flatpak (отсутствует ссылка)"
+
+#~ msgid "OCI image specifies the wrong app id"
+#~ msgstr "В образ OCI указан некорректное id приложения"
+
+#~ msgid "NAME:SHA256:DOWNLOAD-SIZE:INSTALL-SIZE:URL"
+#~ msgstr "ИМЯ:SHA256:РАЗМЕР-ЗАГРУЗКИ:РАЗМЕР-УСТАНОВКИ:АДРЕС"
+
+#~ msgid "To few elements in --extra-data argument %s"
+#~ msgstr "Слишком мало элементов у параметра --extra-data %s"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "'%s' не является корректным именем среды исполнения: %s"
+
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "'%s' не является корректным именем sdk: %s"
diff --git a/po/sk.gmo b/po/sk.gmo
new file mode 100644 (file)
index 0000000..8edb94c
Binary files /dev/null and b/po/sk.gmo differ
diff --git a/po/sk.po b/po/sk.po
new file mode 100644 (file)
index 0000000..9622a1a
--- /dev/null
+++ b/po/sk.po
@@ -0,0 +1,2890 @@
+# Slovak translation for flatpak.
+# Copyright (C) 2016 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Dušan Kazik <prescott66@gmail.com>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-01-23 18:19+0100\n"
+"Last-Translator: Dušan Kazik <prescott66@gmail.com>\n"
+"Language-Team: Slovak <gnome-sk-list@gnome.org>\n"
+"Language: sk\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;\n"
+"X-Generator: Poedit 1.8.11\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Nevykoná nič, ak poskytnutý vzdialený repozitár už existuje"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Povolí overovanie pomocou GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Nastaví novú url"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Povolí vzdialený repozitár"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Aktualizuje metaúdaje navyše zo súboru zhrnutia"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Zakáže overovanie pomocou GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+"Nastaví prioritu (predvolená hodnota je 1, vyššia hodnota znamená väčšiu "
+"prioritu)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITA"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "NÁZOV"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "VETVA"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importuje kľúč GPG zo SÚBORU (- pre štandardný vstup)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "SÚBOR"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Zakáže vzdialený repozitár"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Neplatný identifikátor pid %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Neplatný identifikátor pid %s"
+
+#: app/flatpak-builtins-add-remote.c:320
+#, fuzzy
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NÁZOV [UMIESTNENIE] - Pridanie vzdialeného repozitára"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NÁZOV musí byť určený"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "UMIESTNENIE musí byť určené"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Príliš veľa parametrov"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, fuzzy, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "„%s“ nie je platným názvom aplikácie: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Vzdialený repozitár %s už existuje"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:415
+#, fuzzy, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Nepodarilo sa aktualizovať metaúdaje navyše pre %s"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NÁZOV - Upraví vzdialený repozitár"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Musí byť určený NÁZOV vzdialeného repozitára"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr ""
+"Chyba počas aktualizácie metaúdajov navyše pre „%s“: %s\n"
+"\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Nepodarilo sa aktualizovať metaúdaje navyše pre %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exportuje prostredie namiesto aplikácie"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARCHITEKTÚRA"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Url pre repozitár"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Pridá kľúč GPG zo SÚBORU (- pre štandardný vstup)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "„%s“ nie je platným repozitárom"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "„%s“ nie je platným názvom: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "„%s“ nie je platným názvom vetvy: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Pridá viazané pripojenie"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "CIEĽ=ZDROJ"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Spustí zostavenie v tomto adresári"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "ADRESÁR"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Použije alternatívny súbor pre metaúdaje"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "ADRESÁR [PRÍKAZ [parametre...]] - Zostavenie v adresári"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "ADRESÁR musí byť určený"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:177
+#, fuzzy
+msgid "metadata invalid, not application or runtime"
+msgstr "Podpíše aplikáciu alebo prostredie"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Nie je možné spustiť aplikáciu"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "ZDROJ-REPOZITÁR"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Predmet na jeden riadok"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "PREDMET"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Úplný popis"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TELO"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr ""
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Súbory na vylúčenie"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "VZOR"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Vylúčené súbory na zahrnutie"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Zlyhalo otvorenie súboru temp"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Nie je určený žiadny názov v metaúdajoch"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Príkaz, ktorý sa má nastaviť"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "PRÍKAZ"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Nespracuje exporty"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Informácie o údajoch navyše"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "PROSTREDIE"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Aktualizovanie zhrnutia\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:523
+#, fuzzy
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "ADRESÁR [PRÍKAZ [parametre...]] - Zostavenie v adresári"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Adresár zostavenia %s nie je inicializovaný"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Adresár zostavenia %s je už uzavretý"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, fuzzy, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "„%s“ nie je platným repozitárom"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Aktualizovanie: %s z %s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Architektúra , ktorá sa má použiť"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APLIKÁCIA"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERZIA"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Zahrnie toto základné rozšírenie"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "ROZŠÍRENIE"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Pridá značku"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ZNAČKA"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Požadované rozšírenie %s je nainštalované iba čiastočne"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "PROSTREDIE musí byť určené"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "„%s“ nie je platným názvom aplikácie: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Adresár zostavenia %s je už inicializovaný"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Architektúra, pre ktorú sa má inštalovať"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr ""
+
+#: app/flatpak-builtins-build-sign.c:64
+#, fuzzy
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "Podpíše aplikáciu alebo rozhranie"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Neznámy príkaz „%s“"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "NÁZOV musí byť určený"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Odstráni vzdialený repozitár, aj keď sa používa"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr ""
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "SÚBOR musí byť určený"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr ""
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Neexportované\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr ""
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:103
+#, fuzzy
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "UMIESTNENIE musí byť určené"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Neplatný identifikátor pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Identifikátor pid %s neexistuje"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Zobrazí referenciu"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Zobrazí začlenenie"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Zobrazí pôvod"
+
+#: app/flatpak-builtins-info.c:55
+#, fuzzy
+msgid "Show size"
+msgstr "Zobrazí referenciu"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:57
+#, fuzzy
+msgid "Show extensions"
+msgstr "Zobrazí voľby pomocníka"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+#, fuzzy
+msgid "Branch:"
+msgstr "Vetva, ktorá sa má použiť"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+#, fuzzy
+msgid "Installed size:"
+msgstr "Nainštalovanie podpísaného prostredia"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+#, fuzzy
+msgid "Runtime:"
+msgstr "Prostredie. ktoré sa má použiť"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:308
+#, fuzzy
+msgid "Extension:"
+msgstr "Zobrazí voľby pomocníka"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "ZAČLENENIE"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Zobrazí referenciu"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+#, fuzzy
+msgid "REMOTE and REF must be specified"
+msgstr "ADRESÁR musí byť určený"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Zobrazí referenciu"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Zobrazí začlenenie"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "CESTA"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "Aplikácia %s vetva %s je už nainštalovaná"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Táto aplikácia závisí na prostredí z:\n"
+"  %s\n"
+"Konfigurovať ju ako nový vzdialený repozitár „%s“"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Názov súboru balíka musí byť určený"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Vzdialené balíky nie sú podporované"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+#, fuzzy
+msgid "Filename or uri must be specified"
+msgstr "Musí byť určený NÁZOV vzdialeného repozitára"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Inštalovanie: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+#, fuzzy
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "Podpíše aplikáciu alebo rozhranie"
+
+#: app/flatpak-builtins-list.c:43
+#, fuzzy
+msgid "Show extra information"
+msgstr "Zobrazí voľby pomocníka"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Vypíše zoznam nainštalovaných prostredí"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Vypíše zoznam nainštalovaných aplikácií"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Architektúra. ktorá sa má zobraziť"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+#, fuzzy
+msgid "Installed size"
+msgstr "Nainštalovanie podpísaného prostredia"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:96
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:179
+#, fuzzy
+msgid "Download size"
+msgstr "Zobrazí referenciu"
+
+#: app/flatpak-builtins-ls-remote.c:301
+#, fuzzy
+msgid "No ref information available in repository"
+msgstr "Vypíše informácie o verzii a skončí"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr ""
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "VETVA musí byť určená"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr ""
+
+#: app/flatpak-builtins-override.c:54
+msgid "[APP] - Override settings [for application]"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+#, fuzzy
+msgid "Installed"
+msgstr "Nainštalovanie balíka"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:151
+#, fuzzy
+msgid "Print general information about the repository"
+msgstr "Vypíše informácie o verzii a skončí"
+
+#: app/flatpak-builtins-repo.c:152
+#, fuzzy
+msgid "List the branches in the repository"
+msgstr "Aktualizuje súbor zhrnutia v repozitári"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "HĹBKA"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Generovanie delta súboru: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Generovanie delta súboru: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Zlyhalo generovanie delta súboru %s (%.10s): %s\n"
+
+#: app/flatpak-builtins-repo-update.c:206
+#, fuzzy, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Zlyhalo generovanie delta súboru %s (%.10s-%.10s): %s\n"
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Aktualizovanie zhrnutia\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Objektov celkom: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Odstránených %u objektov, %s uvoľnených\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Príkaz, ktorý sa má spustiť"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Vetva, ktorá sa má použiť"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Použije vývojové prostredie"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Prostredie. ktoré sa má použiť"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Verzia prostredia, ktoré sa má použiť"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "NÁZOV musí byť určený"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Spustí aplikáciu"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Vetva, ktorá sa má použiť"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Žiadny vzdialený repozitár %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Úplný popis"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Nič nevyhovuje názvu %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:70
+#, fuzzy
+msgid "REF... - Uninstall an application"
+msgstr "Inštalácia podpísanej aplikácie"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Inštalovanie: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr ""
+"Chyba počas aktualizácie metaúdajov navyše pre „%s“: %s\n"
+"\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr ""
+"Chyba počas aktualizácie metaúdajov navyše pre „%s“: %s\n"
+"\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Aktualizovanie zhrnutia\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+#, fuzzy
+msgid "[REF...] - Update applications or runtimes"
+msgstr "Podpíše aplikáciu alebo rozhranie"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Žiadne aktualizácie.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+msgid "Which do you want to use (0 to abort)?"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Správa nainštalovaných aplikácií a prostredí"
+
+#: app/flatpak-main.c:63
+#, fuzzy
+msgid "Install an application or runtime"
+msgstr "Podpíše aplikáciu alebo rozhranie"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr ""
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Konfigurácia vzdialeného repozitára"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Podpíše aplikáciu alebo prostredie"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+"Spúšťanie aplikácií"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Spustí aplikáciu"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr ""
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr ""
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+"Správa prístupu k súborom"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Udelí aplikácii prístup k určenému súboru"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr ""
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr ""
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+"Správa vzdialených repozitárov"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Zoznam všetkých konfigurovaných vzdialených repozitárov"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr ""
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr ""
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Vypíše informácie o verzii a skončí"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+"Zostavenie aplikácií"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr ""
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr ""
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr ""
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exportuje adresár zostavenia do repozitára"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Vytvorí balík z adresára zostavenia"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importuje súbor balíka"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Podpíše aplikáciu alebo prostredie"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Aktualizuje súbor zhrnutia v repozitári"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr ""
+
+#: app/flatpak-main.c:109
+#, fuzzy
+msgid "Print information about a repo"
+msgstr "Vypíše informácie o verzii a skončí"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Vypíše ladiace informácie počas spracovávania príkazu"
+
+#: app/flatpak-main.c:127
+#, fuzzy
+msgid "Print OSTree debug information during command processing"
+msgstr "Vypíše ladiace informácie počas spracovávania príkazu"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Zobrazí voľby pomocníka"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Vypíše informácie o verzii a skončí"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Vypíše predvolenú architektúru a skončí"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Vypíše podporované architektúry a skončí"
+
+#: app/flatpak-main.c:136
+#, fuzzy
+msgid "Print active gl drivers and exit"
+msgstr "Vypíše podporované architektúry a skončí"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr ""
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr ""
+
+#: app/flatpak-main.c:143
+msgid "Work on specific system-wide installation(s)"
+msgstr ""
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "NAME"
+msgstr "NÁZOV_SÚBORU"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Vstavané príkazy:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Neznámy príkaz „%s“"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Nebol určený žiadny príkaz"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "chyba:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Nájdené v niekoľkých vzdialených repozitároch:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Nájdené vo vzdialenom repozitári %s. Chcete vykonať inštaláciu?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Nájdené v niekoľkých vzdialených repozitároch:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr ""
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr ""
+"Požadované prostredie pre %s (%s) nie je nainštalované. Vyhľadáva sa...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr ""
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr ""
+
+#: app/flatpak-transaction.c:525
+#, fuzzy, c-format
+msgid "%s already installed, skipping\n"
+msgstr "Aplikácia %s vetva %s je už nainštalovaná"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "Aplikácia %s vetva %s je už nainštalovaná"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr ""
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr ""
+"Chyba počas aktualizácie metaúdajov navyše pre „%s“: %s\n"
+"\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr ""
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Inštalovanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Inštalovanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:765
+#, fuzzy
+msgid "update"
+msgstr "Žiadne aktualizácie.\n"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Aktualizovanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Aktualizovanie: %s z %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Teraz na začlenení %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Žiadne aktualizácie.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr ""
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Inštalovanie: %s z balíka %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Inštalovanie: %s z balíka %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:846
+#, fuzzy
+msgid "One or more operations failed"
+msgstr "Jedna alebo viacero aktualizácií zlyhali"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr ""
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Počas otvárania repozitára %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr ""
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2647
+#, fuzzy, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Zlyhalo čítanie začlenenia %s: "
+
+#: common/flatpak-dir.c:2650
+#, fuzzy, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Nesprávna veľkosť pre údaje navyše %s"
+
+#: common/flatpak-dir.c:2665
+#, fuzzy, c-format
+msgid "While downloading %s: "
+msgstr "Počas otvárania repozitára %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Nesprávna veľkosť pre údaje navyše %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr ""
+
+#: common/flatpak-dir.c:2742
+#, fuzzy
+msgid "Remote OCI index has no registry uri"
+msgstr "NÁZOV [UMIESTNENIE] - Pridanie vzdialeného repozitára"
+
+#: common/flatpak-dir.c:2958
+#, fuzzy, c-format
+msgid "%s commit %s already installed"
+msgstr "Aplikácia %s vetva %s je už nainštalovaná"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Nedá sa nájsť %s vo vzdialenom repozitári %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Nedostatok pamäte"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Zlyhalo čítanie z exportovaného súboru"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr ""
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr ""
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr ""
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr ""
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr ""
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "Aplikácia %s nie je dostupná"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "Aplikácia %s vetva %s je už nainštalovaná"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Zlyhalo čítanie začlenenia %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr ""
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr ""
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Počas pokusu o odstránenie existujúceho adresára navyše: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Počas pokusu o aplikáciu údajov navyše: "
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Neplatný identifikátor pid %s"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Neplatný identifikátor pid %s"
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Táto verzia aplikácie %s je už nainštalovaná"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr ""
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "Aplikácia %s vetva %s nie je nainštalovaná"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "Aplikácia %s vetva %s nie je nainštalovaná"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Nič nevyhovuje názvu %s"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Nedá sa nájsť %s%s%s%s%s vo vzdialenom repozitári %s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "Aplikácia %s %s nie je nainštalovaná"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Nepodarilo sa nájsť inštaláciu %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Prostredie %s, vetva %s je už nainštalovaná"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Aplikácia %s, vetva %s je už nainštalovaná"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr ""
+
+#: common/flatpak-dir.c:9597
+#, fuzzy
+msgid "Remote default-branch not set"
+msgstr "Vypíše predvolenú architektúru a skončí"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr ""
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr ""
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr ""
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr ""
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr ""
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Zdieľa s hostiteľom"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr ""
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr ""
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr ""
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr ""
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr ""
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "ZARIADENIE"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr ""
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Umožní funkciu"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNKCIA"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Neumožní funkciu"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr ""
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr ""
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr ""
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "SYSTÉM_SÚBOROV"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr ""
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr ""
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr ""
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "NÁZOV_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr ""
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr ""
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr ""
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr ""
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr ""
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr ""
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr ""
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "NÁZOV_SÚBORU"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr ""
+
+#: common/flatpak-run.c:3790
+#, fuzzy, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Zlyhalo otvorenie dočasného súboru flatpak-info"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, fuzzy, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Zlyhalo otvorenie súboru temp"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr ""
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Zlyhalo otvorenie súboru s informáciami o aplikácii: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr ""
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr ""
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Aktualizovanie: %s z %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr ""
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Žiadne zdroje údajov navyše"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "Zobrazí referenciu"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Zobrazí referenciu"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Zobrazí referenciu"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Nainštalovanie podpísanej aplikácie"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Na inštaláciu softvéru sa vyžaduje overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Nainštalovanie podpísaného prostredia"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Aktualizovanie podpísanej aplikácie"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Na aktualizáciu softvéru sa vyžaduje overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Aktualizovanie podpísaného prostredia"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+#, fuzzy
+msgid "Update remote metadata"
+msgstr "Použije alternatívny súbor pre metaúdaje"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+#, fuzzy
+msgid "Authentication is required to update remote info"
+msgstr "Na aktualizáciu softvéru sa vyžaduje overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Aktualizuje súbor zhrnutia v repozitári"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Na aktualizáciu softvéru sa vyžaduje overenie totožnosti"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Nainštalovanie balíka"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Odinštalovanie prostredia"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Na odinštalovanie softvéru sa vyžaduje overenie totožnosti"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+#, fuzzy
+msgid "Uninstall app"
+msgstr "Odinštalovanie prostredia"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Konfigurácia vzdialeného repozitára"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+"Na konfiguráciu softvérových repozitárov sa vyžaduje overenie totožnosti"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Konfigurácia vzdialeného repozitára"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr ""
+"Na konfiguráciu softvérových repozitárov sa vyžaduje overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr ""
+
+#~ msgid "No remote %s"
+#~ msgstr "Žiadny vzdialený repozitár %s"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Zlyhalo vytvorenie dočasného súboru"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Zlyhal zápis dočasného súboru"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Inštalovanie: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Inštalovanie: %s\n"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "„%s“ nie je platným názvom prostredia: %s"
+
+#, fuzzy
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "„%s“ nie je platným názvom"
+
+#, fuzzy
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "Musí byť určený NÁZOV vzdialeného repozitára"
diff --git a/po/stamp-po b/po/stamp-po
new file mode 100644 (file)
index 0000000..9788f70
--- /dev/null
@@ -0,0 +1 @@
+timestamp
diff --git a/po/sv.gmo b/po/sv.gmo
new file mode 100644 (file)
index 0000000..2e48905
Binary files /dev/null and b/po/sv.gmo differ
diff --git a/po/sv.po b/po/sv.po
new file mode 100644 (file)
index 0000000..c6154c4
--- /dev/null
+++ b/po/sv.po
@@ -0,0 +1,2968 @@
+# Swedish translation for flatpak.
+# Copyright © 2017 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Sebastian Rasmussen <sebras@gmail.com>, 2016.
+# Josef Andersson <l10nl18nsweja@gmail.com>, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-12-01 03:20+0100\n"
+"Last-Translator: Josef Andersson <josef.andersson@fripost.org>\n"
+"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 2.0.4\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Gör ingenting om angivet fjärrförråd existerar"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "PLATS specificerar en konfigurationsfil, inte förrådsplatsen"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Aktivera GPG-verifiering"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Markera fjärrförrådet som uppräkningsbart"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Markera fjärrförrådet med att det används för beroenden"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Ställ in en ny URL"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Aktivera fjärrförrådet"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Uppdatera extra metadata från sammanfattningsfilen"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Inaktivera GPG-verifiering"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Markera fjärrförrådet som icke uppräkningsbart"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Markera fjärrförrådet med att det inte används för beroenden"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Ställ in prioritet (standard är 1, högre är mer prioriterade)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "PRIORITET"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Ett enkelt namn att använda för detta fjärrförråd"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "TITEL"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Standardgren att använda för detta fjärrförråd"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "GREN"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "Samlings-ID"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "SAMLINGS-ID"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Importera GPG-nyckel från FIL (- för standard in)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "FIL"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Inaktivera fjärrförrådet"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Lägg till OCI-register"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr "Det går inte att läsa in uri %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Det går inte att läsa in filen %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr "Ogiltigt filformat"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Ogiltig version %s, endast 1 stöds"
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr "Ogiltig gpg-nyckel"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "NAMN PLATS - Lägg till ett fjärrförråd"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "NAMN måste anges"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "PLATS måste anges"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "För många argument"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "”%s” är inte ett giltigt samlings-ID: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "GPG-verifiering krävs om samlingar är aktiverat"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Fjärrförrådet %s existerar redan"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Ingen url angiven i flatpakrepo-fil"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Varning: Det gick inte att uppdatera extra metadata för ”%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "NAMN - Modifiera ett fjärrförråd"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Fjärrförråd-NAMN måste anges"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Uppdaterar extra metadata från sammanfattning av fjärrförråd för %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Fel vid uppdatering av extra metadata för ”%s”: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Det gick inte att uppdatera extra metadata för %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Exportera exekveringsmiljö istället för program"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Arkitektur att skapa bunt för"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "ARK"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "URL till arkiv"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Url för flatpakrepo-fil i exekveringsmiljö"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Lägg till GPG-nyckel från FIL (- för standard in)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Exportera oci-avbild istället för flatpak-bunt"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "GPG-nyckel-ID att signera OCI-avbilden med"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "NYCKEL-ID"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "GPG-hemkatalog att använda vid sökning efter nyckelringar"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "HEMKAT"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"PLATS FILNAMN NAMN [GREN] - Skapa en enstaka-fil-bunt från ett lokalt arkiv"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "PLATS, FILNAMN och NAMN måste anges"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "”%s” är inte ett giltigt arkiv"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "”%s” är inte ett giltigt namn: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "”%s” är inte ett giltigt grennamn: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Använd plattformsexekveringsmiljö snarare än SDK"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr "Skrivskydda destinationen"
+
+# sebras: how is this translated?
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Lägg till bindningsmontering"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "DEST=KÄLLA"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Starta bygge i denna katalog"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "KAT"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Var anpassad sdk-katalog ska eftersökas (standardvärdet är ”usr”)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Använd alternativ fil för metadata"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Döda processen när den överordnade processen dör"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Exportera programmets hemkatalog till bygge"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Logga sessionsbussanrop"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Logga systembussanrop"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "KATALOG [KOMMANDO [argument…]] - Bygg i katalog"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "KATALOG måste anges"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "Byggkatalog %s är inte initierad, använd flatpak build-init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "metadata ogiltigt, inte program eller exekveringsmiljö"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Ingen utökningspunkt matchar %s i %s"
+
+# sebras: how is this translated?
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Saknar ”=” i bindningsmonteringsargument ”%s”"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Kunde inte starta program"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Katalog för källarkiv"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "KÄLL-REPO"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Ref i källarkiv"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "KÄLL-REF"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Enradsämne"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "ÄMNE"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Fullständig beskrivning"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "TEXT"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Uppdatera appstream-grenen"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Uppdatera inte sammanfattningen"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "GPG-nyckel-ID att signera incheckning med"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"DST-ARKIV [DST-REF]… - Skapa en ny incheckning baserad på existerande "
+"incheckningar"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "DST-ARKIV måste anges"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr "Om --src-repo inte anges, måste exakt en destinationsref. anges"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr "Om --src-ref anges måste exakt en destinationsref. anges"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Antingen måste --src-repo eller --src-ref anges."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Kan inte checka in från en partiell källkodsincheckning."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr "%s: ingen förändring\n"
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Arkitektur att exportera till (måste vara värdkompatibel)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Checka in exekveringsmiljö (/usr), inte /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Använd alternativ katalog för filerna"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "UNDERKAT"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Filer att exkludera"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "MÖNSTER"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Exkluderade filer att inkludera"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Åsidosätt tidsstämpel för incheckningen"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ISO-8601-TIDSSTÄMPEL"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr "VARNING: Fel vid körning av desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr "VARNING: Fel vid läsning av desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "VARNING: Misslyckades med att validera desktop-filen %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr "VARNING: Det går inte att hitta Exec-nyckeln i %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr "VARNING: Binär inte funnen för Exec-rad i %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr "VARNING: Ikon matchar inte appid i %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr "VARNING: Ikon hänvisad till i desktop-fil men inte exporterad: %s\n"
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Ogiltig urityp %s, endast http/https stöds"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "Kunde inte hitta basnamn i %s, ange ett namn explicit"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Inga snedstreck tillåtna i namn för extra data"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Ogiltigt format för sha256-kontrollsumman: ”%s”"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Extra datastorlekar med noll i storlek stöds ej"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "PLATS KATALOG [GREN] - Skapa ett arkiv från en byggkatalog"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "PLATS och KATALOG måste anges"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Inget namn angivet i metadata"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr "Incheckning: %s\n"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Total metadata: %u\n"
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Skriven metadata: %u\n"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr "Totalt innehåll: %u\n"
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr "Skrivet innehåll: %u\n"
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr "Skrivna innehållsbyte:"
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Kommando att ställa in"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "KOMMANDO"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Flatpak-version att kräva"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "MAJOR.MINOR.MICRO"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Behandla inte exporter"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Extra datainfo"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Lägg till info om utökningspunkt"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "NAMN=VARIABEL[=VÄRDE]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr "Ställ in prioritet för tillägg (endast för tillägg)"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr "0"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Ändra vilken sdk som används för programmet"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Checka in exekveringsmiljö använd för programmet"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "EXEKVERINGSMILJÖ"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Ange alternativet generell metadata"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUPP=NYCKEL[=VÄRDE]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr "Exporterar inte %s, fel prefix\n"
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr "Exporterar %s\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr "Fler än en körbar fil funnen\n"
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr "Använder %s som ett kommando\n"
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr "Ingen körbar fil funnen\n"
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "För få element i --extra-data-argumentet %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"För få element i --metadata-argumentet %s, formatet är GRUPP=NYCKEL[=VÄRDE]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"För få element i --extension-argumentet %s, formatet är NAMN=VAR[=VÄRDE]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "KATALOG - Slutför en byggkatalog"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Byggkatalog %s är inte initierad"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Byggkatalog %s redan avslutad"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Granska de exporterade filerna och metadatan\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Åsidosätt ref:en som använts för den importerade bunten"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REF"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Importera oci-avbild istället för flatpak-bunt"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Ref ”%s” hittades inte i registret"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Flera bilder i registret, specificera en ref med --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Importerar %s (%s)\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "PLATS FILNAMN - Importera en filbunt in i ett lokalt arkiv"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "PLATS och FILNAMN måste anges"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Ark att använda"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Initiera var. från angiven exekveringsmiljö"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Initiera program från namngivet program"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "APP"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Ange version för --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "VERSION"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Inkludera detta grundtillägg"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "TILLÄGG"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Initiera /usr med en skrivbar kopia av SDK:n"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "Ange byggtypen (app, runtime, extension)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TYP"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Lägg till en tagg"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "TAGG"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Inkludera detta SDK-tillägg i /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Var SDK:n ska sparas (standardvärdet är ”usr”)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Återinitiera SDK/var"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Begärt tillägg %s är bara delvis installerat"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Begärt tillägg %s är inte installerat"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"KATALOG PROGNAMN SDK EXEKVERINGSMILJÖ [GREN] - Initiera katalog för bygge"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "EXEKVERINGSMILJÖ måste anges"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"”%s” är inte ett giltigt byggtypsnamn, använd app, runtime eller extension"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "”%s” är inte ett giltigt programnamn: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Byggkatalog %s är redan initierad"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Ark att installera för"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Leta efter exekveringsmiljö med angivet namn"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "PLATS [ID [GREN]] - Signera ett program eller en exekveringsmiljö"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Inga GPG-nyckel-ID angivna"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr "Lista konfigurationsnycklar och värden"
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr "Hämta konfiguration för NYCKEL"
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr "Sätt konfiguration för NYCKEL till VÄRDE"
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr "Ta bort konfiguration för NYCKEL"
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Okänd konfigurationsnyckel ”%s”"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr "Du måste ange nyckel"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr "Du måste ange både nyckel och värde"
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr "[NYCKEL [VÄRDE]] - Hantera konfiguration"
+
+# TODO: one on -> one of ?
+#: app/flatpak-builtins-config.c:223
+#, fuzzy
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr "Måste ange en av --list, --get, --set eller --unset"
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Ta bort fjärrförrådet även om det används"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "NAMN - Ta bort ett fjärrförråd"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Skapa en unik dokumentreferens"
+
+# sebras: is this a correct translation?
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Gör dokumentet förgängligt för den aktuella sessionen"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Kräv inte att filen redan existerar"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Ge programmet läsrättigheter"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Ge programmet skrivrättigheter"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Ge programmet rättigheter att ta bort"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Ge programmet rättigheter att ge ytterligare rättigheter"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Återkalla läsrättigheter för programmet"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Återkalla skrivrättigheter för programmet"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Återkalla borttagningsrättigheter för programmet"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Återkalla rättigheter för programmet att ge ytterligare rättigheter"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Lägg till rättigheter för detta program"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "PROGID"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "FIL - Exportera en fil till program"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "FIL måste anges"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "FIL - Hämta information om en exporterad fil"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Inte exporterad\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[PROGID] - Lista exporterade filer"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "FIL - Sluta exportera en fil till program"
+
+# sebras: is the sandbox translation correct?
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"SANDLÅDEPID [KOMMANDO [argument…]] - Kör ett kommando inuti en körande "
+"sandlåda"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "SANDLÅDEPID och KOMMANDO måste anges"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr "Kör inte som root, möjligt att det inte går att ange namnrymd"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Ogiltig pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Inget sådant pid %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Det går inte att läsa cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Det går inte att läsa root"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Ogiltig %s-namnrymd för pid %d"
+
+# sebras: self? really?!
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Ogiltig %s-namnrymd för själv"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "Kan inte öppna %s-namnrymd: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Kan inte gå in i %s-namnrymd: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Det går inte att köra chdir"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Det går inte att köra chroot"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Det går inte att byta gid"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Det går inte att byta uid"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Visa användarinstallationer"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Visa systeminstallationer"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Visa specifika systemomfattande installationer"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Visa ref"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Visa incheckning"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Visa ursprung"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Visa storlek"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Visa metadata"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Visa tillägg"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"NAMN [GREN] - Hämta information om installerat program och/eller "
+"exekveringsmiljö"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "ref fanns inte i källa"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Ref:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "ID:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Ark:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Gren:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Origin:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr "Datum:"
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr "Ämne:"
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Aktiv incheckning:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Senaste incheckning:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Incheckning:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "alt-id:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr "Överordnad:"
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Plats:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Installerad storlek:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Exekvering:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Installerade underkataloger:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Tillägg:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Undersökvägar:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr "Incheckning att visa information för"
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "INCHECKNING"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Sök efter program med det angivna namnet"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr "Visa logg"
+
+#: app/flatpak-builtins-info-remote.c:55
+msgid "Show parent"
+msgstr "Visa överordnad"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+" REMOTE REF - visa information om ett program eller en exekveringsmiljö i "
+"ett fjärrförråd"
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "FJÄRRFÖRRÅD och REF måste anges"
+
+#: app/flatpak-builtins-info-remote.c:201
+msgid "Download size:"
+msgstr "Hämtningsstorlek:"
+
+#: app/flatpak-builtins-info-remote.c:214
+#, fuzzy
+msgid "History:\n"
+msgstr "Historik:"
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr " Ämne:"
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr " Datum:"
+
+#: app/flatpak-builtins-info-remote.c:237
+msgid " Commit:"
+msgstr " Incheckning:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Hämta inte, installera endast från lokal cache"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Distribuera inte, hämta bara ner till lokal cache"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Installera inte relaterade ref:ar"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Installera ej/verifiera ej exekveringsberoenden"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Använd inte statiska delta"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Anta att PLATS är en enfils .flatpak-bunt"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Anta att PLATS är en programbeskrivning av typen .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr "Kontrollera buntsignaturer med GPG-nyckel från FIL (- för standard in)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Installera endast denna underkatalog"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "SÖKVÄG"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Svara automatiskt ja på alla frågor"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s incheckning %s redan installerat"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Detta program är beroende av exekveringsmiljöer från:\n"
+" %s\n"
+"Konfigurera det som ett nytt fjärrförråd ”%s”"
+
+# sebras: how to translate in here?
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Konfigurerar %s som ett nytt fjärrförråd ”%s”"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Buntfilnamn måste anges"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Fjärrbuntar stöds ej"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"Fjärrförråd ”%s” på plats %s innehåller ytterligare program.\n"
+"Vill du behålla fjärrförrådet för framtida installationer?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Filnamn eller uri måste anges"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Installerar: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "PLATS/FJÄRRFÖRRÅD [REF…] - Installera program eller exekveringsmiljöer"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Visa extra information"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Lista installerade exekveringsmiljöer"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Lista installera program"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Ark att visa"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Lista alla referenser (inklusive locale/debug)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Ref"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Origin"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Aktiv incheckning"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Senaste incheckning"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Installerad storlek"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Flaggor"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Lista installerade program och/eller exekveringsmiljöer"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Visa detaljer för fjärrförrådet"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Visa inaktiverade fjärrförråd"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Lista fjärrförråd"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Namn"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Titel"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Prioritet"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Visa arkitekturer och grenar"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Visa endast exekveringsmiljöer"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Visa endast program"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Visa endast de där uppdateringar finns tillgängliga"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Begränsa till denna ark (* för alla)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " [FJÄRRFÖRRÅD] - Visa tillgängliga exekveringsmiljöer och program"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Incheckning"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Hämtningsstorlek"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "Ingen ref-information tillgänglig i arkiv"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Ark att göra aktuell för"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "PROG GREN - Gör gren av program aktuell"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "PROG måste anges"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "GREN måste anges"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Program %s gren %s är inte installerad"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "PROG - Åsidosätt inställningar för program"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr "Titel: %s\n"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr "Samlings-ID: %s\n"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr "Standardgren: %s\n"
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr "Omflyttnings-URL: %s\n"
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "Dirigera om samlings-ID: %s\n"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr "GPG-nyckelhash: %s\n"
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr "%zd grenar\n"
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Installerad"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Hämta"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Skriv ut allmän information om arkivet"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Lista grenar i arkivet"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Skriv ut metadata för en gren"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "PLATS - underhåll av arkiv"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Omdirigera detta arkiv till en ny URL"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Ett enkelt namn att använda för detta förråd"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Standardgren att använda för detta förråd"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr "Distribuera permanent samlings-ID till fjärrklienters konfigurationer"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Importera ny öppen GPG-standardnyckel från FIL"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "GPG-nyckel-ID att signera sammanfattningen med"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Generera deltafiler"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Ta bort oanvända objekt"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Gå endast DJUP föräldrar upp för varje incheckning (standard: -1=oändligt)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "DJUP"
+
+# sebras: from-empty? why is there a dash?
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Genererar delta: %s (%.10s)\n"
+
+# sebras: from-empty? why is there a dash?
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Genererar delta: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Misslyckades med att generera delta %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Misslyckades med att generera delta %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "PLATS - Uppdatera förrådsmetadata"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Uppdaterar appstream-gren\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Uppdaterar sammanfattning\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Totalt antal objekt: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Inga onåbara objekt\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Tog bort %u objekt, %s frigjort\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Kommando att köra"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Gren att använda"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Använd utvecklingsexekveringsmiljö"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Exekveringsmiljö att använda"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Version av exekveringsmiljö att använda"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Logga hjälpmedelsbussanrop"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Aktivera filvidarebefordran"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "PROG [argument…] - Kör ett program"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr "TEXT - Sök i fjärrprogram/exekveringsmiljöer efter text"
+
+#: app/flatpak-builtins-search.c:220
+msgid "TEXT must be specified"
+msgstr "TEXT måste anges"
+
+#: app/flatpak-builtins-search.c:270
+msgid "Application ID"
+msgstr "Program-ID"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr "Version"
+
+#: app/flatpak-builtins-search.c:273
+msgid "Branch"
+msgstr "Gren"
+
+#: app/flatpak-builtins-search.c:275
+msgid "Remotes"
+msgstr "Fjärrförråd"
+
+#: app/flatpak-builtins-search.c:276
+msgid "Description"
+msgstr "Beskrivning"
+
+#: app/flatpak-builtins-search.c:285
+msgid "No matches found"
+msgstr "Inga träffar"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Ark att avinstallera"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Behåll ref i lokalt förråd"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Avinstallera inte relaterade ref:ar"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Ta bort filer även om de kör"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REF… - Avinstallera ett program"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Måste specificera åtminstone en REF"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Varning: Problem vid sökning efter relaterade ref:ar: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Avinstallerar: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Ark att uppdatera för"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Incheckning att distribuera"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Ta bort gamla filer även om de kör"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Hämta inte, uppdatera endast från lokal cach"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Uppdatera inte relaterade ref:ar"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Uppdatera appstream för fjärrförråd"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Uppdatera endast denna undersökväg"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Uppdatera appstream för fjärrförrådet %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Uppdatera appstream för fjärrförrådet %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr "Fel vid uppdatering: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, fuzzy, c-format
+msgid "Remote \"%s\" not found"
+msgstr "Data inte funnen"
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REF…]] - Uppdatera ett program eller exekveringsmiljö"
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr "Söker efter uppdateringar...\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Vilka vill du installera (0 för att avbryta)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Hantera installerade program och exekveringsmiljöer"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Installera ett program eller en exekveringsmiljö"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Uppdatera ett installerat program eller en exekveringsmiljö"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Avinstallera ett installerat program eller en exekveringsmiljö"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Lista installerade program och/eller exekveringsmiljöer"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Visa information för installerade program eller exekveringsmiljöer"
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr "Konfigurera flatpak"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr ""
+"\n"
+"Hitta program eller exekveringsmiljöer"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr "Sök efter fjärrprogram/exekveringsmiljöer"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Körande program"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Kör ett program"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Åsidosätt rättigheter för ett program"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Ange standardversion att köra"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Ange namnrymden för ett körande program"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Hantera filåtkomst"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Ge ett program tillgång till en specifik fil"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Återkalla tillgång till en specifik fil"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Visa information om en specifik fil"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Lista exporterade filer"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Hantera fjärrförråd"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Lista alla konfigurerade fjärrförråd"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Lägg till ett nytt fjärrförråd (efter URL)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Modifiera egenskaper för ett konfigurerat fjärrförråd"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Ta bort ett konfigurerat fjärrförråd"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Lista innehåll för ett konfigurerat fjärrförrådet"
+
+#: app/flatpak-main.c:96
+msgid "Show information about a remote app or runtime"
+msgstr "Visa information om ett fjärrprogram eller en exekveringsmiljö"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Bygg program"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Initiera en katalog för bygge"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Kör ett byggkommando inuti byggkatalogen"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Avsluta en byggkatalog för export"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Exportera en byggkatalog till ett förråd"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Skapa en buntfil från en byggkatalog"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Importera en buntfil"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Signera ett program eller en exekveringsmiljö"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Uppdatera sammanfattningsfilen i ett förråd"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Skapa ny incheckning baserad på existerande ref"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Skriv ut information om ett arkiv"
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+"Skriv ut felsökningsinformation under kommandohantering, -vv för ytterligare "
+"detaljer"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Skriv ut OSTree-felsökningsinformation under kommandohantering"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Visa hjälpalternativ"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Skriv ut versionsinformation och avsluta"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Skriv ut standardarkitektur och avsluta"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Skriv ut arkitekturer som stöds och avsluta"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Skriv ut aktiva gl-drivrutiner och avsluta"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Arbeta på användarinstallationer"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Arbeta på systeminstallationer (standard)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Arbeta på en specifik systemomfattande installation"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "NAMN"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Inbyggda kommandon:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Okänt kommando ”%s”"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Inget kommando angivet"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "fel:"
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr "Hittad i fjärrförråd %s\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Hittades i fjärrförrådet %s, vill du installera den?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Hittades i flera fjärrförråd;\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Vilka vill du installera (0 för att avbryta)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Krävd exekveringsmiljö för %s (%s) inte installerad, söker…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Den krävda exekveringsmiljön %s hittades inte i konfigurerat fjärrförråd.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s inte installerad"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Fjärrförråd %s inaktiverat, ignorerar %s uppdatering"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s redan installerad, ignorerar\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s incheckning %s redan installerat"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr "Varning: Det går inte att finna beroenden: %s\n"
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr "Ogiltigt argument för require-flatpak %s\n"
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s behöver en senare flatpak-version (%s)"
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Fel vid uppdatering av fjärrmetadata för ”%s”: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "installera"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Installerar: %s från %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Installerar: %s från %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "uppdatera"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Uppdaterar: %s från %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Uppdaterar: %s från %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Nu på %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Inga uppdateringar.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "installera bunt"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Installerar: %s från bunten %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Installerar: %s från bunten %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Varning: Misslyckades med %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Fel: Misslyckades med %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "En eller flera åtgärder misslyckades"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Inga åsidosättningar funna för %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Medan förråd %s öppnas: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Kan inte skapa distributionskatalog"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Ogiltig sha256 för extra data-uri %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Tomt namn för extra data-uri %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Extra data-uri som ej stöds %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Misslyckades med att läsa lokala extra data %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Fel storlek för extra data %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Medan %s hämtas: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Fel storlek för extra data %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Ogiltig kontrollsumma för extra data %s"
+
+#: common/flatpak-dir.c:2742
+msgid "Remote OCI index has no registry uri"
+msgstr "OCI-index för fjärrförråd har ingen register-uri"
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s incheckning %s redan installerat"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Medan %s hämtas från fjärrförrådet %s: "
+
+# sebras: how to translate in here?
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Kan inte hitta %s i fjärrförrådet %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Inte tillräckligt med minne"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Misslyckades med att läsa från exporterad fil"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Fel vid läsning av xml-fil för mimetyp"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Ogiltig xml-fil för mimetyp"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Under hämtning av frånkopplad metadata: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Under tiden extrakatalog skapas: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Ogiltigt sha256 för extradata"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Fel storlek för extra data"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Ogiltig kontrollsumma för extra data"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Fel vid skrivning av extra data-filen ”%s”: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "misslyckades med skriptet apply_extra, avslutningsstatus %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Under upplösningsförsök för ref %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s är inte tillgängligt"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s gren %s redan installerat"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Misslyckades läsa incheckning %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Medan utcheckningsförsök av %s i %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Under utcheckningsförsök av metadataundersökväg: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Under försök att ta bort extra existerande katalog: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Under försök att tillämpa extra data: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Ogiltig distribuerad ref %s: "
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Ogiltig incheckningsref %s: "
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Distribuerad ref %s matchar inte incheckning (%s)"
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Distribuerad ref %s matchar inte incheckning (%s)"
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "Ark för distribuerad ref %s matchar inte incheckning (%s)"
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Distribuerad ref %s-gren matchar inte incheckning (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Distribuerad ref %s matchar inte incheckning (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Distribuerad metadata matchar inte incheckning"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Denna version av %s är redan installerad"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Kan inte ändra fjärrförråd under buntinstallering"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s gren %s är inte installerad"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s gren %s inte installerad"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr "Rensning av förråd misslyckades: %s"
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr "Flera grenar tillgängliga för %s, du måste ange en av: "
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Ingenting matchar %s"
+
+# sebras: how to translate in here?
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Det går inte att hitta ref %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Fel vid sökning av fjärrförråd %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Fel vid sökning i lokalt förråd: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s inte installerad"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Kunde inte hitta installationen %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Exekveringsmiljö %s, gren %s är redan installerad"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Program %s, gren %s är redan installerad"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Titel för fjärrförråd inte angett"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Standardfjärrgren inte inställd"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Ingen flatpak-cache i fjärrförrådets sammanfattning"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Ingen post för %s i sammanfattningen av fjärrförrådets flatpak-cache "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Okänd delningstyp %s, giltiga typer är: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Okänd policytyp %s, giltiga typer är: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Ogiltigt dbusnamn %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Okänd uttagstyp %s, giltiga typer är %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Okänd enhetstyp %s, giltiga typer är: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Okänd funktionstyp %s, giltiga typer är: %s"
+
+# sebras: can host and home be translated?
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Okänd filsystemsplats %s, giltiga platser är: host, home, xdg-*[/…], ~/kat, /"
+"kat"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Ogiltigt miljöformat %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Dela med värd"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "DELA"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Avsluta delning med värd"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Exponera uttag för program"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "UTTAG"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Exponera inte detta uttag för program"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Exponera enhet för program"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "ENHET"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Exponera inte enhet till program"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Tillåt funktion"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "FUNKTION"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Tillåt inte funktion"
+
+# sebras: can ro be translated?
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Exponera filsystem för program (:ro för skrivskyddat)"
+
+# sebras: can ro be translated?
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "FILSYSTEM[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Exponera inte filsystem för program"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "FILSYSTEM"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Ställ in miljövariabel"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "VAR=VÄRDE"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Tillåt program att äga namn på sessionsbussen"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "DBUSNAMN"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Tillåt program att prata med namn på sessionsbussen"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Tillåt program att äga namn på systembussen"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Tillåt program att prata med namn på systembussen"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Lägg till alternativ för generell policy"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "SUBSYSTEM.KEY=VALUE"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Ta bort alternativet för generell policy"
+
+# sebras: persist or persistant?
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Beständig hemkatalog"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "FILNAMN"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Kräv inte en körande session (inget cgroups-skapande)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Misslyckades med att öppna temporär flatpak-info-fil: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Misslyckades med att öppna temporärfil: %s"
+
+# sebras: sync?
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Kan inte skapa sync-rör"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Misslyckades med att öppna prog-info-fil: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Misslyckades med att synkronisera med dbus-proxy"
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "misslyckades med ldconfig, avslutningsstatus %d"
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Migrerar %s till %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr "Fel vid migrering: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Inga extra data-källor"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr "Hämtar ned metadata: %u/(beräknad) %s"
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr "Hämtar: %s/%s"
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Hämtar extra data: %s/%s"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Hämtar filer: %d/%d %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Installera signerat program"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Autentisering krävs för att installera program"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Installera signerad exekveringsmiljö"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Uppdatera signerat program"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Autentisering krävs för att uppdatera program"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Uppdatera signerad exekveringsmiljö"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Uppdatera fjärrförrådmetadata"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Autentisering krävs för att uppdatera fjärrförrådsinfo"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr "Uppdaterar systemförråd"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr "Autentisering krävs för att uppdatera systemförrådet"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Installera bunt"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Avinstallera exekveringsmiljö"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Autentisering krävs för att avinstallera program"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Avinstallera program"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Konfigurera fjärrförråd"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Autentisering krävs för att konfigurera programförråd"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr "Konfigurera"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr "Autentisering krävs för att konfigurera programinstallationen"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Uppdatera appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Inget fjärrförråd %s"
+
+#~ msgid "Search only user installations"
+#~ msgstr "Sök endast användarinstallationer"
+
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Sök endast systeminstallationer"
+
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Sök endast specifika systemomfattande installationer"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Misslyckades med att skapa temporärfil"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Misslyckades med att avlänka temporärfil"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Misslyckades med att skriva till temporärfil"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Installerar: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Installerar: %s\n"
+
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "OCI-förråd eller filnamn måste anges"
+
+#~ msgid "OCI image is not a flatpak (missing ref)"
+#~ msgstr "OCI-avbild är inte en flatpak (saknar ref)"
+
+#~ msgid "OCI image specifies the wrong app id"
+#~ msgstr "OCI-avbild specificerar fel app-id"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "”%s” är inte ett giltigt exekveringsmiljönamn: %s"
+
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "”%s” är inte ett giltigt SDK-namn: %s"
+
+#~ msgid "Data not found for ref %s"
+#~ msgstr "Data inte funnen för ref %s"
+
+#~ msgid "Install from local bundle file"
+#~ msgstr "Installera från lokal paketfil"
+
+#, fuzzy
+#~ msgid "Load options from file or uri"
+#~ msgstr "Läs in inställningar från fil"
+
+#, fuzzy
+#~ msgid "Invalid ref, no digest"
+#~ msgstr "Ogiltigt miljöformat %s"
+
+#, fuzzy
+#~ msgid "No manfest found for arch %s, os %s"
+#~ msgstr "Data inte funnen för ref %s"
+
+#, fuzzy
+#~ msgid "Remote extra metadata not available; server has no summary file"
+#~ msgstr "Fjärrtitel inte tillgänglig; servern har ingen sammanfattningsfil"
+
+#~ msgid "Data not available; server has no summary file"
+#~ msgstr "Data inte tillgänglig; servern har ingen sammanfattningsfil"
+
+#~ msgid "This version of ostree is to old to support OCI exports"
+#~ msgstr ""
+#~ "Denna version av ostree är för gammal för att ha stöd för OCI-exporter"
+
+#~ msgid "This version of flatpak is not compiled with libarchive support"
+#~ msgstr "Denna version av flatpak är inte kompilerad med libarchive-stöd"
+
+#~ msgid "REPOSITORY and NAME must be specified"
+#~ msgstr "ARKIV och NAMN måste anges"
+
+#~ msgid "Uninstalling related: %s\n"
+#~ msgstr "Avinstallerar relaterade: %s\n"
+
+#~ msgid "Warning: Failed to uninstall related ref: %s\n"
+#~ msgstr "Varning: Misslyckades med att installera relaterad ref: %s\n"
+
+#~ msgid "Updating application %s, branch %s\n"
+#~ msgstr "Uppdaterar program %s, gren %s\n"
+
+#~ msgid "Updating runtime %s, branch %s\n"
+#~ msgstr "Uppdaterar exekveringsmiljö %s, gren %s\n"
+
+#~ msgid "While pulling %s from remote %s, metadata: "
+#~ msgstr "Medan %s hämtas från fjärr %s, metadata: "
+
+#~ msgid "While pulling %s from remote %s, subpath %s: "
+#~ msgstr "Medan %s hämtas från fjärr %s, undersökväg %s: "
+
+#~ msgid "The Flatpak Project"
+#~ msgstr "Flatpak-projektet"
+
+#~ msgid "https://cgit.freedesktop.org/xdg-app/xdg-app/"
+#~ msgstr "https://cgit.freedesktop.org/xdg-app/xdg-app/"
+
+#~ msgid "package-x-generic"
+#~ msgstr "package-x-generic"
+
+#~ msgid "auth_admin"
+#~ msgstr "auth_admin"
+
+#~ msgid "auth_admin_keep"
+#~ msgstr "auth_admin_keep"
+
+#~ msgid "yes"
+#~ msgstr "yes"
+
+# sebras: https://github.com/flatpak/flatpak/pull/308
+#~ msgid "Authentication is install software"
+#~ msgstr "Autentisering är installera program"
+
+#~ msgid "LOCATION ID [BRANCH] - Create a repository from a build directory"
+#~ msgstr "PLATS ID [ GREN] - Skapa ett arkiv från en byggkatalog"
+
+#~ msgid ""
+#~ "Warning: Can't find appstream-builder, unable to update appstream branch\n"
+#~ msgstr ""
+#~ "Varning: Kan inte hitta appstream-builder, kan inte uppdatera appstream-"
+#~ "gren\n"
+
+#~ msgid "Generating from-parent delta for %s (%s)\n"
+#~ msgstr "Genererar från-förälder-delta för %s (%s)\n"
diff --git a/po/tr.gmo b/po/tr.gmo
new file mode 100644 (file)
index 0000000..53aada6
Binary files /dev/null and b/po/tr.gmo differ
diff --git a/po/tr.po b/po/tr.po
new file mode 100644 (file)
index 0000000..e56ffcc
--- /dev/null
+++ b/po/tr.po
@@ -0,0 +1,2883 @@
+# Turkish translation for flatpak.
+# Copyright (C) 2017 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+# Çağatay Yiğit Şahin <cyigitsahin@outlook.com>, 2017.
+# Muhammet Kara <muhammetk@gmail.com>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-05-20 08:19+0300\n"
+"Last-Translator: Muhammet Kara <muhammetk@gmail.com>\n"
+"Language-Team: Türkçe <gnome-turk@gnome.org>\n"
+"Language: tr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Gtranslator 2.91.7\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Sağlanan uzak varsa hiçbir şey yapma"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "KONUM bir yapılandırma dosyasını belirtir, bir arşiv konumunu değil"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "GPG doğrulamayı etkinleştir"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Uzağı belirtilmiş olarak işaretle"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr "Uzağı bağımlılık için olarak işaretle"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Yeni bir url belirle"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "URL"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Uzağı etkinleştir"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Özet dosyasından ek üst veri güncelle"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "GPG doğrulamayı devredışı bırak"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Uzağı belirtilmemiş olarak işaretle"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr "Uzağı bağımlılık için olarak işaretleme"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr "Öncelik belirle (öntanımlı 1, yüksek sayı daha öncelikli)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "ÖNCELİK"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Bu uzak için kullanılacak güzel bir isim"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "BAŞLIK"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Bu uzak için kullanılacak varsayılan dal"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "DAL"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "DOSYA'dan GPG anahtarı içe aktar (stdin için -)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "DOSYA"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Uzağı devredışı bırak"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "OCI sicili ekle"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-add-remote.c:233
+#, fuzzy, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "%s ad alanı açılamadı: %s"
+
+#: app/flatpak-builtins-add-remote.c:241
+#, fuzzy
+msgid "Invalid file format"
+msgstr "Geçersiz env formatı %s"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, fuzzy, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Geçersiz uri tipi %s, sadece http/https destekli"
+
+#: app/flatpak-builtins-add-remote.c:293
+#, fuzzy
+msgid "Invalid gpg key"
+msgstr "Geçersiz pid %s"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "İSİM KONUM - Uzak bir arşiv ekle"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "İSİM belirtilmelidir"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "KONUM belirtilmelidir"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Çok fazla argüman"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, fuzzy, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "'%s' geçerli bir uygulama ismi değil: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr ""
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "%s uzağı zaten var"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "Flatpakrepo dosyasında url belirtilmemiş"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, fuzzy, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "%s için ek üst veri güncellenemedi"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "İSİM - Uzak arşivi düzenle"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Uzak İSİM belirtilmelidir"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "%s için uzak özetinden ek üst veri güncelleniyor\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "'%s' için ek üst veri güncellenirken hata: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "%s için ek üst veri güncellenemedi"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Uygulama yerine çalışma ortamı dışa aktar"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Paketleneceği mimari"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "MİMARİ"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Arşiv için url"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Çalışma ortamı flatpakrepo dosyası için url"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "DOSYA'dan GPG anahtarı ekle (stdin için -)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Flatpak paketi yerine oci görüntüsü dışa aktar"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "OCI görüntüsünün imzalanacağı GPG Anahtar Kimliği"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ANAHTAR-KİMLİK"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Anahtarlık aramak için GPG Evdizini"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "EVDİZİN"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr "KONUM DOSYAADI İSİM [DAL] - Yerel arşivden bir tek dosya paket oluştur"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "KONUM, DOSYAADI ve İSİM belirtilmelidir"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "'%s' geçerli bir arşiv değil"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "'%s' geçerli bir isim değil: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "'%s' geçerli bir dal ismi değil: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Sdk'dansa Platform çalışma ortamını kullan"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Bağlama noktası ekle"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "HEDEF=KAYNAK"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "İnşaya bu dizinde başla"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "DİZİN"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr ""
+"Özel yazılım geliştirme kiti dizini için bakılacak yer ('usr'ye öntanımlar)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Üst veri için alternatif dosya kullan"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Oturum veri yolu çağrılarını günlükle"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Sistem veri yolu çağrılarını günlükle"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "DİZİN [KOMUT [arg...]] - Dizinde inşa et"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "DİZİN belirtilmelidir"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr "İnşa dizini %s ilklenmedi, flatpak build-init'i kullanın"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "Üst veriye geçersiz, uygulama veya çalışma ortamı değil"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "%s'e uyan eklenti noktası %s'te yok"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Bağlama noktası seçeneği '%s'te eksik '='"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Uygulama başlatılamadı"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Kaynak arşiv dizini"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "KAYNAK-ARŞİV"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Kaynak arşiv referansı"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "KAYNAK-REFERANS"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Tek satır konu"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "KONU"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Tam açıklama"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "GÖVDE"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Appstream dalını güncelle"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Özeti güncelleme"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "Değişikliği imzalamak için GPG Anahtar Kimliği"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr ""
+"HEDEF-ARŞİV [HEDEF-REFERANS]... - Varolan değişikliklere dayalı yeni bir "
+"değişiklik yap"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "HEDEF-ARŞİV belirtilmelidir"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"--src-repo belirtilmemişse sadece tek bir hedef referansı belirtilmelidir"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr "--src-ref belirtilmişse, sadece tek bir hedef referans belirtilmelidir"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Ya --src-repo ya da --src-ref belirtilmelidir."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Kısmi kaynak değişikliğinden değişiklik yapılamaz"
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Dışa aktarılacağı mimari (makinayla uyumlu olmalıdır)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Çalışma ortamını (/usr) değiştir, /app'i değil"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Dosyalar için alternatif dizin kullan"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "ALTDİZİN"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Hariç tutulacak dosyalar"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "KALIP"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Dahil edilecek hariç tutulmuş dosyalar"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:355
+#, fuzzy, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "Geçici dosya açılamadı: %s"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Geçersiz uri tipi %s, sadece http/https destekli"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "%s'te temel isim bulunamadı, bir isim belirtin"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "Ek veri isminde yan çizgi kullanılamaz"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "sha256 sağlama toplamı için geçersiz format: '%s'"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Sıfır ek veri boyutu desteklenmemektedir"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr "KONUM DİZİN [DAL] - İnşa dizininden yeni arşiv oluştur"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "KONUM ve DİZİN belirtilmelidir"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "Üst veride isim belirtilmemiş"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:977
+#, fuzzy, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Üst veri:"
+
+#: app/flatpak-builtins-build-export.c:978
+#, fuzzy, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Üst veri:"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Belirlenecek komut"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "KOMUT"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Gerektirilecek Flatpak sürümü"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "BÜYÜK.KÜÇÜK.MİNİK"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Dışa aktarmaları işleme"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Ek veri bilgisi"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Eklenti noktası bilgisi ekle"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "İSİM=DEĞİŞKEN[=DEĞER]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Uygulama için kullanılan yazılım geliştirme kitini değiştir"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "YGK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Uygulama için kullanılan çalışma ortamını değiştir"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "ÇALIŞMAORTAMI"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Genel üst veri seçeneğini belirle"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "GRUP=ANAHTAR[=DEĞER]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:143
+#, fuzzy, c-format
+msgid "Exporting %s\n"
+msgstr "Özet güncelleniyor\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr ""
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "--extra-data argümanı %s'te çok az eleman "
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"--extension argümanı %s'te çok az öge, format GRUP=ANAHTAR[=DEĞER] olmalıdır"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"--extension argümanı %s'te çok az argüman, format İSİM=DEĞİŞKEN[=DEĞER] "
+"olmalıdır"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "DİZİN - İnşa dizinini sonlandır"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "İnşa dizini %s ilklendirilmemiş"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "İnşa dizini %s zaten sonlandırılmış"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Lütfen dışa aktarılmış dosyaları ve üst veriyi gözden geçirin\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "İçe aktarılan paket için kullanılan referansın üstüne yaz"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "REFERANS"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Flatpak paketi yerine oci görüntüsü içe aktar"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Referans '%s' sicilde bulunamadı"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "Sicilde birden fazla görüntü, --ref'le bir referans belirtin"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, fuzzy, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Güncelleniyor: %2$s'ten %1$s\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr "KONUM DOSYAADI - Bir yerel arşive dosya paketi içe aktar"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "KONUM ve DOSYAADI belirtilmelidir"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Kullanılacak mimari"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "var'ı adlandırılmış çalışma ortamından ilklendir"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Uygulamaları adlandırılmış uygulamadan ilklendir"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "UYGULAMA"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "--base için sürüm belirt"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "SÜRÜM"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Temel eklentisini dahil et"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "EKLENTİ"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr ""
+"/usr'yi yazılım geliştirme kitinin yazılabilir bir kopyasıyla ilklendir"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr "İnşa tipini belirt (uygulama, çalışma ortamı, eklenti)"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "TİP"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Etiket ekle"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "ETİKET"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Bu yazılım geliştirme kiti eklentisini /usr'ye dahil et"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Yazılım geliştirme kitinin saklanacağı yer ('usr'ye öntanımlar)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Sdk/var'ı yeniden ilklendir"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Talep edilen eklenti %s sadece kısmi olarak yüklenmiş"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Talep edilen eklenti %s yüklü değil"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"DİZİN UYGULAMAADI YGK ÇALIŞMAORTAMI [DAL] - Bir dizini inşa için ilklendir"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "ÇALIŞMAORTAMI belirtilmelidir"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"'%s' geçerli bir inşa tipi ismi değil, uygulama, çalışma ortamı veya "
+"eklentiyi kullanın"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "'%s' geçerli bir uygulama ismi değil: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "İnşa dizini %s zaten ilklendirilmiş"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Yükleneceği mimari"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Belirtilmiş isimle çalışma ortamı ara"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr "KONUM [KİMLİK [DAL]] - Bir uygulamayı veya çalışma ortamını imzala"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Gpg anahtar kimliği belirtilmemiş"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:95
+#, fuzzy, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Bilinmeyen komut '%s'"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+#, fuzzy
+msgid "You must specify key"
+msgstr "UYGULAMA belirtilmelidir"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr ""
+
+#: app/flatpak-builtins-config.c:223
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Uzağı kullanılıyor olsa da kaldır"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "İSİM - Bir uzak arşivi sil"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Bir eşsiz belge referansı oluştur"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Belgeyi mevcut oturum için geçici yap"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Belgenin zaten varolmasını gerektirme"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Uygulamaya okuma izinleri ver"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Uygulamaya yazma izinleri ver"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Uygulamaya silme izinleri ver"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Uygulamaya daha fazla izin tanıma izinleri ver"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Uygulamanın okuma izinlerini geri çek"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Uygulamanın yazma izinlerini geri çek"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Uygulamanın silme izinlerini geri çek"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr "Uygulamanın daha fazla izin tanıma izinlerini geri çek"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Bu uygulama için izinler ekle"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "UYGULAMAKİMLİĞİ"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "DOSYA - Bir dosyayı uygulamalara dışa aktar"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "DOSYA belirtilmelidir"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "DOSYA - Dışa aktarılmış bir belgeyle ilgili bilgi al"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Dışa aktarılmamış\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[UYGULAMAKİMLİĞİ] - Dışa aktarılmış dosyaları listele"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "DOSYA - Bir dosyayı uygulamalardan geri çek"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr "İZOLEPID [KOMUT [arg...]] - İşleyen bir izole ortamda komut çalıştır"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "İZOLEPID ve KOMUT belirtilmelidir"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr ""
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Geçersiz pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "%s diye bir pid yok"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "cwd okunamadı"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "root okunamadı"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Pid %2$d için geçersiz %1$s ad alanı"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Kendi için geçersiz %s ad alanı"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "%s ad alanı açılamadı: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "%s ad alanına girilemedi: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "chdir yapılamadı"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "chroot yapılamadı"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "gid değiştirilemedi"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "uid değiştirilemedi"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Kullanıcı yüklemelerini göster"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Sistem-geneli yüklemeleri göster"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Belirli sistem-geneli yüklemeleri göster"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Referansı göster"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Değişikliği göster"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Kökeni göster"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Boyut göster"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Üst veri göster"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Eklentileri göster"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"İSİM [DAL] - Yüklü uygulamalar ve/veya çalışma ortamları hakkında bilgi edin"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Dal:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Yüklü boyut:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Çalışma zamanı:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Uzantı:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "DEĞİŞİKLİK"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Belirtilmiş isimle uygulama ara"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Referansı göster"
+
+#: app/flatpak-builtins-info-remote.c:121
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "UZAK ve REFERANS belirtilmelidir"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "İndirme boyutu"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Değişikliği göster"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Çekme, sadece yerel önbellekten yükle"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Dağıtma, sadece yerel önbelleğe indir"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "İlişkili referansları yükleme"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Çalışma ortamı bağımlılıklarını doğrulama/yükleme"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Dural deltaları kullanma"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "KONUM'un bir .flatpak tek dosya paketi olduğunu varsay"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "KONUM'un bir .flatpakref uygulama açıklaması olduğunu varsay"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr "Paket imzalarını DOSYA'daki (stdin için -) GPG anahtarıyla kontrol et"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Sadece bu alt yolunu yükle "
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "VERİYOLU"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Tüm soruları otomatik olarak evetle cevapla"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s değişikliği %s zaten yüklü"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Uygulama şuradan çalışma ortamlarına bağımlı:\n"
+"  %s\n"
+"Bunu yeni uzak '%s' olarak yapılandır"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "%s yeni uzak %s olarak yapılandırılıyor"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Paket dosya adı belirtilmelidir"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Uzak paketler desteklenmemektedir"
+
+#: app/flatpak-builtins-install.c:338
+#, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Dosya adı veya uri belirtilmelidir"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Yükleniyor: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "KONUM/UZAK [REFERANS...] - Uygulamalar veya çalışma ortamları yükle"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Ek bilgi göster"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Yüklü çalışma ortamlarını listele"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Yüklü uygulamaları listele"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Gösterilecek mimari"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Referans"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Yüklü boyut"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr ""
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Yüklü uygulamaları ve/veya çalışma ortamlarını listele"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Uzak detaylarını göster"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Devredışı bırakılmış uzakları göster"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Uzak arşivleri listele"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr ""
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Mimarileri ve dalları göster"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Sadece çalışma ortamlarını göster"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Sadece uygulamaları göster"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Sadece güncellemeleri olanları göster"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Bu mimariyle kısıtla (hepsi için *)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " UZAK - Kullanılabilir çalışma ortamlarını ve uygulamaları listele"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr ""
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "İndirme boyutu"
+
+#: app/flatpak-builtins-ls-remote.c:301
+#, fuzzy
+msgid "No ref information available in repository"
+msgstr "Arşiv hakkında genel bilgileri yazdır"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Mevcutun yapılacağı mimariler"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "UYGULAMA DAL - Uygulamanın dalını mevcut yap"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "UYGULAMA belirtilmelidir"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "DAL belirtilmelidir"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Uygulama %s dal %s yüklenmemiş"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "UYGULAMA - Uygulama için ayarları geçersiz kıl"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr ""
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Yüklü"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "İndir"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Arşiv hakkında genel bilgileri yazdır"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Arşivdeki dalları listele"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Dal için üst veriyi yazdır"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "KONUM - Arşiv bakım"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Bu arşiv için kullanılacak güzel bir ad"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Bu arşiv için kullanılacak öntanımlı dal"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr ""
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "Özetin imzalanacağı GPG anahtar kimliği"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Delta dosyaları oluştur"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Kullanılmayan nesneleri kes"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Her değişiklik için sadece DERİNLİK ebeveynlerini çaprazla (öntanımlı: "
+"-1=infinite)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "DERİNLİK"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Delta oluşturuluyor: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Delta oluşturuluyor: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "%s delta oluşturulamadı (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "%s delta oluşturulamadı (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "KONUM - Arşiv üst verisini güncelle"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Appstream dalı güncelleniyor\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Özet güncelleniyor\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Toplam nesneler: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Ulaşılamayan nesne yok\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "%u nesne silindi, %s temizlendi\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Çalıştırılacak komut"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Kullanılacak dal"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Geliştirme çalışma ortamı kullan"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Kullanılacak çalışma ortamı"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Kullanılacak çalışma ortamı sürümü"
+
+#: app/flatpak-builtins-run.c:60
+#, fuzzy
+msgid "Log accessibility bus calls"
+msgstr "Oturum veri yolu çağrılarını günlükle"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr ""
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "UYGULAMA [arg...] - Bir uygulamayı çalıştır"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "UZAK belirtilmelidir"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Bir uygulama çalıştır"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Dal:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "%s uzak yok"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Tam açıklama"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "%s için eşleşme yok"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Silinecek mimari"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Referansı yerel arşivde sakla"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "İlişkili referansları sil"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Dosyaları çalışıyor olsalar da kaldır"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "REFERANS... - Bir uygulamayı sil"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "En az bir REFERANS belirtilmelidir"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Uyarı: İlişkili referansları ararken sorun: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Yükleniyor: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Güncelleneceği mimari"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Dağıtılacak değişiklik"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Eski dosyaları çalışıyor olsalar da kaldır"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Çekme, sadece yerel önbellekten güncelle"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "İlişkili referansları güncelleme"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Appstream'i uzak için güncelle"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Sadece bu alt yolu güncelle"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Appstream uzak %s için güncelleniyor\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Appstream uzak %s için güncelleniyor\n"
+
+#: app/flatpak-builtins-update.c:113
+#, fuzzy, c-format
+msgid "Error updating: %s\n"
+msgstr "Özet güncelleniyor\n"
+
+#: app/flatpak-builtins-update.c:143
+#, c-format
+msgid "Remote \"%s\" not found"
+msgstr ""
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[REFERANS...] - Uygulamaları veya çalışma ortamlarını güncelle"
+
+#: app/flatpak-builtins-update.c:196
+#, fuzzy
+msgid "Looking for updates...\n"
+msgstr "Güncelleme yok.\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Hangisini yüklemek istiyorsunuz (iptal etmek için 0)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Yüklü uygulamaları ve çalışma ortamlarını yönet"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Bir uygulama veya çalışma ortamı yükle"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Yüklü bir uygulamayı veya çalışma ortamını güncelle"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Yüklü bir uygulama veya çalışma ortamını kaldır"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Yüklü uygulama ve/veya çalışma ortamlarını listele"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr "Yüklü uygulama veya çalışma ortamı için bilgi göster"
+
+#: app/flatpak-main.c:68
+#, fuzzy
+msgid "Configure flatpak"
+msgstr "Uzak Yapılandır"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Bir uygulamayı veya çalışma ortamını imzala"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Çalışan uygulamalar"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Bir uygulama çalıştır"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Bir uygulama için izinleri geçersiz kıl"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Çalıştırılacak öntanımlı sürümü belirt"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Çalışan bir uygulamanın ad alanına gir"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+"Dosya erişimini yönet"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Bir uygulamaya belirli bir dosyaya erişim tanı"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Belirli bir dosyaya erişimi geri çek"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Belirli bir dosya hakkında bilgi göster"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Dışa aktarılmış dosyaları listele"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Uzak arşivleri yönet"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Tüm yapılandırılmış uzakları listele"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Yeni bir uzak arşiv ekle (URL'yle)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Yapılandırılmış bir uzağın niteliklerini düzenle"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Yapılandırılmış bir uzağı sil"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Yapılandırılmış bir uzağın içeriklerini listele"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr "Yüklü uygulama veya çalışma ortamı için bilgi göster"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Uygulamaları inşa et"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "İnşa için bir dizini ilklendir"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "İnşa dizininde bir inşa komutu çalıştır"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Bir inşa dizinini dışa aktarma için bitir"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Bir inşa dizinini bir arşive dışa aktar"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Bir inşa dizininden paket dosyası oluştur"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Bir paket dosyası içe aktar"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Bir uygulamayı veya çalışma ortamını imzala"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Bir arşivdeki özet dosyasını güncelle"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Var olan referansa dayalı yeni değişiklik yarat"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Bir arşiv hakkında bilgi yazdır"
+
+#: app/flatpak-main.c:126
+#, fuzzy
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr "Komut işleme sırasında hata ayıklama bilgisini yaz"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Komut işleme sırasında OSTree hata ayıklama bilgisini yaz"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Yardım seçeneklerini göster"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Sürüm bilgisini yaz ve çık"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Öntanımlı mimariyi yaz ve çık"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Desteklenen mimarileri yaz ve çık"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Etkin gl sürücülerini yazdır ve çık"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Kullanıcı yüklemeleri üzerinde çalış"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Sistem geneli yüklemeler üzerinde çalış (öntanımlı)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Belirli bir sistem geneli yükleme üzerinde çalış"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "İSİM"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Yerleşik Komutlar:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Bilinmeyen komut '%s'"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Komut belirtilmemiş"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "hata:"
+
+#: app/flatpak-transaction.c:313
+#, fuzzy, c-format
+msgid "Found in remote %s\n"
+msgstr "Birkaç farklı uzakta bulundu:\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Uzak %s'te bulundu, yüklemek ister misiniz?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Birkaç farklı uzakta bulundu:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Hangisini yüklemek istiyorsunuz (iptal etmek için 0)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "%s için gerekli çalışma ortamı (%s) yüklü değil, aranıyor...\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr "Gerekli çalışma ortamı %s yapılandırılmış uzaklarda bulunamadı.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s yüklü değil"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Uzak %s devredışı, %s güncellemesi yok sayılıyor"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s zaten yüklü, atlanıyor\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s değişikliği %s zaten yüklü"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr ""
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s daha üst bir flatpak versiyonu gerektiriyor (%s)"
+
+#: app/flatpak-transaction.c:688
+#, fuzzy, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "'%s' için ek üst veri güncellenirken hata: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "yükle"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Yükleniyor: %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Yükleniyor: %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "güncelle"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Güncelleniyor: %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Güncelleniyor: %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Şimdi %s'te\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Güncelleme yok.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "paket yükle"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Yükleniyor: paket %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Yükleniyor: paket %2$s'ten %1$s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Uyarı: %2$s'i %1$s başarılamadı: %3$s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Hata: %2$s'i %1$s başarılamadı: %3$s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Bir veya daha fazla seçenek başarılamadı"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "%s için geçersiz kılma bulunamadı"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Arşiv %s'i açarken:"
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Dağıtım dizini oluşturulamadı"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Ek veri uri'si %s için geçersiz sha256 "
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Ek veri uri'si %s için boş isim"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Desteklenmeyen ek veri uri'si %s"
+
+#: common/flatpak-dir.c:2647
+#, fuzzy, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Değişiklik %s okunamadı:"
+
+#: common/flatpak-dir.c:2650
+#, fuzzy, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Ek veri %s için yanlış boyut"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "%s indirilirken:"
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Ek veri %s için yanlış boyut"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Ek veri %s için geçeresiz sağlama toplamı"
+
+#: common/flatpak-dir.c:2742
+#, fuzzy
+msgid "Remote OCI index has no registry uri"
+msgstr "KONUM'un bir oci sicili olduğunu varsay "
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s değişikliği %s zaten yüklü"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Uzak %2$s'ten %1$s çekerken:"
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Uzak %2$s'te %1$s bulunamadı"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Yeterli bellek yok"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Dışa aktarılmış dosyadan okunamadı"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr ""
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Ayrık üst veri alınırken:"
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Ek dizin oluşturulurken:"
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Ek veri için geçersiz sha256"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Ek veri için yanlış boyut"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Ek veri için geçersiz sağlama toplamı"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Ek veri dosyası '%s' yazılırken:"
+
+#: common/flatpak-dir.c:5181
+#, fuzzy, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "apply_extra betiği başarısız oldu"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Referans %s çözülmeye çalışılırken:"
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s mevcut değil"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "%s dalı %s zaten yüklü"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Değişiklik %s okunamadı:"
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "%s'i %s'e geçirmeye çalışırken:"
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Üst veri alt dizini geçirilmeye çalışılırken:"
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Var olan ek dizini kaldırmaya çalışırken:"
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Ek veriyi uygulamaya çalışırken:"
+
+#: common/flatpak-dir.c:5433
+#, fuzzy, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Geçersiz pid %s"
+
+#: common/flatpak-dir.c:5440
+#, fuzzy, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Geçersiz pid %s"
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr ""
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr ""
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "%s'in bu sürümü zaten yüklü"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Paket yüklemesi sırasında uzak değiştirilemedi"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s dalı %s yüklü değil"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s dalı %s yüklü değil"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr ""
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "%s için eşleşme yok"
+
+#: common/flatpak-dir.c:8119
+#, fuzzy, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "%s%s%s%s%s uzak %s'te bulunamadı"
+
+#: common/flatpak-dir.c:8161
+#, fuzzy, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Hata: %2$s'i %1$s başarılamadı: %3$s\n"
+
+#: common/flatpak-dir.c:8206
+#, fuzzy, c-format
+msgid "Error searching local repository: %s"
+msgstr "Referansı yerel arşivde sakla"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "%s %s yüklü değil"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Yükleme %s bulunamadı"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Çalışma ortamı %s, dal %s zaten yüklü"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Uygulama %s, dal %s zaten yüklü"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Uzak başlığı ayarlı değil"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Uzak öntanımlı dalı ayarlı değil"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "Uzak özetinde flatpak önbelleği yok"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Uzak özeti flatpak önbelleğinde %s için girdi yok"
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Bilinmeyen paylaşım tipi %s, geçerli tipler: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Bilinmeyen ilke tipi %s, geçerli tipler: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Geçersiz dbus ismi %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Bilinmeyen soket tipi %s, geçerli tipler: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Bilinmeyen cihaz tiği %s, geçerli tipler: %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Bilinmeyen özellik tipi %s, geçerli tipler: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Bilinmeyen dosya sistemi konumu %s, geçerli konumlar: makina, home, xdg-"
+"*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Geçersiz env formatı %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Makinayla paylaş"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "PAYLAŞ"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Makinayla paylaşma"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Soketi uygulamaya göster"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "SOKET"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Soketi uygulamaya gösterme"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Cihazı uygulamaya göster"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "CİHAZ"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Cihazı uygulamaya gösterme"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Özelliğe izin ver"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "ÖZELLİK"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Özelliğe izin verme"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Dosya sistemini uygulamaya göster (salt-okuma için :ro)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "DOSYASİSTEMİ[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Dosya sistemini uygulamaya gösterme"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "DOSYASİSTEMİ"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Ortam değişkeni tanımla"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "DEĞİŞKEN=DEĞER"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Uygulamanın oturum veri yolunda kendi adı olmasına izin ver"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "DBUS_İSMİ"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Uygulamanın oturum veri yolunda isme konuşmasına izin ver"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Uygulamanın sistem veri yolunda kendi adı olmasına izin ver"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Uygulamanın sistem veri yolunda isme konuşmasına izin ver"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Genel ilke seçeneği ekle"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "ALTSİSTEM.ANAHTAR=DEĞER"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Genel ilke seçeneğini kaldır"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Ev dizinini koru"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "DOSYAİSMİ"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Çalışan oturum gerektirme (cgroups yaratımı yok)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Flatpak-info geçici dosyası açılamadı: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Geçici dosya açılamadı: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Eşzamanlama veri yolu yaratılamadı"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Uygulama bilgi dosyası açılamadı: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Dbus vekiliyle eşzamanlanamadı"
+
+#: common/flatpak-run.c:5170
+#, fuzzy, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "apply_extra betiği başarısız oldu"
+
+#: common/flatpak-utils.c:623
+#, fuzzy, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Güncelleniyor: %2$s'ten %1$s\n"
+
+#: common/flatpak-utils.c:629
+#, fuzzy, c-format
+msgid "Error during migration: %s\n"
+msgstr "Hata: %2$s'i %1$s başarılamadı: %3$s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Ek veri kaynağı yok"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr ""
+
+#: common/flatpak-utils.c:6546
+#, fuzzy, c-format
+msgid "Downloading: %s/%s"
+msgstr "İndirme boyutu"
+
+#: common/flatpak-utils.c:6566
+#, fuzzy, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "İndirme boyutu"
+
+#: common/flatpak-utils.c:6571
+#, fuzzy, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "İndirme boyutu"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "İmzalı uygulama yükle"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Uygulama yüklemek için kimlik denetimi gerekli"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "İmzalı çalışma ortamı yükle"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "İmzalı uygulama güncelle"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Uygulama güncellemek için kimlik denetimi gerekli"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "İmzalı çalışma ortamı güncelle"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Uzaktaki üst veriyi güncelle"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+#, fuzzy
+msgid "Authentication is required to update remote info"
+msgstr "Uygulama güncellemek için kimlik denetimi gerekli"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+#, fuzzy
+msgid "Update system repository"
+msgstr "Bir arşivdeki özet dosyasını güncelle"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+#, fuzzy
+msgid "Authentication is required to update the system repository"
+msgstr "Uygulama güncellemek için kimlik denetimi gerekli"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Paket yükle"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Çalışma ortamı kaldır"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Uygulama kaldırmak için kimlik denetimi gerekli"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Uygulama kaldır"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Uzak Yapılandır"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr "Yazılım arşivlerini yapılandırmak için kimlik denetimi gerekli"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+#, fuzzy
+msgid "Configure"
+msgstr "Uzak Yapılandır"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+#, fuzzy
+msgid "Authentication is required to configure software installation"
+msgstr "Yazılım arşivlerini yapılandırmak için kimlik denetimi gerekli"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Appstream'i güncelle"
+
+#~ msgid "No remote %s"
+#~ msgstr "%s uzak yok"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Kullanıcı yüklemelerini göster"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Sistem-geneli yüklemeleri göster"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Belirli sistem-geneli yüklemeleri göster"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Geçici dosya oluşturulamadı"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Geçici dosya bağı koparılamadı"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Geçici dosyaya yazılamadı"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Yükleniyor: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Yükleniyor: %s\n"
+
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "OCI depo Dosya Adı veya uri belirtilmelidir"
+
+#~ msgid "OAutomatically answer yes for all questions"
+#~ msgstr "Tüm soruları otomatik olarak evetle cevapla"
+
+#~ msgid "OCI image is not a flatpak (missing ref)"
+#~ msgstr "OCI görüntüsü bir flatpak değil (eksik referans)"
+
+#~ msgid "OCI image specifies the wrong app id"
+#~ msgstr "OCI görüntüsünde yanlış uygulama kimliği belirtili"
diff --git a/po/uk.gmo b/po/uk.gmo
new file mode 100644 (file)
index 0000000..50cfe73
Binary files /dev/null and b/po/uk.gmo differ
diff --git a/po/uk.po b/po/uk.po
new file mode 100644 (file)
index 0000000..43edd54
--- /dev/null
+++ b/po/uk.po
@@ -0,0 +1,2972 @@
+# Ukrainian translation for flatpak.
+# Copyright (C) 2016 flatpak's COPYRIGHT HOLDER
+# This file is distributed under the same license as the flatpak package.
+#
+# Yuri Chornoivan <yurchor@ukr.net>, 2016, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: flatpak master\n"
+"Report-Msgid-Bugs-To: https://github.com/flatpak/flatpak/issues\n"
+"POT-Creation-Date: 2017-12-15 13:30+0100\n"
+"PO-Revision-Date: 2017-10-23 20:15+0200\n"
+"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
+"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n"
+"Language: uk\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n"
+"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"X-Generator: Lokalize 2.0\n"
+
+#: app/flatpak-builtins-add-remote.c:57
+msgid "Do nothing if the provided remote exists"
+msgstr "Нічого не робити, якщо вказане сховище існує"
+
+#: app/flatpak-builtins-add-remote.c:58
+msgid "LOCATION specifies a configuration file, not the repo location"
+msgstr "МІСЦЕ вказує на файл налаштувань, а не на розташування сховища"
+
+#: app/flatpak-builtins-add-remote.c:63
+msgid "Enable GPG verification"
+msgstr "Увімкнути перевірку GPG"
+
+#: app/flatpak-builtins-add-remote.c:64
+msgid "Mark the remote as enumerate"
+msgstr "Позначити віддалене сховище як таке, яке входить до переліку"
+
+#: app/flatpak-builtins-add-remote.c:65
+msgid "Mark the remote as used for dependencies"
+msgstr ""
+"Позначити віддалене сховище як таке, що використовується для залежностей"
+
+#: app/flatpak-builtins-add-remote.c:66
+msgid "Set a new url"
+msgstr "Встановити нову адресу"
+
+#: app/flatpak-builtins-add-remote.c:66 app/flatpak-builtins-build-bundle.c:57
+#: app/flatpak-builtins-build-bundle.c:58
+#: app/flatpak-builtins-list-remotes.c:70 app/flatpak-builtins-repo-update.c:52
+msgid "URL"
+msgstr "АДРЕСА"
+
+#: app/flatpak-builtins-add-remote.c:67
+msgid "Enable the remote"
+msgstr "Увімкнути віддалене сховище"
+
+#: app/flatpak-builtins-add-remote.c:68
+msgid "Update extra metadata from the summary file"
+msgstr "Оновити додаткові метадані з файла резюме"
+
+#: app/flatpak-builtins-add-remote.c:73
+msgid "Disable GPG verification"
+msgstr "Вимкнути перевірку GPG"
+
+#: app/flatpak-builtins-add-remote.c:74
+msgid "Mark the remote as don't enumerate"
+msgstr "Позначити віддалене сховище як таке, яке не входить до переліку"
+
+#: app/flatpak-builtins-add-remote.c:75
+msgid "Mark the remote as don't use for deps"
+msgstr ""
+"Позначити віддалене сховище як таке, яке не використовується для залежностей"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "Set priority (default 1, higher is more prioritized)"
+msgstr ""
+"Встановити пріоритетність (типово 1, більше значення — вища пріоритетність)"
+
+#: app/flatpak-builtins-add-remote.c:76
+msgid "PRIORITY"
+msgstr "ПРІОРИТЕТНІСТЬ"
+
+#: app/flatpak-builtins-add-remote.c:77
+msgid "A nice name to use for this remote"
+msgstr "Зрозуміла назва для використання цього віддаленого сховища"
+
+#: app/flatpak-builtins-add-remote.c:77 app/flatpak-builtins-repo-update.c:53
+msgid "TITLE"
+msgstr "ЗАГОЛОВОК"
+
+#: app/flatpak-builtins-add-remote.c:78
+msgid "Default branch to use for this remote"
+msgstr "Типова гілка для цього віддаленого сховища"
+
+#: app/flatpak-builtins-add-remote.c:78 app/flatpak-builtins-repo.c:153
+#: app/flatpak-builtins-repo-update.c:54 app/flatpak-builtins-run.c:54
+msgid "BRANCH"
+msgstr "ГІЛКА"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-build-export.c:67
+#: app/flatpak-builtins-repo-update.c:56
+msgid "Collection ID"
+msgstr "Ідентифікатор збірки"
+
+#: app/flatpak-builtins-add-remote.c:80 app/flatpak-builtins-repo-update.c:56
+msgid "COLLECTION-ID"
+msgstr "ІД-ЗБІРКИ"
+
+#: app/flatpak-builtins-add-remote.c:82
+msgid "Import GPG key from FILE (- for stdin)"
+msgstr "Імпортувати ключ GPG з ФАЙЛА (- — імпортувати із stdin)"
+
+#: app/flatpak-builtins-add-remote.c:82 app/flatpak-builtins-build-bundle.c:59
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+#: app/flatpak-builtins-install.c:67 app/flatpak-builtins-repo-update.c:59
+msgid "FILE"
+msgstr "ФАЙЛ"
+
+#: app/flatpak-builtins-add-remote.c:83
+msgid "Disable the remote"
+msgstr "Вимкнути віддалене сховище"
+
+#: app/flatpak-builtins-add-remote.c:84
+msgid "Add OCI registry"
+msgstr "Додати реєстр OCI"
+
+#: app/flatpak-builtins-add-remote.c:218 app/flatpak-builtins-add-remote.c:225
+#, c-format
+msgid "Can't load uri %s: %s\n"
+msgstr "Не вдалося завантажити адресу %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:233
+#, c-format
+msgid "Can't load file %s: %s\n"
+msgstr "Не вдалося завантажити файл %s: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:241
+msgid "Invalid file format"
+msgstr "Некоректний формат файла"
+
+#: app/flatpak-builtins-add-remote.c:249
+#, c-format
+msgid "Invalid version %s, only 1 supported"
+msgstr "Некоректна версія %s, передбачено підтримку лише версії 1"
+
+#: app/flatpak-builtins-add-remote.c:293
+msgid "Invalid gpg key"
+msgstr "Некоректний ключ gpg"
+
+#: app/flatpak-builtins-add-remote.c:320
+msgid "NAME LOCATION - Add a remote repository"
+msgstr "НАЗВА РОЗТАШУВАННЯ - Додати віддалене сховище"
+
+#: app/flatpak-builtins-add-remote.c:333
+#: app/flatpak-builtins-delete-remote.c:61 app/flatpak-builtins-info.c:120
+msgid "NAME must be specified"
+msgstr "Має бути вказано НАЗВУ"
+
+#: app/flatpak-builtins-add-remote.c:336 app/flatpak-builtins-build-sign.c:71
+#: app/flatpak-builtins-repo.c:175 app/flatpak-builtins-repo-update.c:429
+msgid "LOCATION must be specified"
+msgstr "Слід вказати РОЗТАШУВАННЯ"
+
+#: app/flatpak-builtins-add-remote.c:339
+#: app/flatpak-builtins-build-bundle.c:459
+#: app/flatpak-builtins-build-export.c:676
+#: app/flatpak-builtins-build-import-bundle.c:182
+#: app/flatpak-builtins-build-init.c:181 app/flatpak-builtins-build-sign.c:74
+#: app/flatpak-builtins-delete-remote.c:66
+#: app/flatpak-builtins-document-export.c:102
+#: app/flatpak-builtins-document-info.c:75
+#: app/flatpak-builtins-document-list.c:70
+#: app/flatpak-builtins-document-unexport.c:67 app/flatpak-builtins-info.c:127
+#: app/flatpak-builtins-install.c:267 app/flatpak-builtins-install.c:401
+#: app/flatpak-builtins-list.c:314 app/flatpak-builtins-list-remotes.c:61
+#: app/flatpak-builtins-ls-remote.c:107 app/flatpak-builtins-make-current.c:72
+#: app/flatpak-builtins-override.c:68
+msgid "Too many arguments"
+msgstr "Забагато аргументів"
+
+#: app/flatpak-builtins-add-remote.c:344
+#: app/flatpak-builtins-build-export.c:692
+#, c-format
+msgid "‘%s’ is not a valid collection ID: %s"
+msgstr "«%s» не є коректним ідентифікатором збірки: %s"
+
+#: app/flatpak-builtins-add-remote.c:348
+msgid "GPG verification is required if collections are enabled"
+msgstr "Якщо увімкнено збірку, слід пройти перевірку GPG"
+
+#. Do nothing
+#: app/flatpak-builtins-add-remote.c:363
+#, c-format
+msgid "Remote %s already exists"
+msgstr "Запис віддаленого сховища %s вже існує"
+
+#: app/flatpak-builtins-add-remote.c:371
+msgid "No url specified in flatpakrepo file"
+msgstr "У файлі flatpakrepo не вказано адреси"
+
+#: app/flatpak-builtins-add-remote.c:415
+#, c-format
+msgid "Warning: Could not update extra metadata for '%s': %s\n"
+msgstr "Попередження: не вдалося оновити додаткові метадані для «%s»: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:464
+msgid "NAME - Modify a remote repository"
+msgstr "НАЗВА - Змінити віддалене сховище"
+
+#: app/flatpak-builtins-add-remote.c:474
+msgid "Remote NAME must be specified"
+msgstr "Має бути вказано НАЗВУ віддаленого сховища"
+
+#: app/flatpak-builtins-add-remote.c:485
+#, c-format
+msgid "Updating extra metadata from remote summary for %s\n"
+msgstr "Оновлюємо додаткові метадані з резюме віддаленого сховища для %s\n"
+
+#: app/flatpak-builtins-add-remote.c:488
+#, c-format
+msgid "Error updating extra metadata for '%s': %s\n"
+msgstr "Помилка під час оновлення додаткових метаданих для «%s»: %s\n"
+
+#: app/flatpak-builtins-add-remote.c:489
+#, c-format
+msgid "Could not update extra metadata for %s"
+msgstr "Не вдалося оновити додаткові метадані для %s"
+
+#: app/flatpak-builtins-build-bundle.c:55
+msgid "Export runtime instead of app"
+msgstr "Експортувати середовище виконання замість програми"
+
+#: app/flatpak-builtins-build-bundle.c:56
+msgid "Arch to bundle for"
+msgstr "Архітектура для пакунка"
+
+#: app/flatpak-builtins-build-bundle.c:56
+#: app/flatpak-builtins-build-export.c:55 app/flatpak-builtins-build-init.c:49
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-info-remote.c:48 app/flatpak-builtins-install.c:57
+#: app/flatpak-builtins-list.c:46 app/flatpak-builtins-ls-remote.c:49
+#: app/flatpak-builtins-make-current.c:38 app/flatpak-builtins-run.c:52
+#: app/flatpak-builtins-uninstall.c:44 app/flatpak-builtins-update.c:53
+msgid "ARCH"
+msgstr "АРХ"
+
+#: app/flatpak-builtins-build-bundle.c:57
+msgid "Url for repo"
+msgstr "Адреса сховища"
+
+#: app/flatpak-builtins-build-bundle.c:58
+msgid "Url for runtime flatpakrepo file"
+msgstr "Адреса файла flatpakrepo середовища виконання"
+
+#: app/flatpak-builtins-build-bundle.c:59
+msgid "Add GPG key from FILE (- for stdin)"
+msgstr "Додати ключ GPG з ФАЙЛА (- якщо дані слід взяти з stdin)"
+
+#: app/flatpak-builtins-build-bundle.c:60
+msgid "Export oci image instead of flatpak bundle"
+msgstr "Експортувати образ OCI замість пакунка flatpak"
+
+#: app/flatpak-builtins-build-bundle.c:61
+msgid "GPG Key ID to sign the OCI image with"
+msgstr "Ідентифікатор ключа GPG для підписування образу OCI"
+
+#: app/flatpak-builtins-build-bundle.c:61
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43 app/flatpak-builtins-repo-update.c:60
+msgid "KEY-ID"
+msgstr "ІД КЛЮЧА"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "GPG Homedir to use when looking for keyrings"
+msgstr "Домашній каталог GPG, яким слід користуватися для пошуку сховищ ключів"
+
+#: app/flatpak-builtins-build-bundle.c:62
+#: app/flatpak-builtins-build-commit-from.c:56
+#: app/flatpak-builtins-build-export.c:64
+#: app/flatpak-builtins-build-import-bundle.c:47
+#: app/flatpak-builtins-build-sign.c:44 app/flatpak-builtins-repo-update.c:61
+msgid "HOMEDIR"
+msgstr "ДОМАШНІЙ-КАТАЛОГ"
+
+#: app/flatpak-builtins-build-bundle.c:449
+msgid ""
+"LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local "
+"repository"
+msgstr ""
+"РОЗТАШУВАННЯ НАЗВА_ФАЙЛА НАЗВА [ГІЛКА] - Створити пакунок з одного файла на "
+"основі локального сховища"
+
+#: app/flatpak-builtins-build-bundle.c:456
+msgid "LOCATION, FILENAME and NAME must be specified"
+msgstr "Слід вказати РОЗТАШУВАННЯ, НАЗВУ_ФАЙЛА та НАЗВУ"
+
+#: app/flatpak-builtins-build-bundle.c:474
+#: app/flatpak-builtins-build-commit-from.c:103
+#: app/flatpak-builtins-build-commit-from.c:113
+#: app/flatpak-builtins-build-import-bundle.c:191
+#, c-format
+msgid "'%s' is not a valid repository"
+msgstr "«%s» не є коректним сховищем"
+
+#: app/flatpak-builtins-build-bundle.c:486 app/flatpak-builtins-build-sign.c:86
+#, c-format
+msgid "'%s' is not a valid name: %s"
+msgstr "«%s» не є коректною назвою: %s"
+
+#: app/flatpak-builtins-build-bundle.c:489
+#: app/flatpak-builtins-build-export.c:699 app/flatpak-builtins-build-sign.c:89
+#, c-format
+msgid "'%s' is not a valid branch name: %s"
+msgstr "«%s» не є коректною назвою гілки: %s"
+
+#: app/flatpak-builtins-build.c:49
+msgid "Use Platform runtime rather than Sdk"
+msgstr "Використовувати середовище виконання платформи замість SDK"
+
+#: app/flatpak-builtins-build.c:50
+msgid "Make destination readonly"
+msgstr ""
+
+#: app/flatpak-builtins-build.c:51
+msgid "Add bind mount"
+msgstr "Додати монтування прив’язки"
+
+#: app/flatpak-builtins-build.c:51
+msgid "DEST=SRC"
+msgstr "ПРИЗН=ДЖЕР"
+
+#: app/flatpak-builtins-build.c:52
+msgid "Start build in this directory"
+msgstr "Почати збирання у цьому каталозі"
+
+#: app/flatpak-builtins-build.c:52 app/flatpak-builtins-build.c:53
+#: app/flatpak-builtins-build-init.c:58
+msgid "DIR"
+msgstr "КАТАЛОГ"
+
+#: app/flatpak-builtins-build.c:53
+msgid "Where to look for custom sdk dir (defaults to 'usr')"
+msgstr "Місце, де слід шукати нетиповий каталог sdk (типовим є каталог usr)"
+
+#: app/flatpak-builtins-build.c:54 app/flatpak-builtins-build-export.c:60
+msgid "Use alternative file for the metadata"
+msgstr "Використовувати альтернативний файл для метаданих"
+
+#: app/flatpak-builtins-build.c:55
+msgid "Kill processes when the parent process dies"
+msgstr "Вбивати процеси, якщо завершив роботу батьківський процес"
+
+#: app/flatpak-builtins-build.c:56
+msgid "Export application homedir directory to build"
+msgstr "Експортувати домашній каталог програми до каталогу збирання"
+
+#: app/flatpak-builtins-build.c:57 app/flatpak-builtins-run.c:58
+msgid "Log session bus calls"
+msgstr "Записувати до журналу виклики до каналу сеансу"
+
+#: app/flatpak-builtins-build.c:58 app/flatpak-builtins-run.c:59
+msgid "Log system bus calls"
+msgstr "Записувати до журналу виклики до каналу системи"
+
+#: app/flatpak-builtins-build.c:124
+msgid "DIRECTORY [COMMAND [args...]] - Build in directory"
+msgstr "КАТАЛОГ [КОМАНДА [аргументи...]] - Зібрати у каталозі"
+
+#: app/flatpak-builtins-build.c:147 app/flatpak-builtins-build-finish.c:533
+msgid "DIRECTORY must be specified"
+msgstr "Слід вказати КАТАЛОГ"
+
+#: app/flatpak-builtins-build.c:158 app/flatpak-builtins-build-export.c:721
+#, c-format
+msgid "Build directory %s not initialized, use flatpak build-init"
+msgstr ""
+"Каталог збирання %s не ініціалізовано, скористайтеся командою flatpak build-"
+"init"
+
+#: app/flatpak-builtins-build.c:177
+msgid "metadata invalid, not application or runtime"
+msgstr "некоректні метадані, немає програми або середовища виконання"
+
+#: app/flatpak-builtins-build.c:277
+#, c-format
+msgid "No extension point matching %s in %s"
+msgstr "Немає точки розширення, яка відповідає %s у %s"
+
+#: app/flatpak-builtins-build.c:420
+#, c-format
+msgid "Missing '=' in bind mount option '%s'"
+msgstr "Пропущено «=» у параметрі монтування прив’язки «%s»"
+
+#: app/flatpak-builtins-build.c:449 common/flatpak-run.c:5508
+msgid "Unable to start app"
+msgstr "Не вдалося запустити програму"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "Source repo dir"
+msgstr "Каталог сховища-джерела"
+
+#: app/flatpak-builtins-build-commit-from.c:47
+msgid "SRC-REPO"
+msgstr "СХОВ-ДЖ"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "Source repo ref"
+msgstr "Посилання сховища-джерела"
+
+#: app/flatpak-builtins-build-commit-from.c:48
+msgid "SRC-REF"
+msgstr "ПОС-ДЖ"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "One line subject"
+msgstr "Тема у один рядок"
+
+#: app/flatpak-builtins-build-commit-from.c:51
+#: app/flatpak-builtins-build-export.c:53
+msgid "SUBJECT"
+msgstr "SUBJECT"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "Full description"
+msgstr "Повний опис"
+
+#: app/flatpak-builtins-build-commit-from.c:52
+#: app/flatpak-builtins-build-export.c:54
+msgid "BODY"
+msgstr "BODY"
+
+#: app/flatpak-builtins-build-commit-from.c:53
+#: app/flatpak-builtins-build-export.c:57
+#: app/flatpak-builtins-build-import-bundle.c:48
+msgid "Update the appstream branch"
+msgstr "Оновити гілку appstream"
+
+#: app/flatpak-builtins-build-commit-from.c:54
+#: app/flatpak-builtins-build-export.c:58
+#: app/flatpak-builtins-build-import-bundle.c:49
+msgid "Don't update the summary"
+msgstr "Не оновлювати резюме"
+
+#: app/flatpak-builtins-build-commit-from.c:55
+#: app/flatpak-builtins-build-export.c:61
+#: app/flatpak-builtins-build-import-bundle.c:46
+#: app/flatpak-builtins-build-sign.c:43
+msgid "GPG Key ID to sign the commit with"
+msgstr "Ідентифікатор ключа GPG для підписування внеску"
+
+#: app/flatpak-builtins-build-commit-from.c:78
+msgid "DST-REPO [DST-REF]... - Make a new commit based on existing commit(s)"
+msgstr "СХОВ-ПР [ПОС-ПР]... - створити новий внесок на основі наявних внесків"
+
+#: app/flatpak-builtins-build-commit-from.c:85
+msgid "DST-REPO must be specified"
+msgstr "Слід вказати СХОВ-ПР"
+
+#: app/flatpak-builtins-build-commit-from.c:93
+msgid ""
+"If --src-repo is not specified, exactly one destination ref must be specified"
+msgstr ""
+"Якщо не вказано --src-repo, має бути вказано точно одне посилання призначення"
+
+#: app/flatpak-builtins-build-commit-from.c:96
+msgid ""
+"If --src-ref is specified, exactly one destination ref must be specified"
+msgstr ""
+"Якщо вказано --src-ref, має бути вказано точно одне посилання призначення"
+
+#: app/flatpak-builtins-build-commit-from.c:99
+msgid "Either --src-repo or --src-ref must be specified."
+msgstr "Слід вказати або --src-repo, або --src-ref."
+
+#: app/flatpak-builtins-build-commit-from.c:251
+msgid "Can't commit from partial source commit."
+msgstr "Неможливо створити внесок на основі часткового внеску до джерела."
+
+#: app/flatpak-builtins-build-commit-from.c:256
+#, c-format
+msgid "%s: no change\n"
+msgstr "%s: без змін\n"
+
+#: app/flatpak-builtins-build-export.c:55
+msgid "Architecture to export for (must be host compatible)"
+msgstr "Архітектура експортування (має бути сумісною із основною системою)"
+
+#: app/flatpak-builtins-build-export.c:56
+msgid "Commit runtime (/usr), not /app"
+msgstr "Записати до середовища виконання (/usr), а не до /app"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "Use alternative directory for the files"
+msgstr "Використовувати альтернативний каталог для файлів"
+
+#: app/flatpak-builtins-build-export.c:59
+msgid "SUBDIR"
+msgstr "ПІДКАТАЛОГ"
+
+#: app/flatpak-builtins-build-export.c:62
+msgid "Files to exclude"
+msgstr "Файли для виключення"
+
+#: app/flatpak-builtins-build-export.c:62
+#: app/flatpak-builtins-build-export.c:63
+msgid "PATTERN"
+msgstr "ЗРАЗОК"
+
+#: app/flatpak-builtins-build-export.c:63
+msgid "Excluded files to include"
+msgstr "Виключені файли для включення"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "Override the timestamp of the commit"
+msgstr "Перевизначити часову позначку внеску"
+
+#: app/flatpak-builtins-build-export.c:65
+msgid "ISO-8601-TIMESTAMP"
+msgstr "ЧАСОВА-ПОЗНАЧКА-ISO-8601"
+
+#: app/flatpak-builtins-build-export.c:341
+#, c-format
+msgid "WARNING: Error running desktop-file-validate: %s\n"
+msgstr ""
+"ПОПЕРЕДЖЕННЯ: помилка під час спроби виконати desktop-file-validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:349
+#, c-format
+msgid "WARNING: Error reading from desktop-file-validate: %s\n"
+msgstr ""
+"ПОПЕРЕДЖЕННЯ: помилка під час спроби прочитати дані від desktop-file-"
+"validate: %s\n"
+
+#: app/flatpak-builtins-build-export.c:355
+#, c-format
+msgid "WARNING: Failed to validate desktop file %s: %s\n"
+msgstr "ПОПЕРЕДЖЕННЯ: не вдалося перевірити файл desktop %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:370
+#, c-format
+msgid "WARNING: Can't find Exec key in %s: %s\n"
+msgstr "ПОПЕРЕДЖЕННЯ: не вдалося знайти ключ Exec у %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:378
+#: app/flatpak-builtins-build-export.c:475
+#, c-format
+msgid "WARNING: Binary not found for Exec line in %s: %s\n"
+msgstr "ПОПЕРЕДЖЕННЯ: не знайдено виконуваного файла для рядка Exec у %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:385
+#, c-format
+msgid "WARNING: Icon not matching app id in %s: %s\n"
+msgstr ""
+"ПОПЕРЕДЖЕННЯ: піктограма не відповідає ідентифікатору програми у %s: %s\n"
+
+#: app/flatpak-builtins-build-export.c:413
+#, c-format
+msgid "WARNING: Icon referenced in desktop file but not exported: %s\n"
+msgstr ""
+"ПОПЕРЕДЖЕННЯ: у файлі desktop є посилання на піктограму, але її не "
+"експортовано: %s\n"
+
+#: app/flatpak-builtins-build-export.c:551
+#, c-format
+msgid "Invalid uri type %s, only http/https supported"
+msgstr "Некоректний тип адреси %s, передбачено підтримку лише http/https"
+
+#: app/flatpak-builtins-build-export.c:569
+#, c-format
+msgid "Unable to find basename in %s, specify a name explicitly"
+msgstr "Не вдалося знайти базову назву у %s, вкажіть назву явним чином"
+
+#: app/flatpak-builtins-build-export.c:578
+msgid "No slashes allowed in extra data name"
+msgstr "У назві додаткових даних не можна використовувати навскісні риски"
+
+#: app/flatpak-builtins-build-export.c:590
+#, c-format
+msgid "Invalid format for sha256 checksum: '%s'"
+msgstr "Некоректний формат контрольної суми sha256: «%s»"
+
+#: app/flatpak-builtins-build-export.c:600
+msgid "Extra data sizes of zero not supported"
+msgstr "Підтримки нульових розмірів додаткових даних не передбачено"
+
+#: app/flatpak-builtins-build-export.c:662
+msgid ""
+"LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"
+msgstr ""
+"РОЗТАШУВАННЯ КАТАЛОГ [ГІЛКА] - Створити сховище на основі каталогу збирання"
+
+#: app/flatpak-builtins-build-export.c:670
+msgid "LOCATION and DIRECTORY must be specified"
+msgstr "Слід вказати РОЗТАШУВАННЯ і КАТАЛОГ"
+
+#: app/flatpak-builtins-build-export.c:738
+#: app/flatpak-builtins-build-finish.c:561
+msgid "No name specified in the metadata"
+msgstr "У метаданих не вказано назви"
+
+#: app/flatpak-builtins-build-export.c:976
+#, c-format
+msgid "Commit: %s\n"
+msgstr "Внесок: %s\n"
+
+#: app/flatpak-builtins-build-export.c:977
+#, c-format
+msgid "Metadata Total: %u\n"
+msgstr "Загалом метаданих: %u\n"
+
+#: app/flatpak-builtins-build-export.c:978
+#, c-format
+msgid "Metadata Written: %u\n"
+msgstr "Записано метаданих: %u\n"
+
+#: app/flatpak-builtins-build-export.c:979
+#, c-format
+msgid "Content Total: %u\n"
+msgstr "Загалом даних: %u\n"
+
+#: app/flatpak-builtins-build-export.c:980
+#, c-format
+msgid "Content Written: %u\n"
+msgstr "Записано даних: %u\n"
+
+#: app/flatpak-builtins-build-export.c:981
+msgid "Content Bytes Written:"
+msgstr "Записано байтів даних:"
+
+#: app/flatpak-builtins-build-finish.c:48
+msgid "Command to set"
+msgstr "Команда для встановлення"
+
+#: app/flatpak-builtins-build-finish.c:48 app/flatpak-builtins-run.c:53
+#: app/flatpak-main.c:166
+msgid "COMMAND"
+msgstr "КОМАНДА"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "Flatpak version to require"
+msgstr "Версія Flatpak, яку слід вимагати"
+
+#: app/flatpak-builtins-build-finish.c:49
+msgid "MAJOR.MINOR.MICRO"
+msgstr "ОСНОВНА.ДРУГОРЯДНА.ТРЕТЬОРЯДНА"
+
+#: app/flatpak-builtins-build-finish.c:50
+msgid "Don't process exports"
+msgstr "Не обробляти експортування"
+
+#: app/flatpak-builtins-build-finish.c:51
+msgid "Extra data info"
+msgstr "Відомості щодо додаткових даних"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "Add extension point info"
+msgstr "Додати дані щодо точки розширення"
+
+#: app/flatpak-builtins-build-finish.c:52
+msgid "NAME=VARIABLE[=VALUE]"
+msgstr "НАЗВА=ЗМІННА[=ЗНАЧЕННЯ]"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "Set extension priority (only for extensions)"
+msgstr "Встановити пріоритетність розширення (лише для розширень)"
+
+#: app/flatpak-builtins-build-finish.c:53
+msgid "0"
+msgstr "0"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "Change the sdk used for the app"
+msgstr "Змінити sdk, що використовується для програми"
+
+#: app/flatpak-builtins-build-finish.c:54
+msgid "SDK"
+msgstr "SDK"
+
+#: app/flatpak-builtins-build-finish.c:55
+msgid "Change the runtime used for the app"
+msgstr "Змінити середовище виконання, що використовується для програми"
+
+#: app/flatpak-builtins-build-finish.c:55 app/flatpak-builtins-build-init.c:50
+#: app/flatpak-builtins-run.c:56
+msgid "RUNTIME"
+msgstr "СЕРЕДОВИЩЕ ВИКОНАННЯ"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "Set generic metadata option"
+msgstr "Встановити параметр загальних метаданих"
+
+#: app/flatpak-builtins-build-finish.c:56
+msgid "GROUP=KEY[=VALUE]"
+msgstr "ГРУПА=КЛЮЧ[=ЗНАЧЕННЯ]"
+
+#: app/flatpak-builtins-build-finish.c:139
+#, c-format
+msgid "Not exporting %s, wrong prefix\n"
+msgstr "Не експортуємо %s, помилковий префікс\n"
+
+#: app/flatpak-builtins-build-finish.c:143
+#, c-format
+msgid "Exporting %s\n"
+msgstr "Експортуємо %s\n"
+
+#: app/flatpak-builtins-build-finish.c:384
+msgid "More than one executable found\n"
+msgstr "Знайдено декілька виконуваних файлів\n"
+
+#: app/flatpak-builtins-build-finish.c:395
+#, c-format
+msgid "Using %s as command\n"
+msgstr "Використовуємо як команду %s\n"
+
+#: app/flatpak-builtins-build-finish.c:400
+msgid "No executable found\n"
+msgstr "Не знайдено виконуваного файла\n"
+
+#: app/flatpak-builtins-build-finish.c:433
+#, c-format
+msgid "Too few elements in --extra-data argument %s"
+msgstr "Замало елементів у аргументі --extra-data %s"
+
+#: app/flatpak-builtins-build-finish.c:465
+#, c-format
+msgid ""
+"Too few elements in --metadata argument %s, format should be "
+"GROUP=KEY[=VALUE]]"
+msgstr ""
+"Замало елементів у аргументі --metadata %s; слід використовувати формат "
+"ГРУПА=КЛЮЧ[=ЗНАЧЕННЯ]]"
+
+#: app/flatpak-builtins-build-finish.c:480
+#, c-format
+msgid ""
+"Too few elements in --extension argument %s, format should be "
+"NAME=VAR[=VALUE]"
+msgstr ""
+"Замало елементів у аргументі --extension %s, слід вказувати у форматі "
+"НАЗВА=ЗМІННА[=ЗНАЧЕННЯ]"
+
+#: app/flatpak-builtins-build-finish.c:523
+msgid "DIRECTORY - Finalize a build directory"
+msgstr "КАТАЛОГ — завершити обробку каталогу збирання"
+
+#: app/flatpak-builtins-build-finish.c:545
+#, c-format
+msgid "Build directory %s not initialized"
+msgstr "Каталог збирання %s не ініціалізовано"
+
+#: app/flatpak-builtins-build-finish.c:566
+#, c-format
+msgid "Build directory %s already finalized"
+msgstr "Каталог збирання %s вже завершено"
+
+#: app/flatpak-builtins-build-finish.c:579
+msgid "Please review the exported files and the metadata\n"
+msgstr "Будь ласка, перегляньте експортовані файли і метадані\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "Override the ref used for the imported bundle"
+msgstr "Перевизначити посилання, використане для імпортованого пакунка"
+
+#: app/flatpak-builtins-build-import-bundle.c:44
+msgid "REF"
+msgstr "ПОСИЛАННЯ"
+
+#: app/flatpak-builtins-build-import-bundle.c:45
+msgid "Import oci image instead of flatpak bundle"
+msgstr "Імпортувати образ OCI замість пакунка flatpak"
+
+#: app/flatpak-builtins-build-import-bundle.c:82
+#, c-format
+msgid "Ref '%s' not found in registry"
+msgstr "Посилання «%s» немає у реєстрі"
+
+#: app/flatpak-builtins-build-import-bundle.c:91
+msgid "Multiple images in registry, specify a ref with --ref"
+msgstr "У реєстрі декілька образів, вкажіть посилання за допомогою --ref"
+
+#: app/flatpak-builtins-build-import-bundle.c:123
+#: app/flatpak-builtins-build-import-bundle.c:151
+#, c-format
+msgid "Importing %s (%s)\n"
+msgstr "Імпортуємо %s (%s)\n"
+
+#: app/flatpak-builtins-build-import-bundle.c:172
+msgid "LOCATION FILENAME - Import a file bundle into a local repository"
+msgstr ""
+"РОЗТАШУВАННЯ НАЗВА_ФАЙЛА - Імпортувати файловий пакунок до локального сховища"
+
+#: app/flatpak-builtins-build-import-bundle.c:179
+msgid "LOCATION and FILENAME must be specified"
+msgstr "Слід вказати РОЗТАШУВАННЯ і НАЗВУ ФАЙЛА"
+
+#: app/flatpak-builtins-build-init.c:49 app/flatpak-builtins-info.c:48
+#: app/flatpak-builtins-run.c:52
+msgid "Arch to use"
+msgstr "Архітектура, яку слід використовувати"
+
+#: app/flatpak-builtins-build-init.c:50
+msgid "Initialize var from named runtime"
+msgstr "Ініціалізувати змінну на основі іменованого середовища виконання"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "Initialize apps from named app"
+msgstr "Ініціалізувати програми з названої програми"
+
+#: app/flatpak-builtins-build-init.c:51
+msgid "APP"
+msgstr "ПРОГРАМА"
+
+#: app/flatpak-builtins-build-init.c:52
+msgid "Specify version for --base"
+msgstr "Вказати версію для --base"
+
+#: app/flatpak-builtins-build-init.c:52 app/flatpak-builtins-run.c:57
+msgid "VERSION"
+msgstr "ВЕРСІЯ"
+
+#: app/flatpak-builtins-build-init.c:53
+msgid "Include this base extension"
+msgstr "Включити це базове розширення"
+
+#: app/flatpak-builtins-build-init.c:53 app/flatpak-builtins-build-init.c:57
+msgid "EXTENSION"
+msgstr "РОЗШИРЕННЯ"
+
+#: app/flatpak-builtins-build-init.c:54
+msgid "Initialize /usr with a writable copy of the sdk"
+msgstr "Ініціалізувати /usr придатною до запису копією sdk"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "Specify the build type (app, runtime, extension)"
+msgstr ""
+"Вказати тип збирання (програма (app), середовище виконання (runtime), "
+"розширення (extension))"
+
+#: app/flatpak-builtins-build-init.c:55
+msgid "TYPE"
+msgstr "ТИП"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "Add a tag"
+msgstr "Додати мітку"
+
+#: app/flatpak-builtins-build-init.c:56
+msgid "TAG"
+msgstr "МІТКА"
+
+#: app/flatpak-builtins-build-init.c:57
+msgid "Include this sdk extension in /usr"
+msgstr "Включити це розширення середовища програмування до /usr"
+
+#: app/flatpak-builtins-build-init.c:58
+msgid "Where to store sdk (defaults to 'usr')"
+msgstr "Місце для зберігання sdk (типово «usr»)"
+
+#: app/flatpak-builtins-build-init.c:59
+msgid "Re-initialize the sdk/var"
+msgstr "Повторно ініціалізувати sdk/var"
+
+#: app/flatpak-builtins-build-init.c:102
+#, c-format
+msgid "Requested extension %s is only partially installed"
+msgstr "Потрібне розширення %s встановлено лише частково"
+
+#: app/flatpak-builtins-build-init.c:131
+#, c-format
+msgid "Requested extension %s not installed"
+msgstr "Бажане розширення %s не встановлено"
+
+#: app/flatpak-builtins-build-init.c:171
+msgid ""
+"DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building"
+msgstr ""
+"КАТАЛОГ НАЗВА_ПРОГРАМИ SDK СЕРЕДОВИЩЕ_ВИКОНАННЯ [ГІЛКА] - Ініціалізувати "
+"каталог для збирання"
+
+#: app/flatpak-builtins-build-init.c:178
+msgid "RUNTIME must be specified"
+msgstr "Має бути вказано СЕРЕДОВИЩЕ-ВИКОНАННЯ"
+
+#: app/flatpak-builtins-build-init.c:199
+#, c-format
+msgid "'%s' is not a valid build type name, use app, runtime or extension"
+msgstr ""
+"«%s» не є коректною назвою типу збирання; коректними є такі назви: app, "
+"runtime і extension"
+
+#: app/flatpak-builtins-build-init.c:205 app/flatpak-builtins-override.c:74
+#, c-format
+msgid "'%s' is not a valid application name: %s"
+msgstr "«%s» не є коректною назвою програми: %s"
+
+#: app/flatpak-builtins-build-init.c:235
+#, c-format
+msgid "Build directory %s already initialized"
+msgstr "Каталог збирання %s вже ініціалізовано"
+
+#: app/flatpak-builtins-build-sign.c:41 app/flatpak-builtins-info-remote.c:48
+#: app/flatpak-builtins-install.c:57
+msgid "Arch to install for"
+msgstr "Архітектура для встановлення"
+
+#: app/flatpak-builtins-build-sign.c:42 app/flatpak-builtins-info-remote.c:50
+#: app/flatpak-builtins-install.c:63 app/flatpak-builtins-uninstall.c:48
+#: app/flatpak-builtins-update.c:61
+msgid "Look for runtime with the specified name"
+msgstr "Шукати середовище виконання із вказаною назвою"
+
+#: app/flatpak-builtins-build-sign.c:64
+msgid "LOCATION [ID [BRANCH]] - Sign an application or runtime"
+msgstr ""
+"РОЗТАШУВАННЯ [ІД [ГІЛКА]]  - Підписати програму або середовище виконання"
+
+#: app/flatpak-builtins-build-sign.c:92
+msgid "No gpg key ids specified"
+msgstr "Не вказано ідентифікаторів ключів GPG"
+
+#: app/flatpak-builtins-config.c:41
+msgid "List configuration keys and values"
+msgstr "Показати список ключів і значень налаштувань"
+
+#: app/flatpak-builtins-config.c:42
+msgid "Get configuration for KEY"
+msgstr "Отримати налаштування для ключа КЛЮЧ"
+
+#: app/flatpak-builtins-config.c:43
+msgid "Set configuration for KEY to VALUE"
+msgstr "Встановити налаштовування для ключа КЛЮЧ у значення ЗНАЧЕННЯ"
+
+#: app/flatpak-builtins-config.c:44
+msgid "Unset configuration for KEY"
+msgstr "Скасувати налаштовування для ключа КЛЮЧ"
+
+#: app/flatpak-builtins-config.c:95
+#, c-format
+msgid "Unknown configure key '%s'"
+msgstr "Невідомий ключ налаштовування «%s»"
+
+#: app/flatpak-builtins-config.c:144 app/flatpak-builtins-config.c:185
+msgid "You must specify key"
+msgstr "Вам слід вказати ключ"
+
+#: app/flatpak-builtins-config.c:166
+msgid "You must specify both key and value"
+msgstr "Вам слід вказати і ключ, і значення"
+
+#: app/flatpak-builtins-config.c:204
+msgid "[KEY [VALUE]] - Manage configuration"
+msgstr "[КЛЮЧ [ЗНАЧЕННЯ]] - керувати налаштуваннями"
+
+#: app/flatpak-builtins-config.c:223
+#, fuzzy
+msgid "Must specify one of --list, --get, --set or --unset"
+msgstr ""
+"Слід вказати один із таких параметрів: --list, --get, --set або --unset"
+
+#: app/flatpak-builtins-delete-remote.c:38
+msgid "Remove remote even if in use"
+msgstr "Вилучити віддалене сховища, навіть якщо воно використовується"
+
+#: app/flatpak-builtins-delete-remote.c:51
+msgid "NAME - Delete a remote repository"
+msgstr "НАЗВА - Вилучити віддалене сховище"
+
+#: app/flatpak-builtins-document-export.c:54
+msgid "Create a unique document reference"
+msgstr "Створити унікальне посилання на документ"
+
+#: app/flatpak-builtins-document-export.c:55
+msgid "Make the document transient for the current session"
+msgstr "Зробити документ перехідним для поточного сеансу"
+
+#: app/flatpak-builtins-document-export.c:56
+msgid "Don't require the file to exist already"
+msgstr "Не вимагати, щоб файл вже існував"
+
+#: app/flatpak-builtins-document-export.c:57
+msgid "Give the app read permissions"
+msgstr "Надати програмі права доступу до читання"
+
+#: app/flatpak-builtins-document-export.c:58
+msgid "Give the app write permissions"
+msgstr "Надати програмі права доступу до запису"
+
+#: app/flatpak-builtins-document-export.c:59
+msgid "Give the app delete permissions"
+msgstr "Надати програмі права доступу до вилучення"
+
+#: app/flatpak-builtins-document-export.c:60
+msgid "Give the app permissions to grant further permissions"
+msgstr "Надати програмі права доступу на надання подальших прав доступу"
+
+#: app/flatpak-builtins-document-export.c:61
+msgid "Revoke read permissions of the app"
+msgstr "Відкликати від програми права доступу до читання"
+
+#: app/flatpak-builtins-document-export.c:62
+msgid "Revoke write permissions of the app"
+msgstr "Відкликати від програми права доступу до запису"
+
+#: app/flatpak-builtins-document-export.c:63
+msgid "Revoke delete permissions of the app"
+msgstr "Відкликати від програми права доступу до вилучення"
+
+#: app/flatpak-builtins-document-export.c:64
+msgid "Revoke the permission to grant further permissions"
+msgstr ""
+"Відкликати від програми права доступу на надання подальших прав доступу"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "Add permissions for this app"
+msgstr "Додати права доступу для цієї програми"
+
+#: app/flatpak-builtins-document-export.c:65
+msgid "APPID"
+msgstr "ІДЕНТИФІКАТОРПРОГРАМИ"
+
+#: app/flatpak-builtins-document-export.c:90
+msgid "FILE - Export a file to apps"
+msgstr "ФАЙЛ -  Експортувати файл до програм"
+
+#: app/flatpak-builtins-document-export.c:99
+#: app/flatpak-builtins-document-info.c:72
+#: app/flatpak-builtins-document-unexport.c:64
+msgid "FILE must be specified"
+msgstr "Слід вказати ФАЙЛ"
+
+#: app/flatpak-builtins-document-info.c:63
+msgid "FILE - Get information about an exported file"
+msgstr "ФАЙЛ - Отримати інформацію щодо експортованого файла"
+
+#: app/flatpak-builtins-document-info.c:100
+#: app/flatpak-builtins-document-unexport.c:87
+msgid "Not exported\n"
+msgstr "Не експортовано\n"
+
+#: app/flatpak-builtins-document-list.c:56
+msgid "[APPID] - List exported files"
+msgstr "[ІДЕНТИФІКАТОРПРОГРАМИ] - Вивести список експортованих файлів"
+
+#: app/flatpak-builtins-document-unexport.c:55
+msgid "FILE - Unexport a file to apps"
+msgstr "ФАЙЛ - Скасувати експортування файла до програм"
+
+#: app/flatpak-builtins-enter.c:82
+msgid ""
+"SANDBOXEDPID [COMMAND [args...]] - Run a command inside a running sandbox"
+msgstr ""
+"PID_ПІСОЧНИЦІ [КОМАНДА [аргументи...]] - Виконати команду у запущеній "
+"пісочниці"
+
+#: app/flatpak-builtins-enter.c:103
+msgid "SANDBOXEDPID and COMMAND must be specified"
+msgstr "Слід вказати PID_ПІСОЧНИЦІ та КОМАНДУ"
+
+#: app/flatpak-builtins-enter.c:109
+msgid "Not running as root, may be unable to enter namespace"
+msgstr "Запущено не від імені root, вхід до простору назв може бути неможливим"
+
+#: app/flatpak-builtins-enter.c:115
+#, c-format
+msgid "Invalid pid %s"
+msgstr "Некоректний pid %s"
+
+#: app/flatpak-builtins-enter.c:119
+#, c-format
+msgid "No such pid %s"
+msgstr "Немає такого pid, %s"
+
+#: app/flatpak-builtins-enter.c:131
+msgid "Can't read cwd"
+msgstr "Не вдалося прочитати cwd"
+
+#: app/flatpak-builtins-enter.c:136
+msgid "Can't read root"
+msgstr "Не вдалося прочитати вміст кореневої теки"
+
+#: app/flatpak-builtins-enter.c:145
+#, c-format
+msgid "Invalid %s namespace for pid %d"
+msgstr "Некоректний простір назв %s для pid %d"
+
+#: app/flatpak-builtins-enter.c:150
+#, c-format
+msgid "Invalid %s namespace for self"
+msgstr "Некоректний простір назв %s для self"
+
+#: app/flatpak-builtins-enter.c:162
+#, c-format
+msgid "Can't open %s namespace: %s"
+msgstr "не вдалося відкрити простір назв %s: %s"
+
+#: app/flatpak-builtins-enter.c:171
+#, c-format
+msgid "Can't enter %s namespace: %s"
+msgstr "Не вдалося увійти до простору назв %s: %s"
+
+#: app/flatpak-builtins-enter.c:177
+msgid "Can't chdir"
+msgstr "Не вдалося змінити каталог"
+
+#: app/flatpak-builtins-enter.c:180
+msgid "Can't chroot"
+msgstr "Не вдалося змінити кореневий каталог"
+
+#: app/flatpak-builtins-enter.c:227
+msgid "Can't switch gid"
+msgstr "Не вдалося перемкнути gid"
+
+#: app/flatpak-builtins-enter.c:230
+msgid "Can't switch uid"
+msgstr "Не вдалося перемкнути uid"
+
+#: app/flatpak-builtins-info.c:49
+msgid "Show user installations"
+msgstr "Показати встановлення користувача"
+
+#: app/flatpak-builtins-info.c:50
+msgid "Show system-wide installations"
+msgstr "Показати загальносистемні встановлення"
+
+#: app/flatpak-builtins-info.c:51
+msgid "Show specific system-wide installations"
+msgstr "Показати вказані загальносистемні встановлення"
+
+#: app/flatpak-builtins-info.c:52 app/flatpak-builtins-info-remote.c:53
+msgid "Show ref"
+msgstr "Показати посилання"
+
+#: app/flatpak-builtins-info.c:53 app/flatpak-builtins-info-remote.c:54
+msgid "Show commit"
+msgstr "Показати внесок"
+
+#: app/flatpak-builtins-info.c:54
+msgid "Show origin"
+msgstr "Показ початку координат"
+
+#: app/flatpak-builtins-info.c:55
+msgid "Show size"
+msgstr "Показ розміру"
+
+#: app/flatpak-builtins-info.c:56 app/flatpak-builtins-info-remote.c:56
+msgid "Show metadata"
+msgstr "Показ метаданих"
+
+#: app/flatpak-builtins-info.c:57
+msgid "Show extensions"
+msgstr "Показати розширення"
+
+#: app/flatpak-builtins-info.c:113
+msgid "NAME [BRANCH] - Get info about installed app and/or runtime"
+msgstr ""
+"НАЗВА [ГІЛКА] - Отримати інформацію щодо встановленої програми і/або "
+"середовища виконання"
+
+#: app/flatpak-builtins-info.c:181
+msgid "ref not present in origin"
+msgstr "посилання немає у джерелі"
+
+#: app/flatpak-builtins-info.c:192 app/flatpak-builtins-info-remote.c:193
+msgid "Ref:"
+msgstr "Джерело:"
+
+#: app/flatpak-builtins-info.c:193 app/flatpak-builtins-info.c:309
+#: app/flatpak-builtins-info-remote.c:194
+msgid "ID:"
+msgstr "Ід.:"
+
+#: app/flatpak-builtins-info.c:194 app/flatpak-builtins-info-remote.c:195
+msgid "Arch:"
+msgstr "Арх.:"
+
+#: app/flatpak-builtins-info.c:195 app/flatpak-builtins-info-remote.c:196
+msgid "Branch:"
+msgstr "Гілка:"
+
+#: app/flatpak-builtins-info.c:196 app/flatpak-builtins-info.c:310
+msgid "Origin:"
+msgstr "Походження:"
+
+#: app/flatpak-builtins-info.c:198 app/flatpak-builtins-info-remote.c:197
+msgid "Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:200 app/flatpak-builtins-info-remote.c:198
+msgid "Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:204
+msgid "Active commit:"
+msgstr "Активний внесок:"
+
+#: app/flatpak-builtins-info.c:205
+msgid "Latest commit:"
+msgstr "Останній внесок:"
+
+#: app/flatpak-builtins-info.c:208 app/flatpak-builtins-info.c:311
+#: app/flatpak-builtins-info-remote.c:199
+msgid "Commit:"
+msgstr "Внесок:"
+
+#: app/flatpak-builtins-info.c:210
+msgid "alt-id:"
+msgstr "альт-ід.:"
+
+#: app/flatpak-builtins-info.c:211 app/flatpak-builtins-info-remote.c:200
+msgid "Parent:"
+msgstr ""
+
+#: app/flatpak-builtins-info.c:212
+msgid "Location:"
+msgstr "Місце:"
+
+#: app/flatpak-builtins-info.c:213 app/flatpak-builtins-info.c:312
+#: app/flatpak-builtins-info-remote.c:202
+msgid "Installed size:"
+msgstr "Розмір встановленого:"
+
+#: app/flatpak-builtins-info.c:218 app/flatpak-builtins-info-remote.c:207
+msgid "Runtime:"
+msgstr "Середовище виконання:"
+
+#: app/flatpak-builtins-info.c:223
+msgid "Installed subdirectories:"
+msgstr "Встановлені підкаталоги:"
+
+#: app/flatpak-builtins-info.c:308
+msgid "Extension:"
+msgstr "Суфікс:"
+
+#: app/flatpak-builtins-info.c:319
+msgid "Subpaths:"
+msgstr "Підшляхи:"
+
+#: app/flatpak-builtins-info-remote.c:49
+msgid "Commit to show info for"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:49 app/flatpak-builtins-update.c:54
+msgid "COMMIT"
+msgstr "COMMIT"
+
+#: app/flatpak-builtins-info-remote.c:51 app/flatpak-builtins-install.c:64
+#: app/flatpak-builtins-uninstall.c:49 app/flatpak-builtins-update.c:62
+msgid "Look for app with the specified name"
+msgstr "Шукати програму із вказаною назвою"
+
+#: app/flatpak-builtins-info-remote.c:52
+msgid "Display log"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:55
+#, fuzzy
+msgid "Show parent"
+msgstr "Показати посилання"
+
+#: app/flatpak-builtins-info-remote.c:121
+#, fuzzy
+msgid ""
+" REMOTE REF - Show information about an application or runtime in a remote"
+msgstr "Встановити програму або середовище виконання із віддаленого сховища"
+
+#: app/flatpak-builtins-info-remote.c:132 app/flatpak-builtins-install.c:499
+msgid "REMOTE and REF must be specified"
+msgstr "Має бути вказано СХОВИЩЕ і НАЗВУ"
+
+#: app/flatpak-builtins-info-remote.c:201
+#, fuzzy
+msgid "Download size:"
+msgstr "Розмір отриманого"
+
+#: app/flatpak-builtins-info-remote.c:214
+msgid "History:\n"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:235
+msgid " Subject:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:236
+msgid " Date:"
+msgstr ""
+
+#: app/flatpak-builtins-info-remote.c:237
+#, fuzzy
+msgid " Commit:"
+msgstr "Внесок:"
+
+#: app/flatpak-builtins-install.c:58
+msgid "Don't pull, only install from local cache"
+msgstr "Не отримувати зі сховища, встановити лише з локального кешу"
+
+#: app/flatpak-builtins-install.c:59 app/flatpak-builtins-update.c:57
+msgid "Don't deploy, only download to local cache"
+msgstr "Не розгортати, лише отримати дані до локального кешу"
+
+#: app/flatpak-builtins-install.c:60
+msgid "Don't install related refs"
+msgstr "Не встановлювати пов’язані посилання"
+
+#: app/flatpak-builtins-install.c:61 app/flatpak-builtins-update.c:59
+msgid "Don't verify/install runtime dependencies"
+msgstr "Не перевіряти або не встановлювати залежності для виконання"
+
+#: app/flatpak-builtins-install.c:62 app/flatpak-builtins-update.c:60
+msgid "Don't use static deltas"
+msgstr "Не використовувати статичні різниці"
+
+#: app/flatpak-builtins-install.c:65
+msgid "Assume LOCATION is a .flatpak single-file bundle"
+msgstr "Вважати значенням параметра МІСЦЕ однофайловий пакунок .flatpak"
+
+#: app/flatpak-builtins-install.c:66
+msgid "Assume LOCATION is a .flatpakref application description"
+msgstr "Вважати значенням параметра МІСЦЕ опис програми .flatpakref"
+
+#: app/flatpak-builtins-install.c:67
+msgid "Check bundle signatures with GPG key from FILE (- for stdin)"
+msgstr ""
+"Перевірити підписи пакунків за допомогою ключа GPG з ФАЙЛА (- якщо слід дані "
+"слід взяти з stdin)"
+
+#: app/flatpak-builtins-install.c:68
+msgid "Only install this subpath"
+msgstr "Встановити лише цей підшлях"
+
+#: app/flatpak-builtins-install.c:68 app/flatpak-builtins-update.c:64
+msgid "PATH"
+msgstr "ШЛЯХ"
+
+#: app/flatpak-builtins-install.c:69 app/flatpak-builtins-update.c:65
+msgid "Automatically answer yes for all questions"
+msgstr "Автоматично відповідати «так» на усі питання"
+
+#: app/flatpak-builtins-install.c:70
+#, fuzzy
+msgid "Uninstall first if already installed"
+msgstr "%s, внесок %s вже встановлено"
+
+#: app/flatpak-builtins-install.c:212
+#, c-format
+msgid ""
+"This application depends on runtimes from:\n"
+"  %s\n"
+"Configure this as new remote '%s'"
+msgstr ""
+"Ця програма залежить від середовища виконання звідси:\n"
+"  %s\n"
+"Налаштуйте як нове сховище «%s»"
+
+#: app/flatpak-builtins-install.c:216 app/flatpak-builtins-install.c:342
+#, c-format
+msgid "Configuring %s as new remote '%s'"
+msgstr "Налаштовуємо %s як нове віддалене сховище «%s»"
+
+#: app/flatpak-builtins-install.c:264
+msgid "Bundle filename must be specified"
+msgstr "Слід вказати назву файла пакунка"
+
+#: app/flatpak-builtins-install.c:274
+msgid "Remote bundles are not supported"
+msgstr "Підтримки віддалених пакунків не передбачено"
+
+#: app/flatpak-builtins-install.c:338
+#, fuzzy, c-format
+msgid ""
+"The remote '%s', at location %s contains additional applications.\n"
+"Should the remote be kept for future installations?"
+msgstr ""
+"У віддаленому сховищі «%s», розміщеному у %s, містяться додаткові програми.\n"
+"Хочете встановити інші програми звідти?"
+
+#: app/flatpak-builtins-install.c:398
+msgid "Filename or uri must be specified"
+msgstr "Слід вказати назву файла або адресу"
+
+#: app/flatpak-builtins-install.c:442
+#, c-format
+msgid "Installing: %s\n"
+msgstr "Встановлюємо: %s\n"
+
+#: app/flatpak-builtins-install.c:474
+msgid "LOCATION/REMOTE [REF...] - Install applications or runtimes"
+msgstr "МІСЦЕ/СХОВИЩЕ [НАЗВА…] - Встановити програму або середовища виконання"
+
+#: app/flatpak-builtins-list.c:43
+msgid "Show extra information"
+msgstr "Показати додаткову інформацію"
+
+#: app/flatpak-builtins-list.c:44
+msgid "List installed runtimes"
+msgstr "Вивести список встановлених середовищ виконання"
+
+#: app/flatpak-builtins-list.c:45
+msgid "List installed applications"
+msgstr "Вивести список встановлених програм"
+
+#: app/flatpak-builtins-list.c:46
+msgid "Arch to show"
+msgstr "Архітектура для показу"
+
+#: app/flatpak-builtins-list.c:47 app/flatpak-builtins-ls-remote.c:50
+msgid "List all refs (including locale/debug)"
+msgstr "Вивести список усіх джерел (включно з locale/debug)"
+
+#: app/flatpak-builtins-list.c:125 app/flatpak-builtins-ls-remote.c:174
+#: app/flatpak-builtins-repo.c:98
+msgid "Ref"
+msgstr "Джерело"
+
+#: app/flatpak-builtins-list.c:128 app/flatpak-builtins-ls-remote.c:176
+msgid "Origin"
+msgstr "Походження"
+
+#: app/flatpak-builtins-list.c:129
+msgid "Active commit"
+msgstr "Активний внесок"
+
+#: app/flatpak-builtins-list.c:130
+msgid "Latest commit"
+msgstr "Останній внесок"
+
+#: app/flatpak-builtins-list.c:131 app/flatpak-builtins-ls-remote.c:178
+msgid "Installed size"
+msgstr "Розмір встановленого"
+
+#: app/flatpak-builtins-list.c:133 app/flatpak-builtins-list-remotes.c:73
+msgid "Options"
+msgstr "Параметри"
+
+#: app/flatpak-builtins-list.c:305
+msgid " - List installed apps and/or runtimes"
+msgstr " - Вивести список встановлених програм і/або середовищ виконання"
+
+#: app/flatpak-builtins-list-remotes.c:40
+msgid "Show remote details"
+msgstr "Показати подробиці щодо віддаленого сховища"
+
+#: app/flatpak-builtins-list-remotes.c:41
+msgid "Show disabled remotes"
+msgstr "Показати вимкнені віддалені сховища"
+
+#: app/flatpak-builtins-list-remotes.c:53
+msgid " - List remote repositories"
+msgstr " - Вивести список віддалених сховищ"
+
+#: app/flatpak-builtins-list-remotes.c:66
+msgid "Name"
+msgstr "Назва"
+
+#: app/flatpak-builtins-list-remotes.c:69
+msgid "Title"
+msgstr "Заголовок"
+
+#: app/flatpak-builtins-list-remotes.c:71
+msgid "Priority"
+msgstr "Пріоритетність"
+
+#: app/flatpak-builtins-ls-remote.c:45
+msgid "Show arches and branches"
+msgstr "Показати архітектури і гілки"
+
+#: app/flatpak-builtins-ls-remote.c:46
+msgid "Show only runtimes"
+msgstr "Показати лише середовища виконання"
+
+#: app/flatpak-builtins-ls-remote.c:47
+msgid "Show only apps"
+msgstr "Показати лише програми"
+
+#: app/flatpak-builtins-ls-remote.c:48
+msgid "Show only those where updates are available"
+msgstr "Показати лише ті, для яких доступні оновлення"
+
+#: app/flatpak-builtins-ls-remote.c:49
+msgid "Limit to this arch (* for all)"
+msgstr "Обмежитися вказаною архітектурою (* для усіх)"
+
+#: app/flatpak-builtins-ls-remote.c:96
+#, fuzzy
+msgid " [REMOTE] - Show available runtimes and applications"
+msgstr " СХОВИЩЕ - Показати доступні середовища виконання і програми"
+
+#: app/flatpak-builtins-ls-remote.c:177
+msgid "Commit"
+msgstr "Внесок"
+
+#: app/flatpak-builtins-ls-remote.c:179
+msgid "Download size"
+msgstr "Розмір отриманого"
+
+#: app/flatpak-builtins-ls-remote.c:301
+msgid "No ref information available in repository"
+msgstr "У сховищі немає даних щодо джерела"
+
+#: app/flatpak-builtins-make-current.c:38
+msgid "Arch to make current for"
+msgstr "Архітектура, яку слід зробити поточною"
+
+#: app/flatpak-builtins-make-current.c:58
+msgid "APP BRANCH - Make branch of application current"
+msgstr "ПРОГРАМА ГІЛКА - Зробити гілку програми поточною"
+
+#: app/flatpak-builtins-make-current.c:69 app/flatpak-builtins-run.c:105
+msgid "APP must be specified"
+msgstr "Слід вказати ПРОГРАМУ"
+
+#: app/flatpak-builtins-make-current.c:84
+msgid "BRANCH must be specified"
+msgstr "Слід вказати ГІЛКУ"
+
+#: app/flatpak-builtins-make-current.c:97
+#, c-format
+msgid "App %s branch %s is not installed"
+msgstr "Програму %s, гілка %s не встановлено"
+
+#: app/flatpak-builtins-override.c:54
+#, fuzzy
+msgid "[APP] - Override settings [for application]"
+msgstr "ПРОГРАМА - Перевизначити параметри програми"
+
+#: app/flatpak-builtins-repo.c:48
+#, c-format
+msgid "Title: %s\n"
+msgstr "Назва: %s\n"
+
+#: app/flatpak-builtins-repo.c:51
+#, c-format
+msgid "Collection ID: %s\n"
+msgstr "Ідентифікатор збірки: %s\n"
+
+#: app/flatpak-builtins-repo.c:54
+#, c-format
+msgid "Default branch: %s\n"
+msgstr "Типова гілка: %s\n"
+
+#: app/flatpak-builtins-repo.c:57
+#, c-format
+msgid "Redirect URL: %s\n"
+msgstr "Адреса переспрямовування: %s\n"
+
+#: app/flatpak-builtins-repo.c:60
+#, c-format
+msgid "Redirect collection ID: %s\n"
+msgstr "Ідентифікатор збірки переспрямовування: %s\n"
+
+#: app/flatpak-builtins-repo.c:68
+#, c-format
+msgid "GPG key hash: %s\n"
+msgstr "Хеш-сума ключа GPG: %s\n"
+
+#: app/flatpak-builtins-repo.c:77
+#, c-format
+msgid "%zd branches\n"
+msgstr "%zd гілки\n"
+
+#: app/flatpak-builtins-repo.c:99
+msgid "Installed"
+msgstr "Встановлено"
+
+#: app/flatpak-builtins-repo.c:100
+msgid "Download"
+msgstr "Отримати"
+
+#: app/flatpak-builtins-repo.c:151
+msgid "Print general information about the repository"
+msgstr "Вивести загальну інформацію щодо сховища"
+
+#: app/flatpak-builtins-repo.c:152
+msgid "List the branches in the repository"
+msgstr "Вивести список гілок у сховищі"
+
+#: app/flatpak-builtins-repo.c:153
+msgid "Print metadata for a branch"
+msgstr "Вивести метадані для гілки"
+
+#: app/flatpak-builtins-repo.c:168
+msgid "LOCATION - Repository maintenance"
+msgstr "РОЗТАШУВАННЯ - Супровід сховища"
+
+#: app/flatpak-builtins-repo-update.c:52
+msgid "Redirect this repo to a new URL"
+msgstr "Переспрямувати це сховище на нову адресу"
+
+#: app/flatpak-builtins-repo-update.c:53
+msgid "A nice name to use for this repository"
+msgstr "Зручна назва для цього сховища"
+
+#: app/flatpak-builtins-repo-update.c:54
+msgid "Default branch to use for this repository"
+msgstr "Типова гілка для цього сховища"
+
+#: app/flatpak-builtins-repo-update.c:57
+msgid "Permanently deploy collection ID to client remote configurations"
+msgstr ""
+"Остаточно розгорнути ідентифікатор збірки у налаштуваннях віддалених сховищ "
+"клієнта"
+
+#: app/flatpak-builtins-repo-update.c:59
+msgid "Import new default GPG public key from FILE"
+msgstr "Імпортувати новий типовий відкритий ключ GPG з файла ФАЙЛ"
+
+#: app/flatpak-builtins-repo-update.c:60
+msgid "GPG Key ID to sign the summary with"
+msgstr "Ідентифікатор ключа GPG для підписування резюме"
+
+#: app/flatpak-builtins-repo-update.c:62
+msgid "Generate delta files"
+msgstr "Створити файли різниці"
+
+#: app/flatpak-builtins-repo-update.c:63
+msgid "Prune unused objects"
+msgstr "Вилучити невикористані об’єкти"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "Only traverse DEPTH parents for each commit (default: -1=infinite)"
+msgstr ""
+"Переносити лише ГЛИБИНУ батьківських елементів для кожного внеску (типово: "
+"-1=нескінченна кількість)"
+
+#: app/flatpak-builtins-repo-update.c:64
+msgid "DEPTH"
+msgstr "ГЛИБИНА"
+
+#: app/flatpak-builtins-repo-update.c:193
+#, c-format
+msgid "Generating delta: %s (%.10s)\n"
+msgstr "Створюємо різницю: %s (%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:195
+#, c-format
+msgid "Generating delta: %s (%.10s-%.10s)\n"
+msgstr "Створюємо різницю: %s (%.10s-%.10s)\n"
+
+#: app/flatpak-builtins-repo-update.c:203
+#, c-format
+msgid "Failed to generate delta %s (%.10s): "
+msgstr "Не вдалося створити різницю %s (%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:206
+#, c-format
+msgid "Failed to generate delta %s (%.10s-%.10s): "
+msgstr "Не вдалося створити різницю %s (%.10s-%.10s): "
+
+#: app/flatpak-builtins-repo-update.c:422
+msgid "LOCATION - Update repository metadata"
+msgstr "РОЗТАШУВАННЯ - Оновити метадані сховища"
+
+#: app/flatpak-builtins-repo-update.c:494
+msgid "Updating appstream branch\n"
+msgstr "Оновлюємо гілку appstream\n"
+
+#: app/flatpak-builtins-repo-update.c:515
+msgid "Updating summary\n"
+msgstr "Оновлюємо резюме\n"
+
+#: app/flatpak-builtins-repo-update.c:534
+#, c-format
+msgid "Total objects: %u\n"
+msgstr "Загалом об’єктів: %u\n"
+
+#: app/flatpak-builtins-repo-update.c:536
+msgid "No unreachable objects\n"
+msgstr "Немає недосяжних об’єктів\n"
+
+#: app/flatpak-builtins-repo-update.c:538
+#, c-format
+msgid "Deleted %u objects, %s freed\n"
+msgstr "Вилучено %u об’єктів, вивільнено %s\n"
+
+#: app/flatpak-builtins-run.c:53
+msgid "Command to run"
+msgstr "Команда, яку слід виконати"
+
+#: app/flatpak-builtins-run.c:54
+msgid "Branch to use"
+msgstr "Гілка, яку слід використовувати"
+
+#: app/flatpak-builtins-run.c:55
+msgid "Use development runtime"
+msgstr "Використовувати розробницьке середовище виконання"
+
+#: app/flatpak-builtins-run.c:56
+msgid "Runtime to use"
+msgstr "Середовище виконання, яке слід використовувати"
+
+#: app/flatpak-builtins-run.c:57
+msgid "Runtime version to use"
+msgstr "Версія середовища виконання, яку слід використовувати"
+
+#: app/flatpak-builtins-run.c:60
+msgid "Log accessibility bus calls"
+msgstr "Записувати до журналу виклики до каналу доступності"
+
+#: app/flatpak-builtins-run.c:61
+msgid "Enable file forwarding"
+msgstr "Увімкнути переспрямовування файлів"
+
+#: app/flatpak-builtins-run.c:82
+msgid "APP [args...] - Run an app"
+msgstr "ПРОГРАМА [аргументи...] - Виконати програму"
+
+#: app/flatpak-builtins-search.c:212
+msgid "TEXT - Search remote apps/runtimes for text"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:220
+#, fuzzy
+msgid "TEXT must be specified"
+msgstr "Має бути вказано СХОВИЩЕ"
+
+#: app/flatpak-builtins-search.c:270
+#, fuzzy
+msgid "Application ID"
+msgstr "Ідентифікатор збірки"
+
+#: app/flatpak-builtins-search.c:271
+msgid "Version"
+msgstr ""
+
+#: app/flatpak-builtins-search.c:273
+#, fuzzy
+msgid "Branch"
+msgstr "Гілка:"
+
+#: app/flatpak-builtins-search.c:275
+#, fuzzy
+msgid "Remotes"
+msgstr "Немає сховища %s"
+
+#: app/flatpak-builtins-search.c:276
+#, fuzzy
+msgid "Description"
+msgstr "Повний опис"
+
+#: app/flatpak-builtins-search.c:285
+#, fuzzy
+msgid "No matches found"
+msgstr "Немає відповідників %s"
+
+#: app/flatpak-builtins-uninstall.c:44
+msgid "Arch to uninstall"
+msgstr "Архітектура для вилучення"
+
+#: app/flatpak-builtins-uninstall.c:45
+msgid "Keep ref in local repository"
+msgstr "Зберігати посилання у локальному сховищі"
+
+#: app/flatpak-builtins-uninstall.c:46
+msgid "Don't uninstall related refs"
+msgstr "Не встановлювати пов’язані посилання"
+
+#: app/flatpak-builtins-uninstall.c:47
+msgid "Remove files even if running"
+msgstr "Вилучити файли, навіть якщо роботу ще не завершено"
+
+#: app/flatpak-builtins-uninstall.c:70
+msgid "REF... - Uninstall an application"
+msgstr "ПОСИЛАННЯ… - Вилучити програму"
+
+#: app/flatpak-builtins-uninstall.c:81
+msgid "Must specify at least one REF"
+msgstr "Слід вказати принаймні одне посилання"
+
+#: app/flatpak-builtins-uninstall.c:134 app/flatpak-transaction.c:355
+#, c-format
+msgid "Warning: Problem looking for related refs: %s\n"
+msgstr "Попередження: проблема під час пошуку пов’язаних посилань: %s\n"
+
+#: app/flatpak-builtins-uninstall.c:164
+#, fuzzy, c-format
+msgid "Uninstalling: %s\n"
+msgstr "Встановлюємо: %s\n"
+
+#: app/flatpak-builtins-update.c:53
+msgid "Arch to update for"
+msgstr "Архітектура для оновлення"
+
+#: app/flatpak-builtins-update.c:54
+msgid "Commit to deploy"
+msgstr "Внесок для розгортання"
+
+#: app/flatpak-builtins-update.c:55
+msgid "Remove old files even if running"
+msgstr "Вилучити застарілі файли, навіть якщо роботу ще не завершено"
+
+#: app/flatpak-builtins-update.c:56
+msgid "Don't pull, only update from local cache"
+msgstr "Не отримувати зі сховища, оновити лише з локального кешу"
+
+#: app/flatpak-builtins-update.c:58
+msgid "Don't update related refs"
+msgstr "Не оновлювати пов’язані посилання"
+
+#: app/flatpak-builtins-update.c:63
+msgid "Update appstream for remote"
+msgstr "Оновити дані appstream для віддаленого сховища"
+
+#: app/flatpak-builtins-update.c:64
+msgid "Only update this subpath"
+msgstr "Оновити лише вказаний підшлях"
+
+#: app/flatpak-builtins-update.c:107
+#, fuzzy, c-format
+msgid "Updating appstream data for user remote %s\n"
+msgstr "Оновлюємо appstream для віддаленого сховища %s\n"
+
+#: app/flatpak-builtins-update.c:109
+#, fuzzy, c-format
+msgid "Updating appstream data for remote %s\n"
+msgstr "Оновлюємо appstream для віддаленого сховища %s\n"
+
+#: app/flatpak-builtins-update.c:113
+#, c-format
+msgid "Error updating: %s\n"
+msgstr "Помилка під час спроби оновлення: %s\n"
+
+#: app/flatpak-builtins-update.c:143
+#, fuzzy, c-format
+msgid "Remote \"%s\" not found"
+msgstr "Дані не знайдено"
+
+#: app/flatpak-builtins-update.c:163
+msgid "[REF...] - Update applications or runtimes"
+msgstr "[НАЗВА…] - Оновити програми або середовища виконання"
+
+#: app/flatpak-builtins-update.c:196
+msgid "Looking for updates...\n"
+msgstr "Шукаємо оновлення...\n"
+
+#: app/flatpak-builtins-utils.c:365
+#, c-format
+msgid "Remote ‘%s’ found in multiple installations:\n"
+msgstr ""
+
+#: app/flatpak-builtins-utils.c:372
+#, fuzzy
+msgid "Which do you want to use (0 to abort)?"
+msgstr "Який з пакунків встановити (0 — перервати)?"
+
+#: app/flatpak-builtins-utils.c:374
+#, c-format
+msgid "No remote chosen to resolve ‘%s’ which exists in multiple installations"
+msgstr ""
+
+#. translators: please keep the leading space
+#: app/flatpak-main.c:62
+msgid " Manage installed apps and runtimes"
+msgstr " Керування встановленими програмами і середовищами виконання"
+
+#: app/flatpak-main.c:63
+msgid "Install an application or runtime"
+msgstr "Встановити програму або середовище виконання"
+
+#: app/flatpak-main.c:64
+msgid "Update an installed application or runtime"
+msgstr "Оновити встановлену програму або середовище виконання"
+
+#: app/flatpak-main.c:65
+msgid "Uninstall an installed application or runtime"
+msgstr "Вилучити встановлену програму або середовище виконання"
+
+#: app/flatpak-main.c:66
+msgid "List installed apps and/or runtimes"
+msgstr "Вивести список встановлених програм і/або середовищ виконання"
+
+#: app/flatpak-main.c:67
+msgid "Show info for installed app or runtime"
+msgstr ""
+"Показати інформацію щодо встановленої програми або середовища виконання"
+
+#: app/flatpak-main.c:68
+msgid "Configure flatpak"
+msgstr "Налаштувати flatpak"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:71
+#, fuzzy
+msgid ""
+"\n"
+" Finding applications and runtimes"
+msgstr "Підписати програму або середовище виконання"
+
+#: app/flatpak-main.c:72
+msgid "Search for remote apps/runtimes"
+msgstr ""
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:75
+msgid ""
+"\n"
+" Running applications"
+msgstr ""
+"\n"
+" Запущені програми"
+
+#: app/flatpak-main.c:76
+msgid "Run an application"
+msgstr "Запустити програму"
+
+#: app/flatpak-main.c:77
+msgid "Override permissions for an application"
+msgstr "Перевизначити права доступу для програми"
+
+#: app/flatpak-main.c:78
+msgid "Specify default version to run"
+msgstr "Вказати типову версію для запуску"
+
+#: app/flatpak-main.c:79
+msgid "Enter the namespace of a running application"
+msgstr "Введіть простір назв для запущеної програми"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:82
+msgid ""
+"\n"
+" Manage file access"
+msgstr ""
+"\n"
+" Керування доступом до файлів"
+
+#: app/flatpak-main.c:83
+msgid "Grant an application access to a specific file"
+msgstr "Надати програмі доступ до вказаного файла"
+
+#: app/flatpak-main.c:84
+msgid "Revoke access to a specific file"
+msgstr "Відкликати доступ до вказаного файла"
+
+#: app/flatpak-main.c:85
+msgid "Show information about a specific file"
+msgstr "Показати інформацію щодо вказаного файла"
+
+#: app/flatpak-main.c:86
+msgid "List exported files"
+msgstr "Вивести список експортованих файлів"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:89
+msgid ""
+"\n"
+" Manage remote repositories"
+msgstr ""
+"\n"
+" Керування віддаленими сховищами"
+
+#: app/flatpak-main.c:90
+msgid "List all configured remotes"
+msgstr "Вивести список усіх налаштованих віддалених сховищ"
+
+#: app/flatpak-main.c:91
+msgid "Add a new remote repository (by URL)"
+msgstr "Додати нове віддалене сховище (за адресою)"
+
+#: app/flatpak-main.c:92
+msgid "Modify properties of a configured remote"
+msgstr "Змінити властивості налаштованого віддаленого сховища"
+
+#: app/flatpak-main.c:93
+msgid "Delete a configured remote"
+msgstr "Вилучити налаштоване віддалене сховище"
+
+#: app/flatpak-main.c:95
+msgid "List contents of a configured remote"
+msgstr "Вивести список вмісту налаштованого віддаленого сховища"
+
+#: app/flatpak-main.c:96
+#, fuzzy
+msgid "Show information about a remote app or runtime"
+msgstr ""
+"Показати інформацію щодо встановленої програми або середовища виконання"
+
+#. translators: please keep the leading newline and space
+#: app/flatpak-main.c:99
+msgid ""
+"\n"
+" Build applications"
+msgstr ""
+"\n"
+" Зібрати програми"
+
+#: app/flatpak-main.c:100
+msgid "Initialize a directory for building"
+msgstr "Ініціалізувати каталог для збирання"
+
+#: app/flatpak-main.c:101
+msgid "Run a build command inside the build dir"
+msgstr "Виконати команду збирання у каталозі збирання"
+
+#: app/flatpak-main.c:102
+msgid "Finish a build dir for export"
+msgstr "Завершити каталог збирання для експортування"
+
+#: app/flatpak-main.c:103
+msgid "Export a build dir to a repository"
+msgstr "Експортувати каталог збирання до сховища"
+
+#: app/flatpak-main.c:104
+msgid "Create a bundle file from a build directory"
+msgstr "Створити файл пакунка з каталогу збирання"
+
+#: app/flatpak-main.c:105
+msgid "Import a bundle file"
+msgstr "Імпортувати файл пакунка"
+
+#: app/flatpak-main.c:106
+msgid "Sign an application or runtime"
+msgstr "Підписати програму або середовище виконання"
+
+#: app/flatpak-main.c:107
+msgid "Update the summary file in a repository"
+msgstr "Оновити файл резюме у сховищі"
+
+#: app/flatpak-main.c:108
+msgid "Create new commit based on existing ref"
+msgstr "Створити внесок на основі наявного посилання"
+
+#: app/flatpak-main.c:109
+msgid "Print information about a repo"
+msgstr "Вивести інформація щодо сховища"
+
+#: app/flatpak-main.c:126
+msgid "Print debug information during command processing, -vv for more detail"
+msgstr ""
+"Вивести діагностичні дані під час обробки команди, -vv для збільшення "
+"докладності"
+
+#: app/flatpak-main.c:127
+msgid "Print OSTree debug information during command processing"
+msgstr "Вивести діагностичні дані OSTree під час обробки команди"
+
+#: app/flatpak-main.c:128
+msgid "Show help options"
+msgstr "Показати параметри доступ до довідки"
+
+#: app/flatpak-main.c:133
+msgid "Print version information and exit"
+msgstr "Показати дані щодо версії і завершити роботу"
+
+#: app/flatpak-main.c:134
+msgid "Print default arch and exit"
+msgstr "Вивести дані щодо типової архітектури і завершити роботу"
+
+#: app/flatpak-main.c:135
+msgid "Print supported arches and exit"
+msgstr "Вивести список підтримуваних архітектур і завершити роботу"
+
+#: app/flatpak-main.c:136
+msgid "Print active gl drivers and exit"
+msgstr "Вивести дані щодо активних драйверів gl і завершити роботу"
+
+#: app/flatpak-main.c:141
+msgid "Work on user installations"
+msgstr "Працювати над встановленим користувачем"
+
+#: app/flatpak-main.c:142
+msgid "Work on system-wide installations (default)"
+msgstr "Працювати над загальносистемними встановленими даними (типово)"
+
+#: app/flatpak-main.c:143
+#, fuzzy
+msgid "Work on specific system-wide installation(s)"
+msgstr "Працювати із вказаним загальносистемним встановленням"
+
+#: app/flatpak-main.c:143
+msgid "NAME"
+msgstr "НАЗВА"
+
+#: app/flatpak-main.c:169
+msgid "Builtin Commands:"
+msgstr "Вбудовані команди:"
+
+#: app/flatpak-main.c:367
+msgid ""
+"The --installation option was used multiple timesfor a command that works on "
+"one installation"
+msgstr ""
+
+#: app/flatpak-main.c:486
+#, c-format
+msgid "Unknown command '%s'"
+msgstr "Невідома команда «%s»"
+
+#: app/flatpak-main.c:494
+msgid "No command specified"
+msgstr "Команду не вказано"
+
+#: app/flatpak-main.c:612
+msgid "error:"
+msgstr "помилка:"
+
+#: app/flatpak-transaction.c:313
+#, c-format
+msgid "Found in remote %s\n"
+msgstr "Знайдено у віддаленому сховищі %s\n"
+
+#: app/flatpak-transaction.c:317
+#, c-format
+msgid "Found in remote %s, do you want to install it?"
+msgstr "Знайдено у сховищі %s, хочете встановити?"
+
+#: app/flatpak-transaction.c:322
+msgid "Found in several remotes:\n"
+msgstr "Знайдено у декількох сховищах:\n"
+
+#: app/flatpak-transaction.c:327
+msgid "Which do you want to install (0 to abort)?"
+msgstr "Який з пакунків встановити (0 — перервати)?"
+
+#: app/flatpak-transaction.c:417
+#, c-format
+msgid "Required runtime for %s (%s) is not installed, searching...\n"
+msgstr "Потрібне середовище бібліотек для %s (%s) не встановлено, шукаємо…\n"
+
+#: app/flatpak-transaction.c:423
+#, c-format
+msgid "The required runtime %s was not found in a configured remote.\n"
+msgstr ""
+"Потрібного середовища виконання %s у налаштованому віддаленому сховищі не "
+"знайдено.\n"
+
+#: app/flatpak-transaction.c:506 common/flatpak-dir.c:1157
+#: common/flatpak-dir.c:1476 common/flatpak-dir.c:1499
+#: common/flatpak-dir.c:1521 common/flatpak-dir.c:10508
+#: common/flatpak-utils.c:1311 common/flatpak-utils.c:1405
+#, c-format
+msgid "%s not installed"
+msgstr "%s не встановлено"
+
+#: app/flatpak-transaction.c:512
+#, c-format
+msgid "Remote %s disabled, ignoring %s update"
+msgstr "Сховище %s вимкнено, ігноруємо оновлення %s"
+
+#: app/flatpak-transaction.c:525
+#, c-format
+msgid "%s already installed, skipping\n"
+msgstr "%s вже встановлено, пропускаємо\n"
+
+#: app/flatpak-transaction.c:531
+#, fuzzy, c-format
+msgid "%s is already installed from other remote (%s)"
+msgstr "%s, внесок %s вже встановлено"
+
+#: app/flatpak-transaction.c:543
+#, c-format
+msgid "Warning: Can't find dependencies: %s\n"
+msgstr "Попередження: не вдалося знайти залежності: %s\n"
+
+#: app/flatpak-transaction.c:570
+#, c-format
+msgid "Invalid require-flatpak argument %s\n"
+msgstr "Некоректний аргумент require-flatpak %s\n"
+
+#: app/flatpak-transaction.c:576
+#, c-format
+msgid "%s needs a later flatpak version (%s)"
+msgstr "%s потребує новішої версії flatpak (%s)"
+
+#: app/flatpak-transaction.c:688
+#, c-format
+msgid "Error updating remote metadata for '%s': %s\n"
+msgstr "Помилка під час оновлення віддалених метаданих для «%s»: %s\n"
+
+#: app/flatpak-transaction.c:744
+msgid "install"
+msgstr "встановити"
+
+#: app/flatpak-transaction.c:746
+#, fuzzy, c-format
+msgid "Installing for user: %s from %s\n"
+msgstr "Встановлюємо: %s з %s\n"
+
+#: app/flatpak-transaction.c:748
+#, c-format
+msgid "Installing: %s from %s\n"
+msgstr "Встановлюємо: %s з %s\n"
+
+#: app/flatpak-transaction.c:765
+msgid "update"
+msgstr "оновити"
+
+#: app/flatpak-transaction.c:774
+#, fuzzy, c-format
+msgid "Updating for user: %s from %s\n"
+msgstr "Оновлюємо: %s з %s\n"
+
+#: app/flatpak-transaction.c:776
+#, c-format
+msgid "Updating: %s from %s\n"
+msgstr "Оновлюємо: %s з %s\n"
+
+#: app/flatpak-transaction.c:796
+#, c-format
+msgid "Now at %s.\n"
+msgstr "Зараз %s.\n"
+
+#: app/flatpak-transaction.c:802
+msgid "No updates.\n"
+msgstr "Немає оновлень.\n"
+
+#: app/flatpak-transaction.c:820
+msgid "install bundle"
+msgstr "встановити пакунок"
+
+#: app/flatpak-transaction.c:822
+#, fuzzy, c-format
+msgid "Installing for user: %s from bundle %s\n"
+msgstr "Встановлюємо: %s з пакунка %s\n"
+
+#: app/flatpak-transaction.c:824
+#, c-format
+msgid "Installing: %s from bundle %s\n"
+msgstr "Встановлюємо: %s з пакунка %s\n"
+
+#: app/flatpak-transaction.c:836
+#, c-format
+msgid "Warning: Failed to %s %s: %s\n"
+msgstr "Попередження: не вдалося виконати дію %s %s: %s\n"
+
+#: app/flatpak-transaction.c:841
+#, c-format
+msgid "Error: Failed to %s %s: %s\n"
+msgstr "Помилка: не вдалося виконати дію %s %s: %s\n"
+
+#: app/flatpak-transaction.c:846
+msgid "One or more operations failed"
+msgstr "Помилка під час виконання однієї або декількох дій"
+
+#: common/flatpak-dir.c:1041
+#, c-format
+msgid "No overrides found for %s"
+msgstr "Не знайдено перевизначень для %s"
+
+#: common/flatpak-dir.c:1667
+#, c-format
+msgid "While opening repository %s: "
+msgstr "Під час спроби відкрити сховище %s: "
+
+#: common/flatpak-dir.c:1901 common/flatpak-dir.c:5301
+msgid "Can't create deploy directory"
+msgstr "Не вдалося створити каталог розгортання"
+
+#: common/flatpak-dir.c:2621
+#, c-format
+msgid "Invalid sha256 for extra data uri %s"
+msgstr "Некоректна сума sha256 для адреси додаткових даних %s"
+
+#: common/flatpak-dir.c:2626
+#, c-format
+msgid "Empty name for extra data uri %s"
+msgstr "Порожня назва для адреси додаткових даних %s"
+
+#: common/flatpak-dir.c:2633
+#, c-format
+msgid "Unsupported extra data uri %s"
+msgstr "Непідтримувана адреса додаткових даних %s"
+
+#: common/flatpak-dir.c:2647
+#, c-format
+msgid "Failed to load local extra-data %s: %s"
+msgstr "Не вдалося завантажити локальні додаткові дані %s: %s"
+
+#: common/flatpak-dir.c:2650
+#, c-format
+msgid "Wrong size for extra-data %s"
+msgstr "Помилковий розмір додаткових даних %s"
+
+#: common/flatpak-dir.c:2665
+#, c-format
+msgid "While downloading %s: "
+msgstr "Під час спроби отримання %s: "
+
+#: common/flatpak-dir.c:2672
+#, c-format
+msgid "Wrong size for extra data %s"
+msgstr "Помилковий розмір додаткових даних %s"
+
+#: common/flatpak-dir.c:2683
+#, c-format
+msgid "Invalid checksum for extra data %s"
+msgstr "Некоректна контрольна сума додаткових даних, %s"
+
+#: common/flatpak-dir.c:2742
+#, fuzzy
+msgid "Remote OCI index has no registry uri"
+msgstr "НАЗВА [РОЗТАШУВАННЯ] - Додати віддалене сховище"
+
+#: common/flatpak-dir.c:2958
+#, c-format
+msgid "%s commit %s already installed"
+msgstr "%s, внесок %s вже встановлено"
+
+#: common/flatpak-dir.c:3300 common/flatpak-dir.c:3614
+#, c-format
+msgid "While pulling %s from remote %s: "
+msgstr "Під час отримання %s з віддаленого сховища %s: "
+
+#: common/flatpak-dir.c:3499
+#, c-format
+msgid "Can't find %s in remote %s"
+msgstr "Не вдалося знайти %s у віддаленому сховищі %s"
+
+#: common/flatpak-dir.c:4172
+msgid "Not enough memory"
+msgstr "Не вистачає пам'яті"
+
+#: common/flatpak-dir.c:4191
+msgid "Failed to read from exported file"
+msgstr "Не вдалося виконати читання з експортованого файла"
+
+#: common/flatpak-dir.c:4382
+msgid "Error reading mimetype xml file"
+msgstr "Помилка під час читання файла xml типу MIME"
+
+#: common/flatpak-dir.c:4387
+msgid "Invalid mimetype xml file"
+msgstr "Некоректний файл xml типу MIME"
+
+#: common/flatpak-dir.c:4930
+msgid "While getting detached metadata: "
+msgstr "Під час спроби отримання від’єднаних метаданих: "
+
+#: common/flatpak-dir.c:4948
+msgid "While creating extradir: "
+msgstr "Під час створення каталогу додаткових даних: "
+
+#: common/flatpak-dir.c:4969
+msgid "Invalid sha256 for extra data"
+msgstr "Некоректна контрольна сума sha256 для додаткових даних"
+
+#: common/flatpak-dir.c:4998
+msgid "Wrong size for extra data"
+msgstr "Помилковий розмір додаткових даних"
+
+#: common/flatpak-dir.c:5002
+msgid "Invalid checksum for extra data"
+msgstr "Некоректна контрольна сума додаткових даних"
+
+#: common/flatpak-dir.c:5011
+#, c-format
+msgid "While writing extra data file '%s': "
+msgstr "Під час записування файла додаткових даних «%s»: "
+
+#: common/flatpak-dir.c:5181
+#, c-format
+msgid "apply_extra script failed, exit status %d"
+msgstr "Помилка скрипту apply_extra, стан виходу %d"
+
+#: common/flatpak-dir.c:5260
+#, c-format
+msgid "While trying to resolve ref %s: "
+msgstr "Під час спроби визначити посилання %s: "
+
+#: common/flatpak-dir.c:5275
+#, c-format
+msgid "%s is not available"
+msgstr "%s недоступний"
+
+#: common/flatpak-dir.c:5290 common/flatpak-dir.c:5722
+#: common/flatpak-dir.c:6504 common/flatpak-dir.c:6517
+#: common/flatpak-dir.c:6593
+#, c-format
+msgid "%s branch %s already installed"
+msgstr "Гілку %s %s вже встановлено"
+
+#: common/flatpak-dir.c:5309
+#, c-format
+msgid "Failed to read commit %s: "
+msgstr "Не вдалося прочитати внесок %s: "
+
+#: common/flatpak-dir.c:5329
+#, c-format
+msgid "While trying to checkout %s into %s: "
+msgstr "Під час спроби вивантаження %s до %s: "
+
+#: common/flatpak-dir.c:5354 common/flatpak-dir.c:5385
+msgid "While trying to checkout metadata subpath: "
+msgstr "Під час спроби вивантаження підшляху метаданих: "
+
+#: common/flatpak-dir.c:5395
+msgid "While trying to remove existing extra dir: "
+msgstr "Під час спроби вилучення наявного додаткового каталогу: "
+
+#: common/flatpak-dir.c:5406
+msgid "While trying to apply extra data: "
+msgstr "Під час спроби застосування додаткових даних: "
+
+#: common/flatpak-dir.c:5433
+#, c-format
+msgid "Invalid deployed ref %s: "
+msgstr "Некоректне посилання на розгортання %s: "
+
+#: common/flatpak-dir.c:5440
+#, c-format
+msgid "Invalid commit ref %s: "
+msgstr "Некоректне посилання на внесок %s: "
+
+#: common/flatpak-dir.c:5448
+#, c-format
+msgid "Deployed ref %s kind does not match commit (%s)"
+msgstr "Тип розміщеного посилання %s не відповідає внеску (%s)"
+
+#: common/flatpak-dir.c:5456
+#, c-format
+msgid "Deployed ref %s name does not match commit (%s)"
+msgstr "Назва розміщеного посилання %s не відповідає внеску (%s)"
+
+#: common/flatpak-dir.c:5464
+#, c-format
+msgid "Deployed ref %s arch does not match commit (%s)"
+msgstr "Архітектура розміщеного посилання %s не відповідає внеску (%s)"
+
+#: common/flatpak-dir.c:5470
+#, c-format
+msgid "Deployed ref %s branch does not match commit (%s)"
+msgstr "Гілка розміщеного посилання %s не відповідає внеску (%s)"
+
+#: common/flatpak-dir.c:5476
+#, c-format
+msgid "Deployed ref %s does not match commit (%s)"
+msgstr "Розміщене джерело %s не відповідає внеску (%s)"
+
+#: common/flatpak-dir.c:5495
+msgid "Deployed metadata does not match commit"
+msgstr "Розміщені метадані не відповідають внеску"
+
+#: common/flatpak-dir.c:6365
+#, c-format
+msgid "This version of %s is already installed"
+msgstr "Цю версію %s вже встановлено"
+
+#: common/flatpak-dir.c:6372
+msgid "Can't change remote during bundle install"
+msgstr "Не можна змінювати сховище під час встановлення пакунка"
+
+#: common/flatpak-dir.c:6927
+#, c-format
+msgid "%s branch %s is not installed"
+msgstr "%s, гілка %s не встановлено"
+
+#: common/flatpak-dir.c:7171
+#, c-format
+msgid "%s branch %s not installed"
+msgstr "%s, гілка %s не встановлено"
+
+#: common/flatpak-dir.c:7489
+#, c-format
+msgid "Pruning repo failed: %s"
+msgstr "Не вдалося спорожнити сховище: %s"
+
+#: common/flatpak-dir.c:8016
+#, c-format
+msgid "Multiple branches available for %s, you must specify one of: "
+msgstr ""
+"Доступними є декілька гілок %s, вам слід вказати одне з таких значень: "
+
+#: common/flatpak-dir.c:8037
+#, c-format
+msgid "Nothing matches %s"
+msgstr "Немає відповідників %s"
+
+#: common/flatpak-dir.c:8119
+#, c-format
+msgid "Can't find ref %s%s%s%s%s"
+msgstr "Не вдалося знайти посилання %s%s%s%s%s"
+
+#: common/flatpak-dir.c:8161
+#, c-format
+msgid "Error searching remote %s: %s"
+msgstr "Помилка під час пошуку у віддаленому сховищі %s: %s"
+
+#: common/flatpak-dir.c:8206
+#, c-format
+msgid "Error searching local repository: %s"
+msgstr "Помилка під час пошуку у локальному сховищі: %s"
+
+#: common/flatpak-dir.c:8332
+#, c-format
+msgid "%s %s not installed"
+msgstr "Не встановлено %s %s"
+
+#: common/flatpak-dir.c:8499
+#, c-format
+msgid "Could not find installation %s"
+msgstr "Не вдалося знайти встановлення %s"
+
+#: common/flatpak-dir.c:9094
+#, c-format
+msgid "Runtime %s, branch %s is already installed"
+msgstr "Середовище виконання %s, гілка %s вже встановлено"
+
+#: common/flatpak-dir.c:9095
+#, c-format
+msgid "App %s, branch %s is already installed"
+msgstr "Програму %s, гілка %s вже встановлено"
+
+#: common/flatpak-dir.c:9575
+msgid "Remote title not set"
+msgstr "Заголовок віддаленого сховища не встановлено"
+
+#: common/flatpak-dir.c:9597
+msgid "Remote default-branch not set"
+msgstr "Не встановлено типову гілку віддаленого сховища"
+
+#: common/flatpak-dir.c:10185
+msgid "No flatpak cache in remote summary"
+msgstr "У резюме сховища немає кешу flatpak"
+
+#: common/flatpak-dir.c:10195
+#, c-format
+msgid "No entry for %s in remote summary flatpak cache "
+msgstr "Немає запису %s у кеші flatpak резюме сховища "
+
+#: common/flatpak-run.c:258
+#, c-format
+msgid "Unknown share type %s, valid types are: %s"
+msgstr "Невідомий тип спільного ресурсу %s, коректними типами є такі: %s"
+
+#: common/flatpak-run.c:293
+#, c-format
+msgid "Unknown policy type %s, valid types are: %s"
+msgstr "Невідомий тип правил %s, коректними типами є такі: %s"
+
+#: common/flatpak-run.c:331
+#, c-format
+msgid "Invalid dbus name %s\n"
+msgstr "Некоректна назва D-Bus, %s\n"
+
+#: common/flatpak-run.c:344
+#, c-format
+msgid "Unknown socket type %s, valid types are: %s"
+msgstr "Невідомий тип сокета, %s, коректними типами є такі: %s"
+
+#: common/flatpak-run.c:373
+#, c-format
+msgid "Unknown device type %s, valid types are: %s"
+msgstr "Невідомий тип пристрою, %s. Коректними типами є %s"
+
+#: common/flatpak-run.c:401
+#, c-format
+msgid "Unknown feature type %s, valid types are: %s"
+msgstr "Невідомий тип можливості %s, коректними типами є такі: %s"
+
+#: common/flatpak-run.c:774
+#, c-format
+msgid ""
+"Unknown filesystem location %s, valid locations are: host, home, xdg-"
+"*[/...], ~/dir, /dir"
+msgstr ""
+"Невідоме розташування файлової системи, %s, коректними розташуваннями є "
+"такі: host, home, xdg-*[/...], ~/dir, /dir"
+
+#: common/flatpak-run.c:1040
+#, c-format
+msgid "Invalid env format %s"
+msgstr "Некоректне форматування середовища, %s"
+
+#: common/flatpak-run.c:1180
+msgid "Share with host"
+msgstr "Надати спільний доступ вузлу"
+
+#: common/flatpak-run.c:1180 common/flatpak-run.c:1181
+msgid "SHARE"
+msgstr "СПІЛЬНИЙ РЕСУРС"
+
+#: common/flatpak-run.c:1181
+msgid "Unshare with host"
+msgstr "Скасувати надання спільного ресурсу вузлу"
+
+#: common/flatpak-run.c:1182
+msgid "Expose socket to app"
+msgstr "Відкрити сокет програмі"
+
+#: common/flatpak-run.c:1182 common/flatpak-run.c:1183
+msgid "SOCKET"
+msgstr "СОКЕТ"
+
+#: common/flatpak-run.c:1183
+msgid "Don't expose socket to app"
+msgstr "Не відкривати сокет програми"
+
+#: common/flatpak-run.c:1184
+msgid "Expose device to app"
+msgstr "Відкрити пристрій програмі"
+
+#: common/flatpak-run.c:1184 common/flatpak-run.c:1185
+msgid "DEVICE"
+msgstr "ПРИСТРІЙ"
+
+#: common/flatpak-run.c:1185
+msgid "Don't expose device to app"
+msgstr "Не відкривати пристрій програмі"
+
+#: common/flatpak-run.c:1186
+msgid "Allow feature"
+msgstr "Увімкнути можливість"
+
+#: common/flatpak-run.c:1186 common/flatpak-run.c:1187
+msgid "FEATURE"
+msgstr "МОЖЛИВІСТЬ"
+
+#: common/flatpak-run.c:1187
+msgid "Don't allow feature"
+msgstr "Вимкнути можливість"
+
+#: common/flatpak-run.c:1188
+msgid "Expose filesystem to app (:ro for read-only)"
+msgstr "Відкрити файлову систему програмі (:ro — лише для читання)"
+
+#: common/flatpak-run.c:1188
+msgid "FILESYSTEM[:ro]"
+msgstr "ФАЙЛОВА_СИСТЕМА[:ro]"
+
+#: common/flatpak-run.c:1189
+msgid "Don't expose filesystem to app"
+msgstr "Не відкривати файлову систему програмі"
+
+#: common/flatpak-run.c:1189
+msgid "FILESYSTEM"
+msgstr "ФАЙЛОВА СИСТЕМА"
+
+#: common/flatpak-run.c:1190
+msgid "Set environment variable"
+msgstr "Встановити змінну середовища"
+
+#: common/flatpak-run.c:1190
+msgid "VAR=VALUE"
+msgstr "ЗМІННА=ЗНАЧЕННЯ"
+
+#: common/flatpak-run.c:1191
+msgid "Allow app to own name on the session bus"
+msgstr "Дозволити програмі бути власником назви на каналі сеансу"
+
+#: common/flatpak-run.c:1191 common/flatpak-run.c:1192
+#: common/flatpak-run.c:1193 common/flatpak-run.c:1194
+msgid "DBUS_NAME"
+msgstr "НАЗВА_DBUS"
+
+#: common/flatpak-run.c:1192
+msgid "Allow app to talk to name on the session bus"
+msgstr "Дозволити програмі обмінюватися даними з назвою на каналі сеансу"
+
+#: common/flatpak-run.c:1193
+msgid "Allow app to own name on the system bus"
+msgstr "Дозволити програмі бути власником назви на каналі системи"
+
+#: common/flatpak-run.c:1194
+msgid "Allow app to talk to name on the system bus"
+msgstr "Дозволити програмі обмінюватися даними з назвою на каналі системи"
+
+#: common/flatpak-run.c:1195
+msgid "Add generic policy option"
+msgstr "Додати параметр загальних правил"
+
+#: common/flatpak-run.c:1195 common/flatpak-run.c:1196
+msgid "SUBSYSTEM.KEY=VALUE"
+msgstr "ПІДСИСТЕМА.КЛЮЧ=ЗНАЧЕННЯ"
+
+#: common/flatpak-run.c:1196
+msgid "Remove generic policy option"
+msgstr "Вилучити параметр загальних правил"
+
+#: common/flatpak-run.c:1197
+msgid "Persist home directory"
+msgstr "Примусово встановити домашній каталог"
+
+#: common/flatpak-run.c:1197
+msgid "FILENAME"
+msgstr "НАЗВА ФАЙЛА"
+
+#. This is not needed/used anymore, so hidden, but we accept it for backwards compat
+#: common/flatpak-run.c:1199
+msgid "Don't require a running session (no cgroups creation)"
+msgstr "Не вимагати запущеного сеансу (без створення cgroup)"
+
+#: common/flatpak-run.c:3790
+#, c-format
+msgid "Failed to open flatpak-info temp file: %s"
+msgstr "Не вдалося відкрити тимчасовий файл flatpak-info: %s"
+
+#: common/flatpak-run.c:3864 common/flatpak-run.c:3874
+#, c-format
+msgid "Failed to open temp file: %s"
+msgstr "Не вдалося відкрити тимчасовий файл: %s"
+
+#: common/flatpak-run.c:4214
+msgid "Unable to create sync pipe"
+msgstr "Не вдалося створити канал синхронізації"
+
+#: common/flatpak-run.c:4241
+#, c-format
+msgid "Failed to open app info file: %s"
+msgstr "Не вдалося відкрити файл інформації щодо програми: %s"
+
+#: common/flatpak-run.c:4271
+msgid "Failed to sync with dbus proxy"
+msgstr "Не вдалося виконати синхронізацію із проміжним D-Bus"
+
+#: common/flatpak-run.c:5170
+#, c-format
+msgid "ldconfig failed, exit status %d"
+msgstr "Помилка ldconfig, стан виходу %d"
+
+#: common/flatpak-utils.c:623
+#, c-format
+msgid "Migrating %s to %s\n"
+msgstr "Переносимо %s на %s\n"
+
+#: common/flatpak-utils.c:629
+#, c-format
+msgid "Error during migration: %s\n"
+msgstr "Помилка під час перенесення: %s\n"
+
+#: common/flatpak-utils.c:2939
+msgid "No extra data sources"
+msgstr "Немає джерел додаткових даних"
+
+#: common/flatpak-utils.c:6522
+#, c-format
+msgid "Downloading metadata: %u/(estimating) %s"
+msgstr "Отримуємо метадані: %u/(оцінка) %s"
+
+#: common/flatpak-utils.c:6546
+#, c-format
+msgid "Downloading: %s/%s"
+msgstr "Отримуємо: %s/%s"
+
+#: common/flatpak-utils.c:6566
+#, c-format
+msgid "Downloading extra data: %s/%s"
+msgstr "Отримуємо додаткові дані: %s з %s"
+
+#: common/flatpak-utils.c:6571
+#, c-format
+msgid "Downloading files: %d/%d %s"
+msgstr "Отримуємо файли: %d з %d %s"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:23
+msgid "Install signed application"
+msgstr "Встановлення підписаної програми"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:24
+#: system-helper/org.freedesktop.Flatpak.policy.in:41
+#: system-helper/org.freedesktop.Flatpak.policy.in:118
+msgid "Authentication is required to install software"
+msgstr "Для встановлення програмного забезпечення слід пройти розпізнавання"
+
+#. SECURITY:
+#. - Normal users do not need authentication to install signed applications
+#. from signed repositories, as this cannot exploit a system.
+#. - Paranoid users (or parents!) can change this to 'auth_admin' or
+#. 'auth_admin_keep'.
+#: system-helper/org.freedesktop.Flatpak.policy.in:40
+msgid "Install signed runtime"
+msgstr "Встановлення підписаного середовища виконання"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update an
+#. app as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:58
+msgid "Update signed application"
+msgstr "Оновлення підписаної програми"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:59
+#: system-helper/org.freedesktop.Flatpak.policy.in:77
+#: system-helper/org.freedesktop.Flatpak.policy.in:180
+msgid "Authentication is required to update software"
+msgstr "Для оновлення програмного забезпечення слід пройти розпізнавання"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update a
+#. runtime as the commit will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:76
+msgid "Update signed runtime"
+msgstr "Оновлення підписаного середовища виконання"
+
+#. SECURITY:
+#. - Normal users do not need authentication to update metadata
+#. from signed repositories.
+#: system-helper/org.freedesktop.Flatpak.policy.in:91
+msgid "Update remote metadata"
+msgstr "Оновити віддалені метадані"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:92
+msgid "Authentication is required to update remote info"
+msgstr "Для оновлення даних віддаленого сховища слід пройти розпізнавання"
+
+#. SECURITY:
+#. - Normal users do not need authentication to modify the
+#. OSTree repository
+#: system-helper/org.freedesktop.Flatpak.policy.in:106
+msgid "Update system repository"
+msgstr "Оновлення загальносистемного сховища"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:107
+msgid "Authentication is required to update the system repository"
+msgstr "Для оновлення загальносистемного сховища слід пройти розпізнавання"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:117
+msgid "Install bundle"
+msgstr "Встановити пакунок"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:128
+msgid "Uninstall runtime"
+msgstr "Вилучення середовища виконання"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:129
+#: system-helper/org.freedesktop.Flatpak.policy.in:140
+msgid "Authentication is required to uninstall software"
+msgstr "Для вилучення програмного забезпечення слід пройти розпізнавання"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:139
+msgid "Uninstall app"
+msgstr "Вилучити програму"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:150
+msgid "Configure Remote"
+msgstr "Налаштовування сховищ"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:151
+msgid "Authentication is required to configure software repositories"
+msgstr ""
+"Для налаштовування сховищ програмного забезпечення слід пройти розпізнавання"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:161
+msgid "Configure"
+msgstr "Налаштувати"
+
+#: system-helper/org.freedesktop.Flatpak.policy.in:162
+msgid "Authentication is required to configure software installation"
+msgstr ""
+"Для налаштовування встановлення програмного забезпечення слід пройти "
+"розпізнавання"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update
+#. appstream data as it will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#: system-helper/org.freedesktop.Flatpak.policy.in:179
+msgid "Update appstream"
+msgstr "Оновлення appstream"
+
+#~ msgid "No remote %s"
+#~ msgstr "Немає сховища %s"
+
+#, fuzzy
+#~ msgid "Search only user installations"
+#~ msgstr "Показати встановлення користувача"
+
+#, fuzzy
+#~ msgid "Search only system-wide installations"
+#~ msgstr "Показати загальносистемні встановлення"
+
+#, fuzzy
+#~ msgid "Search specific system-wide installations"
+#~ msgstr "Показати вказані загальносистемні встановлення"
+
+#~ msgid "Failed to create temporary file"
+#~ msgstr "Не вдалося створити тимчасовий файл"
+
+#~ msgid "Failed to unlink temporary file"
+#~ msgstr "Не вдалося відв’язати тимчасовий файл"
+
+#~ msgid "Failed to write to temporary file"
+#~ msgstr "Не вдалося виконати запис до тимчасового файла"
+
+#, fuzzy
+#~ msgid "Installing %s"
+#~ msgstr "Встановлюємо: %s\n"
+
+#, fuzzy
+#~ msgid "Post-Install %s"
+#~ msgstr "Встановлюємо: %s\n"
+
+#~ msgid "NAME:SHA256:DOWNLOAD-SIZE:INSTALL-SIZE:URL"
+#~ msgstr "НАЗВА:SHA256:РОЗМІР_ОТРИМАНОГО:РОЗМІР_ВСТАНОВЛЕНОГО:АДРЕСА"
+
+#~ msgid "'%s' is not a valid runtime name: %s"
+#~ msgstr "«%s» не є коректною назвою середовища виконання: %s"
+
+#~ msgid "'%s' is not a valid sdk name: %s"
+#~ msgstr "«%s» не є коректною назвою sdk: %s"
+
+#, fuzzy
+#~ msgid "OCI repo Filename or uri must be specified"
+#~ msgstr "Слід вказати назву файла або адресу"
+
+#~ msgid "Data not found for ref %s"
+#~ msgstr "Дані для посилання %s не знайдено"
+
+#~ msgid "Install from local bundle file"
+#~ msgstr "Встановити із локального файла пакунка"
+
+#~ msgid "Load options from file or uri"
+#~ msgstr "Завантажити параметри з файла або адресу"
+
+#, fuzzy
+#~ msgid "Invalid ref, no digest"
+#~ msgstr "Некоректне форматування середовища, %s"
+
+#, fuzzy
+#~ msgid "Unsupported manifest version %d"
+#~ msgstr "Непідтримувана адреса додаткових даних %s"
+
+#, fuzzy
+#~ msgid "Unsupported manifest list version %d"
+#~ msgstr "Непідтримувана адреса додаткових даних %s"
+
+#, fuzzy
+#~ msgid "No manfest found for arch %s, os %s"
+#~ msgstr "Дані для посилання %s не знайдено"
+
+#, fuzzy
+#~ msgid "Unsupported OCI media type %s"
+#~ msgstr "Непідтримувана адреса додаткових даних %s"
+
+#~ msgid "Remote extra metadata not available; server has no summary file"
+#~ msgstr ""
+#~ "Додаткові метадані віддаленого сховища недоступні; на сервері немає файла "
+#~ "резюме"
+
+#~ msgid "Data not available; server has no summary file"
+#~ msgstr "Дані недоступні; на сервері немає файла резюме"
+
+#~ msgid "This version of ostree is to old to support OCI exports"
+#~ msgstr "Ця версія OSTree є надто старою для підтримки експортування OCI"
+
+#~ msgid "This version of flatpak is not compiled with libarchive support"
+#~ msgstr "Цю версію flatpak не було зібрано із підтримкою libarchive"
+
+#~ msgid "The Flatpak Project"
+#~ msgstr "Проект Flatpak"
+
+#~ msgid "https://cgit.freedesktop.org/xdg-app/xdg-app/"
+#~ msgstr "https://cgit.freedesktop.org/xdg-app/xdg-app/"
+
+#~ msgid "package-x-generic"
+#~ msgstr "package-x-generic"
+
+#~ msgid "auth_admin"
+#~ msgstr "auth_admin"
+
+#~ msgid "auth_admin_keep"
+#~ msgstr "auth_admin_keep"
+
+#~ msgid "yes"
+#~ msgstr "так"
diff --git a/profile/flatpak.sh.in b/profile/flatpak.sh.in
new file mode 100644 (file)
index 0000000..8b350e8
--- /dev/null
@@ -0,0 +1,7 @@
+# @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS
+
+if [ "${XDG_DATA_DIRS#*flatpak}" = "${XDG_DATA_DIRS}" ]; then
+    XDG_DATA_DIRS="${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak/exports/share:@localstatedir@/lib/flatpak/exports/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+fi
+
+export XDG_DATA_DIRS
diff --git a/scripts/flatpak-bisect b/scripts/flatpak-bisect
new file mode 100755 (executable)
index 0000000..c27c43b
--- /dev/null
@@ -0,0 +1,225 @@
+#!/usr/bin/env python3
+
+import re
+import argparse
+import os
+import gi
+import json
+import subprocess
+
+gi.require_version('Flatpak', '1.0')
+from gi.repository import Flatpak
+from gi.repository import GLib
+
+def get_bisection_data():
+        return {'ref': None, 'good': None, 'bad': None,
+                'refs': None, 'log': None, 'messages': None}
+
+class Bisector():
+    def load_cache(self):
+        try:
+            os.makedirs(os.path.join(GLib.get_user_cache_dir(), 'flatpak'))
+        except FileExistsError:
+            pass
+
+        self.cache_path = os.path.join(GLib.get_user_cache_dir(),
+                                       'flatpak', '%s-%s-bisect.status' % (
+                                       self.name, self.branch))
+        try:
+            with open(self.cache_path, 'rb') as f:
+                self.data = json.load(f)
+        except FileNotFoundError:
+            self.data = None
+
+    def dump_data(self):
+        with open(self.cache_path, 'w') as f:
+            json.dump(self.data, f)
+
+    def setup_flatpak_app(self):
+        self.installation = Flatpak.Installation.new_user()
+        kind = Flatpak.RefKind.APP
+        if self.runtime:
+            kind = Flatpak.RefKind.RUNTIME
+        try:
+            self.cref = self.installation.get_installed_ref(kind, self.name, None, self.branch, None)
+        except GLib.Error as e:
+            print("%s\n\nMake sure %s is installed as a "
+                  "user (flatpak install --user) and specify `--runtime`"
+                  " if it is a runtime." % (e, self.name))
+            return -1
+        return 0
+
+    def run(self):
+        self.name = self.name[0]
+        self.load_cache()
+        res = self.setup_flatpak_app()
+        if res:
+            return res
+
+        try:
+            func = getattr(self, self.subparser_name)
+        except AttributeError:
+            print('No action called %s' % self.subparser_name)
+
+            return -1
+
+        res = func()
+
+        if self.data:
+            self.dump_data()
+
+        return res
+
+    def set_reference_commits(self, set_name, check_name):
+        if not self.data:
+            print("You need to first start the bisection")
+            return -1
+        ref = self.cref.get_latest_commit()
+
+        if self.data[check_name] == ref:
+            print('Commit %s is already set as %s...' % (
+                ref, check_name))
+            return 1
+
+        if ref not in self.data['refs']:
+            print("%s is not a known commit." % ref)
+            return -1
+
+        print("Setting %s as %s commit" % (ref, set_name))
+        self.data[set_name] = ref
+
+        if self.data[set_name] and self.data[check_name]:
+            x1 = self.data['refs'].index(self.data['good'])
+            x2 = self.data['refs'].index(self.data['bad'])
+
+            refs = self.data['refs'][x1:x2]
+            if not refs:
+                print("=========================="
+                      "First bad commit is:\n%s"
+                      "==========================" % self.data['message'][self.data['bad']])
+                exit(0)
+            ref = refs[int(len(refs) / 2)]
+            if self.data['good'] == ref:
+                print("\n==========================\n"
+                      "First bad commit is:\n\n%s"
+                      "==========================" % self.data['messages'][self.data['bad']])
+                exit(0)
+
+            return self.checkout(ref)
+
+        return -1
+
+    def load_refs(self):
+        repodir, refname = self.download_history()
+        history = subprocess.check_output(['ostree', 'log', '--repo', repodir, refname]).decode()
+
+        refs = []
+        messages = {}
+        message = ""
+        _hash = ''
+        for l in history.split('\n'):
+            rehash = re.search('(?<=^commit )\w+', l)
+            if rehash:
+                if message:
+                    messages[_hash] = message
+                _hash = rehash.group(0)
+                refs.insert(0, _hash)
+                message = ""
+            message += l + '\n'
+
+        if message:
+            messages[_hash] = message
+
+        self.data['refs'] = refs
+        self.data['log'] = history
+        self.data['messages'] = messages
+
+    def good(self):
+        if not self.data['bad']:
+            print("Set the bad commit first")
+            exit(-1)
+        return self.set_reference_commits('good', 'bad')
+
+    def bad(self):
+        return self.set_reference_commits('bad', 'good')
+
+    def start(self):
+        if self.data:
+            print('Bisection already started')
+            return -1
+
+        print("Updating to %s latest commit" % self.name)
+        self.reset(False)
+        self.data = get_bisection_data()
+        self.load_refs()
+
+    def download_history(self):
+        print("Getting history")
+        appidir = os.path.abspath(os.path.join(self.cref.get_deploy_dir(), '..'))
+        dirname = "app"
+        if self.runtime:
+            dirname = "runtime"
+        appidir = appidir.split('/%s/' % dirname)
+        repodir = os.path.join(appidir[0], 'repo')
+        refname = self.cref.get_origin() + ':' + dirname + '/' + self.cref.get_name() + '/' + self.cref.get_arch() + '/' + self.cref.get_branch()
+        # FIXME Getting `error: Exceeded maximum recursion` in ostree if using --depth=-1 (or > 250)
+        subprocess.call(['ostree', 'pull', '--depth=250', '--commit-metadata-only', '--repo', repodir, refname])
+
+        return repodir, refname
+
+    def log(self):
+        if self.data:
+            cmd = ['echo', self.data['log']]
+        else:
+            repodir, refname = self.download_history()
+            cmd = ['ostree', 'log', '--repo', repodir, refname]
+        pager = os.environ.get('PAGER')
+        if pager:
+            stdout = subprocess.PIPE
+        else:
+            stdout = None
+        p = subprocess.Popen(cmd, stdout=stdout)
+        if pager:
+            ps = subprocess.check_call((pager), stdin=p.stdout)
+        p.wait()
+
+    def checkout(self, commit=None):
+        if not commit:
+            commit = self.commit[0]
+        refname = self.cref.get_name() + '/' + self.cref.get_arch() + '/' + self.cref.get_branch()
+        print("Checking out %s" % commit)
+        return subprocess.call(['flatpak', 'update', '--user', refname, '--commit', commit])
+
+    def reset(self, v=True):
+        if not self.data:
+            if v:
+                print("Not bisecting, nothing to reset")
+            return -1
+
+        refname = self.cref.get_name() + '/' + self.cref.get_arch() + '/' + self.cref.get_branch()
+        print("Removing %s" % self.cache_path)
+        os.remove(self.cache_path)
+        self.data = None
+        return subprocess.call(['flatpak', 'update', '--user', refname])
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser()
+    parser.add_argument('name', nargs=1, help='Application/Runtime to bisect')
+    parser.add_argument('-b', '--branch', default='master', help='The branch to bisect')
+    parser.add_argument('-r', '--runtime',  action="store_true", help='Bisecting a runtime not an app')
+
+    subparsers = parser.add_subparsers(dest='subparser_name')
+    subparsers.required = True
+    start_parser = subparsers.add_parser('start', help="Start bisection")
+    bad_parser = subparsers.add_parser('bad', help="Set current version as bad")
+    good_parser = subparsers.add_parser('good', help="Set current version as good")
+    log_parser = subparsers.add_parser('log', help="Download and print application commit history")
+
+    checkout_parser = subparsers.add_parser('checkout', help="Checkout defined commit")
+    checkout_parser.add_argument('commit', nargs=1, help='The commit hash to checkout')
+
+    reset_parser = subparsers.add_parser('reset', help="Reset all bisecting data and go back to latest commit")
+
+    bisector = Bisector()
+    options = parser.parse_args(namespace=bisector)
+    bisector.run()
diff --git a/session-helper/Makefile.am.inc b/session-helper/Makefile.am.inc
new file mode 100644 (file)
index 0000000..ed2d534
--- /dev/null
@@ -0,0 +1,16 @@
+libexec_PROGRAMS += \
+       flatpak-session-helper \
+       $(NULL)
+
+service_in_files += session-helper/flatpak-session-helper.service.in
+systemduserunit_DATA += session-helper/flatpak-session-helper.service
+
+service_in_files += session-helper/org.freedesktop.Flatpak.service.in
+dbus_service_DATA += session-helper/org.freedesktop.Flatpak.service
+
+flatpak_session_helper_SOURCES = \
+       session-helper/flatpak-session-helper.c \
+       $(NULL)
+
+flatpak_session_helper_LDADD = $(AM_LDADD) $(BASE_LIBS) libflatpak-common.la
+flatpak_session_helper_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS) $(SOUP_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) $(JSON_CFLAGS)
diff --git a/session-helper/flatpak-session-helper.c b/session-helper/flatpak-session-helper.c
new file mode 100644 (file)
index 0000000..2c766b3
--- /dev/null
@@ -0,0 +1,670 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
+#include "flatpak-dbus.h"
+#include "flatpak-utils.h"
+
+static char *monitor_dir;
+
+static GHashTable *client_pid_data_hash = NULL;
+static GDBusConnection *session_bus = NULL;
+
+typedef struct {
+  GPid pid;
+  char *client;
+  guint child_watch;
+} PidData;
+
+static void
+pid_data_free (PidData *data)
+{
+  g_free (data->client);
+  g_free (data);
+}
+
+static gboolean
+handle_request_monitor (FlatpakSessionHelper   *object,
+                        GDBusMethodInvocation *invocation,
+                        gpointer               user_data)
+{
+  flatpak_session_helper_complete_request_monitor (object, invocation,
+                                                   monitor_dir);
+
+  return TRUE;
+}
+
+static void
+child_watch_died (GPid     pid,
+                  gint     status,
+                  gpointer user_data)
+{
+  PidData *pid_data = user_data;
+  g_autoptr(GVariant) signal_variant = NULL;
+
+  g_debug ("Client Pid %d died", pid_data->pid);
+
+  signal_variant = g_variant_ref_sink (g_variant_new ("(uu)", pid, status));
+  g_dbus_connection_emit_signal (session_bus,
+                                 pid_data->client,
+                                 "/org/freedesktop/Flatpak/Development",
+                                 "org.freedesktop.Flatpak.Development",
+                                 "HostCommandExited",
+                                 signal_variant,
+                                 NULL);
+
+  /* This frees the pid_data, so be careful */
+  g_hash_table_remove (client_pid_data_hash, GUINT_TO_POINTER(pid_data->pid));
+}
+
+typedef struct {
+  int from;
+  int to;
+  int final;
+} FdMapEntry;
+
+typedef struct {
+  FdMapEntry *fd_map;
+  int fd_map_len;
+  gboolean set_tty;
+  int tty;
+} ChildSetupData;
+
+static void
+child_setup_func (gpointer user_data)
+{
+  ChildSetupData *data = (ChildSetupData *)user_data;
+  FdMapEntry *fd_map = data->fd_map;
+  sigset_t set;
+  int i;
+
+  /* Unblock all signals */
+  sigemptyset (&set);
+  if (pthread_sigmask (SIG_SETMASK, &set, NULL) == -1)
+    {
+      g_error ("Failed to unblock signals when starting child");
+      return;
+  }
+
+  /* Reset the handlers for all signals to their defaults. */
+  for (i = 1; i < NSIG; i++)
+    {
+      if (i != SIGSTOP && i != SIGKILL)
+        signal (i, SIG_DFL);
+    }
+
+  for (i = 0; i < data->fd_map_len; i++)
+    {
+      if (fd_map[i].from != fd_map[i].to)
+        {
+          dup2 (fd_map[i].from, fd_map[i].to);
+          close (fd_map[i].from);
+        }
+    }
+
+  /* Second pass in case we needed an inbetween fd value to avoid conflicts */
+  for (i = 0; i < data->fd_map_len; i++)
+    {
+      if (fd_map[i].to != fd_map[i].final)
+        {
+          dup2 (fd_map[i].to, fd_map[i].final);
+          close (fd_map[i].to);
+        }
+    }
+
+  /* We become our own session and process group, because it never makes sense
+     to share the flatpak-session-helper dbus activated process group */
+  setsid ();
+  setpgid (0, 0);
+
+  if (data->set_tty)
+    {
+      /* data->tty is our from fd which is closed at this point.
+       * so locate the destnation fd and use it for the ioctl.
+       */
+      for (i = 0; i < data->fd_map_len; i++)
+        {
+          if (fd_map[i].from == data->tty)
+            {
+              if (ioctl (fd_map[i].final, TIOCSCTTY, 0) == -1)
+                g_debug ("ioctl(%d, TIOCSCTTY, 0) failed: %s",
+                         fd_map[i].final, strerror (errno));
+              break;
+            }
+        }
+    }
+}
+
+
+static gboolean
+handle_host_command (FlatpakDevelopment *object,
+                     GDBusMethodInvocation *invocation,
+                     const gchar *arg_cwd_path,
+                     const gchar *const *arg_argv,
+                     GVariant *arg_fds,
+                     GVariant *arg_envs,
+                     guint flags)
+{
+  g_autoptr(GError) error = NULL;
+  GDBusMessage *message = g_dbus_method_invocation_get_message (invocation);
+  GUnixFDList *fd_list = g_dbus_message_get_unix_fd_list (message);
+  ChildSetupData child_setup_data = { NULL };
+  GPid pid;
+  PidData *pid_data;
+  gsize i, j, n_fds, n_envs;
+  const gint *fds;
+  g_autofree FdMapEntry *fd_map = NULL;
+  gchar **env;
+  gint32 max_fd;
+
+  if (*arg_cwd_path == 0)
+    arg_cwd_path = NULL;
+
+  if (arg_argv == NULL || *arg_argv == NULL || *arg_argv[0] == 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+                                             G_DBUS_ERROR_INVALID_ARGS,
+                                             "No command given");
+      return TRUE;
+    }
+
+  g_debug ("Running host command %s", arg_argv[0]);
+
+  n_fds = 0;
+  fds = NULL;
+  if (fd_list != NULL)
+    {
+      n_fds = g_variant_n_children (arg_fds);
+      fds = g_unix_fd_list_peek_fds (fd_list, NULL);
+    }
+  fd_map = g_new0 (FdMapEntry, n_fds);
+
+  child_setup_data.fd_map = fd_map;
+  child_setup_data.fd_map_len = n_fds;
+
+  max_fd = -1;
+  for (i = 0; i < n_fds; i++)
+    {
+      gint32 handle, fd;
+      g_variant_get_child (arg_fds, i, "{uh}", &fd, &handle);
+      fd_map[i].to = fd;
+      fd_map[i].from = fds[i];
+      fd_map[i].final = fd_map[i].to;
+
+      /* If stdin/out/err is a tty we try to set it as the controlling
+         tty for the app, this way we can use this to run in a terminal. */
+      if ((fd == 0 || fd == 1 || fd == 2) &&
+          !child_setup_data.set_tty &&
+          isatty (fds[i]))
+        {
+          child_setup_data.set_tty = TRUE;
+          child_setup_data.tty = fds[i];
+        }
+
+      max_fd = MAX (max_fd, fd_map[i].to);
+      max_fd = MAX (max_fd, fd_map[i].from);
+    }
+
+  /* We make a second pass over the fds to find if any "to" fd index
+     overlaps an already in use fd (i.e. one in the "from" category
+     that are allocated randomly). If a fd overlaps "to" fd then its
+     a caller issue and not our fault, so we ignore that. */
+  for (i = 0; i < n_fds; i++)
+    {
+      int to_fd = fd_map[i].to;
+      gboolean conflict = FALSE;
+
+      /* At this point we're fine with using "from" values for this
+         value (because we handle to==from in the code), or values
+         that are before "i" in the fd_map (because those will be
+         closed at this point when dup:ing). However, we can't
+         reuse a fd that is in "from" for j > i. */
+      for (j = i + 1; j < n_fds; j++)
+        {
+          int from_fd = fd_map[j].from;
+          if (from_fd == to_fd)
+            {
+              conflict = TRUE;
+              break;
+            }
+        }
+
+      if (conflict)
+        fd_map[i].to = ++max_fd;
+    }
+
+  if (flags & FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV)
+    {
+      char *empty[] = { NULL };
+      env = g_strdupv (empty);
+    }
+  else
+    env = g_get_environ ();
+
+  n_envs = g_variant_n_children (arg_envs);
+  for (i = 0; i < n_envs; i++)
+    {
+      const char *var = NULL;
+      const char *val = NULL;
+      g_variant_get_child (arg_envs, i, "{&s&s}", &var, &val);
+
+      env = g_environ_setenv (env, var, val, TRUE);
+    }
+
+  if (!g_spawn_async_with_pipes (arg_cwd_path,
+                                 (char **)arg_argv,
+                                 env,
+                                 G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
+                                 child_setup_func, &child_setup_data,
+                                 &pid,
+                                 NULL,
+                                 NULL,
+                                 NULL,
+                                 &error))
+    {
+      gint code = G_DBUS_ERROR_FAILED;
+      if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_ACCES))
+        code = G_DBUS_ERROR_ACCESS_DENIED;
+      else if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
+        code = G_DBUS_ERROR_FILE_NOT_FOUND;
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, code,
+                                             "Failed to start command: %s",
+                                             error->message);
+      return TRUE;
+    }
+
+  pid_data = g_new0 (PidData, 1);
+  pid_data->pid = pid;
+  pid_data->client = g_strdup (g_dbus_method_invocation_get_sender (invocation));
+  pid_data->child_watch = g_child_watch_add_full (G_PRIORITY_DEFAULT,
+                                                  pid,
+                                                  child_watch_died,
+                                                  pid_data,
+                                                  NULL);
+
+  g_debug ("Client Pid is %d", pid_data->pid);
+
+  g_hash_table_replace (client_pid_data_hash, GUINT_TO_POINTER(pid_data->pid),
+                        pid_data);
+
+
+  flatpak_development_complete_host_command (object, invocation,
+                                             pid_data->pid);
+  return TRUE;
+}
+
+static gboolean
+handle_host_command_signal (FlatpakDevelopment *object,
+                            GDBusMethodInvocation *invocation,
+                            guint arg_pid,
+                            guint arg_signal,
+                            gboolean to_process_group)
+{
+  PidData *pid_data = NULL;
+
+  pid_data = g_hash_table_lookup (client_pid_data_hash, GUINT_TO_POINTER(arg_pid));
+  if (pid_data == NULL ||
+      strcmp (pid_data->client, g_dbus_method_invocation_get_sender (invocation)) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+                                             G_DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN,
+                                             "No such pid");
+      return TRUE;
+    }
+
+  g_debug ("Sending signal %d to client pid %d", arg_signal, arg_pid);
+
+  if (to_process_group)
+    killpg (pid_data->pid, arg_signal);
+  else
+    kill (pid_data->pid, arg_signal);
+
+  flatpak_development_complete_host_command_signal (object, invocation);
+
+  return TRUE;
+}
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
+{
+  FlatpakSessionHelper *helper;
+  FlatpakDevelopment *devel;
+  GError *error = NULL;
+
+  helper = flatpak_session_helper_skeleton_new ();
+
+  flatpak_session_helper_set_version (FLATPAK_SESSION_HELPER (helper), 1);
+
+  g_signal_connect (helper, "handle-request-monitor", G_CALLBACK (handle_request_monitor), NULL);
+
+  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
+                                         connection,
+                                         "/org/freedesktop/Flatpak/SessionHelper",
+                                         &error))
+    {
+      g_warning ("error: %s", error->message);
+      g_error_free (error);
+    }
+
+  devel = flatpak_development_skeleton_new ();
+  flatpak_development_set_version (FLATPAK_DEVELOPMENT (devel), 1);
+  g_signal_connect (devel, "handle-host-command", G_CALLBACK (handle_host_command), NULL);
+  g_signal_connect (devel, "handle-host-command-signal", G_CALLBACK (handle_host_command_signal), NULL);
+
+  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (devel),
+                                         connection,
+                                         "/org/freedesktop/Flatpak/Development",
+                                         &error))
+    {
+      g_warning ("error: %s", error->message);
+      g_error_free (error);
+    }
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+                  const gchar     *name,
+                  gpointer         user_data)
+{
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+              const gchar     *name,
+              gpointer         user_data)
+{
+  exit (1);
+}
+
+/*
+ * In the case that the monitored file is a symlink, we set up a separate
+ * GFileMonitor for the real target of the link so that we don't miss updates
+ * to the linked file contents. This is critical in the case of resolv.conf
+ * which on stateless systems is often a symlink to a dyamically-generated
+ * or updated file in /run.
+ */
+typedef struct {
+  const gchar *source;
+  char *real;
+  GFileMonitor *monitor_source;
+  GFileMonitor *monitor_real;
+} MonitorData;
+
+static void
+monitor_data_free (MonitorData *data)
+{
+  free (data->real);
+  g_signal_handlers_disconnect_by_data (data->monitor_source, data);
+  g_object_unref (data->monitor_source);
+  if (data->monitor_real)
+    {
+      g_signal_handlers_disconnect_by_data (data->monitor_real, data);
+      g_object_unref (data->monitor_real);
+    }
+  g_free (data);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MonitorData, monitor_data_free)
+
+static void
+copy_file (const char *source,
+           const char *target_dir)
+{
+  char *basename = g_path_get_basename (source);
+  char *dest = g_build_filename (target_dir, basename, NULL);
+  gchar *contents = NULL;
+  gsize len;
+
+  if (g_file_get_contents (source, &contents, &len, NULL))
+    g_file_set_contents (dest, contents, len, NULL);
+
+  g_free (basename);
+  g_free (dest);
+  g_free (contents);
+}
+
+static void
+file_changed (GFileMonitor     *monitor,
+              GFile            *file,
+              GFile            *other_file,
+              GFileMonitorEvent event_type,
+              MonitorData      *data);
+
+static void
+update_real_monitor (MonitorData *data)
+{
+  char *real = realpath (data->source, NULL);
+  if (real == NULL)
+    {
+      g_debug ("unable to get real path to monitor host file %s: %s", data->source,
+               g_strerror (errno));
+      return;
+    }
+
+  /* source path matches real path, second monitor is not required, but an old
+   * one may still exist. set to NULL and compare to what we have. */
+  if (!g_strcmp0 (data->source, real))
+    {
+      free (real);
+      real = NULL;
+    }
+
+  /* no more work needed if the monitor we have matches the additional monitor
+     we need (including NULL == NULL) */
+  if (!g_strcmp0 (data->real, real))
+    {
+      free (real);
+      return;
+    }
+
+  /* otherwise we're not monitoring the right thing and need to remove
+     any old monitor and make a new one if needed */
+  free (data->real);
+  data->real = real;
+
+  if (data->monitor_real)
+    {
+      g_signal_handlers_disconnect_by_data (data->monitor_real, data);
+      g_clear_object (&(data->monitor_real));
+    }
+
+  if (!real)
+    return;
+
+  g_autoptr(GFile) r = g_file_new_for_path (real);
+  g_autoptr(GError) err = NULL;
+  data->monitor_real = g_file_monitor_file (r, G_FILE_MONITOR_NONE, NULL, &err);
+  if (!data->monitor_real)
+    {
+      g_debug ("failed to monitor host file %s (real path of %s): %s",
+               real, data->source, err->message);
+      return;
+    }
+
+  g_signal_connect (data->monitor_real, "changed", G_CALLBACK (file_changed), data);
+}
+
+static void
+file_changed (GFileMonitor     *monitor,
+              GFile            *file,
+              GFile            *other_file,
+              GFileMonitorEvent event_type,
+              MonitorData      *data)
+{
+  if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
+    return;
+
+  update_real_monitor (data);
+
+  copy_file (data->source, monitor_dir);
+}
+
+static MonitorData *
+setup_file_monitor (const char *source)
+{
+  g_autoptr(GFile) s = g_file_new_for_path (source);
+  g_autoptr(GError) err = NULL;
+  GFileMonitor *monitor = NULL;
+  MonitorData *data = NULL;
+
+  data = g_new0 (MonitorData, 1);
+  data->source = source;
+
+  monitor = g_file_monitor_file (s, G_FILE_MONITOR_NONE, NULL, &err);
+  if (monitor)
+    {
+      data->monitor_source = monitor;
+      g_signal_connect (monitor, "changed", G_CALLBACK (file_changed), data);
+    }
+  else
+    {
+      g_debug ("failed to monitor host file %s: %s", source, err->message);
+    }
+
+  update_real_monitor (data);
+
+  copy_file (source, monitor_dir);
+
+  return data;
+}
+
+static void
+message_handler (const gchar   *log_domain,
+                 GLogLevelFlags log_level,
+                 const gchar   *message,
+                 gpointer       user_data)
+{
+  /* Make this look like normal console output */
+  if (log_level & G_LOG_LEVEL_DEBUG)
+    g_printerr ("F: %s\n", message);
+  else
+    g_printerr ("%s: %s\n", g_get_prgname (), message);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  guint owner_id;
+  GMainLoop *loop;
+  gboolean replace;
+  gboolean verbose;
+  gboolean show_version;
+  GOptionContext *context;
+  GBusNameOwnerFlags flags;
+  g_autoptr(GError) error = NULL;
+  const GOptionEntry options[] = {
+    { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace,  "Replace old daemon.", NULL },
+    { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,  "Enable debug output.", NULL },
+    { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "Show program version.", NULL},
+    { NULL }
+  };
+  g_autoptr(MonitorData) m_resolv_conf = NULL, m_host_conf = NULL, m_hosts = NULL, m_localtime = NULL;
+
+  setlocale (LC_ALL, "");
+
+  g_setenv ("GIO_USE_VFS", "local", TRUE);
+
+  g_set_prgname (argv[0]);
+
+  g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, message_handler, NULL);
+
+  context = g_option_context_new ("");
+
+  replace = FALSE;
+  verbose = FALSE;
+  show_version = FALSE;
+
+  g_option_context_set_summary (context, "Flatpak session helper");
+  g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+
+  if (!g_option_context_parse (context, &argc, &argv, &error))
+    {
+      g_printerr ("%s: %s", g_get_application_name(), error->message);
+      g_printerr ("\n");
+      g_printerr ("Try \"%s --help\" for more information.",
+                  g_get_prgname ());
+      g_printerr ("\n");
+      g_option_context_free (context);
+      return 1;
+    }
+
+  if (show_version)
+    {
+      g_print (PACKAGE_STRING "\n");
+      return 0;
+    }
+
+  if (verbose)
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+
+  flatpak_migrate_from_xdg_app ();
+
+  client_pid_data_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)pid_data_free);
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+  if (session_bus == NULL)
+    {
+      g_printerr ("Can't find bus: %s\n", error->message);
+      return 1;
+    }
+
+  monitor_dir = g_build_filename (g_get_user_runtime_dir (), "flatpak-monitor", NULL);
+  if (g_mkdir_with_parents (monitor_dir, 0755) != 0)
+    {
+      g_print ("Can't create %s\n", monitor_dir);
+      exit (1);
+    }
+
+  m_resolv_conf = setup_file_monitor ("/etc/resolv.conf");
+  m_host_conf   = setup_file_monitor ("/etc/host.conf");
+  m_hosts       = setup_file_monitor ("/etc/hosts");
+  m_localtime   = setup_file_monitor ("/etc/localtime");
+
+  flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
+  if (replace)
+    flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
+
+  owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+                             "org.freedesktop.Flatpak",
+                             flags,
+                             on_bus_acquired,
+                             on_name_acquired,
+                             on_name_lost,
+                             NULL,
+                             NULL);
+
+  loop = g_main_loop_new (NULL, FALSE);
+  g_main_loop_run (loop);
+
+  g_bus_unown_name (owner_id);
+
+  return 0;
+}
diff --git a/session-helper/flatpak-session-helper.service.in b/session-helper/flatpak-session-helper.service.in
new file mode 100644 (file)
index 0000000..e14cc27
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=flatpak session helper
+
+[Service]
+BusName=org.freedesktop.Flatpak
+ExecStart=@libexecdir@/flatpak-session-helper
+Type=dbus
diff --git a/session-helper/org.freedesktop.Flatpak.service.in b/session-helper/org.freedesktop.Flatpak.service.in
new file mode 100644 (file)
index 0000000..e02215e
--- /dev/null
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.Flatpak
+Exec=@libexecdir@/flatpak-session-helper
+SystemdService=flatpak-session-helper.service
diff --git a/system-helper/Makefile.am.inc b/system-helper/Makefile.am.inc
new file mode 100644 (file)
index 0000000..c474986
--- /dev/null
@@ -0,0 +1,43 @@
+if BUILD_SYSTEM_HELPER
+
+libexec_PROGRAMS += \
+       flatpak-system-helper \
+       $(NULL)
+
+dbussystemservicedir = $(datadir)/dbus-1/system-services
+service_in_files += system-helper/org.freedesktop.Flatpak.SystemHelper.service.in
+dbussystemservice_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.service
+
+dbusconfdir = $(DBUS_CONFIG_DIR)
+dist_dbusconf_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.conf
+
+service_in_files += system-helper/flatpak-system-helper.service.in
+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
+flatpak_system_helper_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(POLKIT_CFLAGS)
+
+system-helper/org.freedesktop.Flatpak.rules: system-helper/org.freedesktop.Flatpak.rules.in
+       $(AM_V_GEN) $(SED) -e "s|\@privileged_group\@|$(PRIVILEGED_GROUP)|" $< > $@
+
+polkit_rulesdir = $(datadir)/polkit-1/rules.d
+polkit_rules_DATA =                                    \
+       system-helper/org.freedesktop.Flatpak.rules
+
+polkit_policydir = $(datadir)/polkit-1/actions
+polkit_policy_DATA =                                   \
+       system-helper/org.freedesktop.Flatpak.policy
+
+%.policy: %.policy.in
+       $(AM_V_GEN) $(MSGFMT) --xml -d $(top_srcdir)/po --template $< -o $@ || cp $< $@
+
+DISTCLEANFILES += system-helper/org.freedesktop.Flatpak.policy system-helper/org.freedesktop.Flatpak.rules system-helper/flatpak-system-helper.service system-helper/org.freedesktop.Flatpak.SystemHelper.service
+
+endif
+
+EXTRA_DIST += system-helper/org.freedesktop.Flatpak.policy.in system-helper/org.freedesktop.Flatpak.SystemHelper.conf system-helper/org.freedesktop.Flatpak.rules.in system-helper/org.freedesktop.Flatpak.SystemHelper.service.in system-helper/flatpak-system-helper.service.in
diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c
new file mode 100644 (file)
index 0000000..dc069b9
--- /dev/null
@@ -0,0 +1,1331 @@
+/*
+ * Copyright © 2014 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *       Alexander Larsson <alexl@redhat.com>
+ */
+
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <polkit/polkit.h>
+
+#include "flatpak-dbus.h"
+#include "flatpak-dir.h"
+#include "flatpak-oci-registry.h"
+#include "lib/flatpak-error.h"
+
+static PolkitAuthority *authority = NULL;
+static FlatpakSystemHelper *helper = NULL;
+static GMainLoop *main_loop = NULL;
+static guint name_owner_id = 0;
+
+static gboolean on_session_bus = FALSE;
+static gboolean no_idle_exit = FALSE;
+
+#define IDLE_TIMEOUT_SECS 10*60
+
+/* This uses a weird Auto prefix to avoid conflicts with later added polkit types.
+ */
+typedef PolkitAuthorizationResult AutoPolkitAuthorizationResult;
+typedef PolkitDetails AutoPolkitDetails;
+typedef PolkitSubject AutoPolkitSubject;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoPolkitAuthorizationResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoPolkitDetails, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoPolkitSubject, g_object_unref)
+
+static void
+skeleton_died_cb (gpointer data)
+{
+  g_debug ("skeleton finalized, exiting");
+  g_main_loop_quit (main_loop);
+}
+
+static gboolean
+unref_skeleton_in_timeout_cb (gpointer user_data)
+{
+  static gboolean unreffed = FALSE;
+  g_debug ("unreffing helper main ref");
+  if (!unreffed)
+    {
+      g_object_unref (helper);
+      unreffed = TRUE;
+    }
+
+  return G_SOURCE_REMOVE;
+}
+
+static void
+unref_skeleton_in_timeout (void)
+{
+  if (name_owner_id)
+    g_bus_unown_name (name_owner_id);
+  name_owner_id = 0;
+
+  /* After we've lost the name or idled we drop the main ref on the helper
+     so that we'll exit when it drops to zero. However, if there are
+     outstanding calls these will keep the refcount up during the
+     execution of them. We do the unref on a timeout to make sure
+     we're completely draining the queue of (stale) requests. */
+  g_timeout_add (500, unref_skeleton_in_timeout_cb, NULL);
+}
+
+static gboolean
+idle_timeout_cb (gpointer user_data)
+{
+  if (name_owner_id)
+    {
+      g_debug ("Idle - unowning name");
+      unref_skeleton_in_timeout ();
+    }
+  return G_SOURCE_REMOVE;
+}
+
+G_LOCK_DEFINE_STATIC (idle);
+static void
+schedule_idle_callback (void)
+{
+  static guint idle_timeout_id = 0;
+
+  G_LOCK(idle);
+
+  if (!no_idle_exit)
+    {
+      if (idle_timeout_id != 0)
+        g_source_remove (idle_timeout_id);
+
+      idle_timeout_id = g_timeout_add_seconds (IDLE_TIMEOUT_SECS, idle_timeout_cb, NULL);
+    }
+
+  G_UNLOCK(idle);
+}
+
+static FlatpakDir *
+dir_get_system (const char *installation, GError **error)
+{
+  FlatpakDir *system = NULL;
+
+  if (installation != NULL && *installation != '\0')
+    system = flatpak_dir_get_system_by_id (installation, NULL, error);
+  else
+    system = flatpak_dir_get_system_default ();
+
+  /* This can happen in case of error with flatpak_dir_get_system_by_id(). */
+  if (system == NULL)
+    return NULL;
+
+  flatpak_dir_set_no_system_helper (system, TRUE);
+  return system;
+}
+
+static void
+no_progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
+{
+}
+
+static gboolean
+handle_deploy (FlatpakSystemHelper   *object,
+               GDBusMethodInvocation *invocation,
+               const gchar           *arg_repo_path,
+               guint32                arg_flags,
+               const gchar           *arg_ref,
+               const gchar           *arg_origin,
+               const gchar *const    *arg_subpaths,
+               const gchar           *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GFile) path = g_file_new_for_path (arg_repo_path);
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(OstreeAsyncProgress) ostree_progress = NULL;
+  gboolean is_update;
+  gboolean is_oci;
+  gboolean no_deploy;
+  gboolean local_pull;
+  gboolean reinstall;
+  g_autoptr(GMainContext) main_context = NULL;
+  g_autofree char *url = NULL;
+
+  g_debug ("Deploy %s %u %s %s %s", arg_repo_path, arg_flags, arg_ref, arg_origin, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
+      return TRUE;
+    }
+
+  if (!g_file_query_exists (path, NULL))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Path does not exist");
+      return TRUE;
+    }
+
+  is_update = (arg_flags & FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
+  no_deploy = (arg_flags & FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY) != 0;
+  local_pull = (arg_flags & FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL) != 0;
+  reinstall = (arg_flags & FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL) != 0;
+
+  deploy_dir = flatpak_dir_get_if_deployed (system, arg_ref, NULL, NULL);
+
+  if (deploy_dir)
+    {
+      g_autofree char *real_origin = NULL;
+      if (!is_update)
+        {
+          if (!reinstall)
+            {
+              /* Can't install already installed app */
+              g_dbus_method_invocation_return_error (invocation, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                                                     "%s is already installed", arg_ref);
+              return TRUE;
+            }
+        }
+      else
+        {
+          real_origin = flatpak_dir_get_origin (system, arg_ref, NULL, NULL);
+          if (g_strcmp0 (real_origin, arg_origin) != 0)
+            {
+              g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                                     "Wrong origin %s for update", arg_origin);
+              return TRUE;
+            }
+        }
+    }
+  else if (!deploy_dir && is_update)
+    {
+      /* Can't update not installed app */
+      g_dbus_method_invocation_return_error (invocation, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                                             "%s is not installed", arg_ref);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                             "Can't open system repo %s", error->message);
+      return TRUE;
+    }
+
+  is_oci = flatpak_dir_get_remote_oci (system, arg_origin);
+
+  if (strlen (arg_repo_path) > 0 && is_oci)
+    {
+      g_autoptr(GFile) registry_file = g_file_new_for_path (arg_repo_path);
+      g_autofree char *registry_uri = g_file_get_uri (registry_file);
+      g_autoptr(FlatpakOciRegistry) registry = NULL;
+      g_autoptr(FlatpakOciIndex) index = NULL;
+      const FlatpakOciManifestDescriptor *desc;
+      g_autoptr(FlatpakOciVersioned) versioned = NULL;
+      g_autofree char *checksum = NULL;
+      g_autofree char *upstream_url = NULL;
+      g_autoptr(SoupSession) soup_session = NULL;
+
+      ostree_repo_remote_get_url (flatpak_dir_get_repo (system),
+                                  arg_origin,
+                                  &upstream_url,
+                                  NULL);
+
+      if (upstream_url == NULL)
+       {
+         g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                "Remote %s is disabled", arg_origin);
+         return TRUE;
+       }
+
+      registry = flatpak_oci_registry_new (registry_uri, FALSE, -1, NULL, &error);
+      if (registry == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child OCI registry: %s", error->message);
+          return TRUE;
+        }
+
+      index = flatpak_oci_registry_load_index (registry, NULL, NULL, NULL, &error);
+      if (index == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child OCI registry index: %s", error->message);
+          return TRUE;
+        }
+
+      desc = flatpak_oci_index_get_manifest (index, arg_ref);
+      if (desc == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't find ref %s in child OCI registry index", arg_ref);
+          return TRUE;
+        }
+
+      versioned = flatpak_oci_registry_load_versioned (registry, NULL, desc->parent.digest, NULL,
+                                                       NULL, &error);
+      if (versioned == NULL || !FLATPAK_IS_OCI_MANIFEST (versioned))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child manifest");
+          return TRUE;
+        }
+
+      soup_session = flatpak_create_soup_session (PACKAGE_STRING);
+      if (!flatpak_oci_index_verify_ref (soup_session,
+                                        upstream_url,
+                                        arg_ref,
+                                        desc->parent.digest,
+                                        NULL, &error))
+       {
+         g_dbus_method_invocation_return_gerror (invocation, error);
+         return TRUE;
+       }
+
+      checksum = flatpak_pull_from_oci (flatpak_dir_get_repo (system), registry, NULL, desc->parent.digest, FLATPAK_OCI_MANIFEST (versioned),
+                                        arg_origin, arg_ref, NULL, NULL, NULL, &error);
+      if (checksum == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't pull ref %s from child OCI registry index: %s", arg_ref, error->message);
+          return TRUE;
+        }
+    }
+  else if (strlen (arg_repo_path) > 0)
+    {
+      /* Work around ostree-pull spinning the default main context for the sync calls */
+      main_context = g_main_context_new ();
+      g_main_context_push_thread_default (main_context);
+
+      ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+
+      if (!flatpak_dir_pull_untrusted_local (system, arg_repo_path,
+                                             arg_origin,
+                                             arg_ref,
+                                             (const char **) arg_subpaths,
+                                             ostree_progress,
+                                             NULL, &error))
+        {
+          g_main_context_pop_thread_default (main_context);
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Error pulling from repo: %s", error->message);
+          return TRUE;
+        }
+      g_main_context_pop_thread_default (main_context);
+
+      if (ostree_progress)
+        ostree_async_progress_finish (ostree_progress);
+    }
+  else if (local_pull)
+    {
+      if (!ostree_repo_remote_get_url (flatpak_dir_get_repo (system),
+                                       arg_origin,
+                                       &url,
+                                       &error))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Error getting remote url: %s", error->message);
+          return TRUE;
+        }
+
+      if (!g_str_has_prefix (url, "file:"))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Local pull url doesn't start with file://");
+          return TRUE;
+        }
+
+      /* Work around ostree-pull spinning the default main context for the sync calls */
+      main_context = g_main_context_new ();
+      g_main_context_push_thread_default (main_context);
+
+      ostree_progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
+
+      if (!flatpak_dir_pull (system, arg_origin, arg_ref, NULL, NULL, (const char **)arg_subpaths, NULL,
+                             FLATPAK_PULL_FLAGS_NONE, OSTREE_REPO_PULL_FLAGS_UNTRUSTED, ostree_progress,
+                             NULL, &error))
+        {
+          g_main_context_pop_thread_default (main_context);
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Error pulling from repo: %s", error->message);
+          return TRUE;
+        }
+
+      g_main_context_pop_thread_default (main_context);
+
+      if (ostree_progress)
+        ostree_async_progress_finish (ostree_progress);
+    }
+
+  if (!no_deploy)
+    {
+      if (is_update)
+        {
+          if (!flatpak_dir_deploy_update (system, arg_ref,
+                                          NULL, (const char **)arg_subpaths, NULL, &error))
+            {
+              if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
+                g_dbus_method_invocation_return_error (invocation, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
+                                                       "%s", error->message);
+              else
+                g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                       "Error deploying: %s", error->message);
+              return TRUE;
+            }
+        }
+      else
+        {
+          if (!flatpak_dir_deploy_install (system, arg_ref, arg_origin,
+                                           (const char **) arg_subpaths,
+                                           reinstall,
+                                           NULL, &error))
+            {
+              g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                     "Error deploying: %s", error->message);
+              return TRUE;
+            }
+        }
+    }
+
+  flatpak_system_helper_complete_deploy (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_deploy_appstream (FlatpakSystemHelper   *object,
+                         GDBusMethodInvocation *invocation,
+                         const gchar           *arg_repo_path,
+                         const gchar           *arg_origin,
+                         const gchar           *arg_arch,
+                         const gchar           *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GFile) path = g_file_new_for_path (arg_repo_path);
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GMainContext) main_context = NULL;
+  g_autofree char *branch = NULL;
+  gboolean is_oci;
+
+  g_debug ("DeployAppstream %s %s %s %s", arg_repo_path, arg_origin, arg_arch, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!g_file_query_exists (path, NULL))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Path does not exist");
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                             "Can't open system repo %s", error->message);
+      return TRUE;
+    }
+
+  is_oci = flatpak_dir_get_remote_oci (system, arg_origin);
+
+  branch = g_strdup_printf ("appstream/%s", arg_arch);
+
+  if (is_oci)
+    {
+      g_autoptr(GFile) registry_file = g_file_new_for_path (arg_repo_path);
+      g_autofree char *registry_uri = g_file_get_uri (registry_file);
+      g_autoptr(FlatpakOciRegistry) registry = NULL;
+      g_autoptr(FlatpakOciIndex) index = NULL;
+      const FlatpakOciManifestDescriptor *desc;
+      g_autoptr(FlatpakOciVersioned) versioned = NULL;
+      g_autofree char *checksum = NULL;
+
+      registry = flatpak_oci_registry_new (registry_uri, FALSE, -1, NULL, &error);
+      if (registry == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child OCI registry: %s", error->message);
+          return TRUE;
+        }
+
+      index = flatpak_oci_registry_load_index (registry, NULL, NULL, NULL, &error);
+      if (index == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child OCI registry index: %s", error->message);
+          return TRUE;
+        }
+
+      desc = flatpak_oci_index_get_manifest (index, branch);
+      if (desc == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't find ref %s in child OCI registry index", branch);
+          return TRUE;
+        }
+
+      versioned = flatpak_oci_registry_load_versioned (registry, NULL, desc->parent.digest, NULL,
+                                                       NULL, &error);
+      if (versioned == NULL || !FLATPAK_IS_OCI_MANIFEST (versioned))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't open child manifest");
+          return TRUE;
+        }
+
+      checksum = flatpak_pull_from_oci (flatpak_dir_get_repo (system), registry, NULL, desc->parent.digest, FLATPAK_OCI_MANIFEST (versioned),
+                                        arg_origin, branch, NULL, NULL, NULL, &error);
+      if (checksum == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Can't pull ref %s from child OCI registry index: %s", branch, error->message);
+          return TRUE;
+        }
+    }
+  else
+    {
+      /* Work around ostree-pull spinning the default main context for the sync calls */
+      main_context = g_main_context_new ();
+      g_main_context_push_thread_default (main_context);
+
+      if (!flatpak_dir_pull_untrusted_local (system, arg_repo_path,
+                                             arg_origin,
+                                             branch,
+                                             NULL,
+                                             NULL,
+                                             NULL, &error))
+        {
+          g_main_context_pop_thread_default (main_context);
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Error pulling from repo: %s", error->message);
+          return TRUE;
+        }
+
+      g_main_context_pop_thread_default (main_context);
+    }
+
+  if (!flatpak_dir_deploy_appstream (system,
+                                     arg_origin,
+                                     arg_arch,
+                                     NULL,
+                                     NULL,
+                                     &error))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                             "Error deploying appstream: %s", error->message);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_deploy_appstream (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_uninstall (FlatpakSystemHelper *object,
+                  GDBusMethodInvocation *invocation,
+                  guint arg_flags,
+                  const gchar *arg_ref,
+                  const gchar *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_debug ("Uninstall %u %s %s", arg_flags, arg_ref, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if ((arg_flags & ~FLATPAK_HELPER_UNINSTALL_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_UNINSTALL_FLAGS_ALL));
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_uninstall (system, arg_ref, arg_flags, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_uninstall (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_install_bundle (FlatpakSystemHelper   *object,
+                       GDBusMethodInvocation *invocation,
+                       const gchar           *arg_bundle_path,
+                       guint32                arg_flags,
+                       const gchar           *arg_remote,
+                       const gchar           *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GFile) path = g_file_new_for_path (arg_bundle_path);
+  g_autoptr(GError) error = NULL;
+  g_autofree char *ref = NULL;
+
+  g_debug ("InstallBundle %s %u %s %s", arg_bundle_path, arg_flags, arg_remote, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (arg_flags != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", arg_flags);
+      return TRUE;
+    }
+
+  if (!g_file_query_exists (path, NULL))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+                                             "Bundle %s does not exist", arg_bundle_path);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_install_bundle (system, path, arg_remote, &ref, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_install_bundle (object, invocation, ref);
+
+  return TRUE;
+}
+
+
+static gboolean
+handle_configure_remote (FlatpakSystemHelper *object,
+                         GDBusMethodInvocation *invocation,
+                         guint arg_flags,
+                         const gchar *arg_remote,
+                         const gchar *arg_config,
+                         GVariant *arg_gpg_key,
+                         const gchar *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GKeyFile) config = g_key_file_new ();
+  g_autofree char *group = g_strdup_printf ("remote \"%s\"", arg_remote);
+  g_autoptr(GBytes) gpg_data = NULL;
+  gboolean force_remove;
+
+  g_debug ("ConfigureRemote %u %s %s", arg_flags, arg_remote, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (*arg_remote == 0 || strchr (arg_remote, '/') != NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Invalid remote name: %s", arg_remote);
+      return TRUE;
+    }
+
+  if ((arg_flags & ~FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_ALL));
+      return TRUE;
+    }
+
+  if (!g_key_file_load_from_data (config, arg_config, strlen (arg_config),
+                                  G_KEY_FILE_NONE, &error))
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Invalid config: %s\n", error->message);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (g_variant_get_size (arg_gpg_key) > 0)
+    gpg_data = g_variant_get_data_as_bytes (arg_gpg_key);
+
+  force_remove = (arg_flags & FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE) != 0;
+
+  if (g_key_file_has_group (config, group))
+    {
+      /* Add/Modify */
+      if (!flatpak_dir_modify_remote (system, arg_remote, config,
+                                      gpg_data, NULL, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+    }
+  else
+    {
+      /* Remove */
+      if (!flatpak_dir_remove_remote (system,
+                                      force_remove,
+                                      arg_remote,
+                                      NULL, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+    }
+
+  flatpak_system_helper_complete_configure_remote (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_configure (FlatpakSystemHelper *object,
+                 GDBusMethodInvocation *invocation,
+                 guint arg_flags,
+                 const gchar *arg_key,
+                 const gchar *arg_value,
+                 const gchar *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_debug ("Configure %u %s=%s %s", arg_flags, arg_key, arg_value, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if ((arg_flags & ~FLATPAK_HELPER_CONFIGURE_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_CONFIGURE_FLAGS_ALL));
+      return TRUE;
+    }
+
+  /* We only support this for now */
+  if (strcmp (arg_key, "languages") != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported key: %s", arg_key);
+      return TRUE;
+    }
+
+  if ((arg_flags & FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET) != 0)
+    arg_value = NULL;
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_set_config (system, arg_key, arg_value, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_configure (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_update_remote (FlatpakSystemHelper *object,
+                      GDBusMethodInvocation *invocation,
+                      guint arg_flags,
+                      const gchar *arg_remote,
+                      const gchar *arg_installation,
+                      const gchar *arg_summary_path,
+                      const gchar *arg_summary_sig_path)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+  char *summary_data = NULL;
+  gsize summary_size;
+  g_autoptr(GBytes) summary_bytes = NULL;
+  g_autoptr(GVariant) summary = NULL;
+  char *summary_sig_data = NULL;
+  gsize summary_sig_size;
+  g_autoptr(GBytes) summary_sig_bytes = NULL;
+  g_autoptr(OstreeGpgVerifyResult) gpg_result = NULL;
+  g_autofree char *collection_id = NULL;
+
+  g_debug ("UpdateRemote %u %s %s %s %s", arg_flags, arg_remote, arg_installation, arg_summary_path, arg_summary_sig_path);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (*arg_remote == 0 || strchr (arg_remote, '/') != NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Invalid remote name: %s", arg_remote);
+      return TRUE;
+    }
+
+  if ((arg_flags & ~FLATPAK_HELPER_UPDATE_REMOTE_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_UPDATE_REMOTE_FLAGS_ALL));
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+#ifdef FLATPAK_ENABLE_P2P
+  if (!ostree_repo_get_remote_option (flatpak_dir_get_repo (system), arg_remote, "collection-id",
+                                      NULL, &collection_id, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+  else if (collection_id != NULL && *collection_id == '\0')
+    g_clear_pointer (&collection_id, g_free);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  if (!g_file_get_contents (arg_summary_path, &summary_data, &summary_size, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+  summary_bytes = g_bytes_new_take (summary_data, summary_size);
+
+  if (collection_id == NULL)
+    {
+      if (!g_file_get_contents (arg_summary_sig_path, &summary_sig_data, &summary_sig_size, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+      summary_sig_bytes = g_bytes_new_take (summary_sig_data, summary_sig_size);
+
+      gpg_result = ostree_repo_verify_summary (flatpak_dir_get_repo (system),
+                                               arg_remote,
+                                               summary_bytes,
+                                               summary_sig_bytes,
+                                               NULL, &error);
+      if (gpg_result == NULL ||
+          !ostree_gpg_verify_result_require_valid_signature (gpg_result, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+
+      summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
+                                                              summary_bytes, FALSE));
+      if (!flatpak_dir_update_remote_configuration_for_summary (system, arg_remote, summary,
+                                                                FALSE, NULL, NULL, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+    }
+  else
+    {
+      if (!flatpak_dir_update_remote_configuration_for_repo_metadata (system, arg_remote, summary,
+                                                                      FALSE, NULL, NULL, &error))
+        {
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          return TRUE;
+        }
+    }
+
+  flatpak_system_helper_complete_update_remote (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_remove_local_ref (FlatpakSystemHelper   *object,
+                         GDBusMethodInvocation *invocation,
+                         const gchar           *arg_remote,
+                         const gchar           *arg_ref,
+                         const gchar           *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_debug ("RemoveLocalRef %s %s %s", arg_remote, arg_ref, arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (*arg_remote == 0 || strchr (arg_remote, '/') != NULL)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Invalid remote name: %s", arg_remote);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_remove_ref (system, arg_remote, arg_ref, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_remove_local_ref (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+handle_prune_local_repo (FlatpakSystemHelper   *object,
+                         GDBusMethodInvocation *invocation,
+                         const gchar           *arg_installation)
+{
+  g_autoptr(FlatpakDir) system = NULL;
+  g_autoptr(GError) error = NULL;
+
+  g_debug ("PruneLocalRepo %s", arg_installation);
+
+  system = dir_get_system (arg_installation, &error);
+  if (system == NULL)
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_ensure_repo (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  if (!flatpak_dir_prune (system, NULL, &error))
+    {
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      return TRUE;
+    }
+
+  flatpak_system_helper_complete_prune_local_repo (object, invocation);
+
+  return TRUE;
+}
+
+static gboolean
+flatpak_authorize_method_handler (GDBusInterfaceSkeleton *interface,
+                                  GDBusMethodInvocation  *invocation,
+                                  gpointer                user_data)
+{
+  const gchar *method_name = g_dbus_method_invocation_get_method_name (invocation);
+  const gchar *sender = g_dbus_method_invocation_get_sender (invocation);
+  GVariant *parameters = g_dbus_method_invocation_get_parameters (invocation);
+  g_autoptr(AutoPolkitSubject) subject = polkit_system_bus_name_new (sender);
+  g_autoptr(AutoPolkitDetails) details = polkit_details_new ();
+  const gchar *action = NULL;
+  gboolean authorized = FALSE;
+
+  /* Ensure we don't idle exit */
+  schedule_idle_callback ();
+
+  if (on_session_bus)
+    {
+      /* This is test code, make sure it never runs with privileges */
+      g_assert (geteuid () != 0);
+      g_assert (getuid () != 0);
+      g_assert (getegid () != 0);
+      g_assert (getgid () != 0);
+      authorized = TRUE;
+    }
+  else if (g_strcmp0 (method_name, "Deploy") == 0)
+    {
+      const char *ref, *origin;
+      guint32 flags;
+      gboolean is_update, is_app;
+
+      g_variant_get_child (parameters, 1, "u", &flags);
+      g_variant_get_child (parameters, 2, "&s", &ref);
+      g_variant_get_child (parameters, 3, "&s", &origin);
+
+      is_update = (flags & FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
+      is_app = g_str_has_prefix (ref, "app/");
+
+      if (is_update)
+        {
+          if (is_app)
+            action = "org.freedesktop.Flatpak.app-update";
+          else
+            action = "org.freedesktop.Flatpak.runtime-update";
+        }
+      else
+        {
+          if (is_app)
+            action = "org.freedesktop.Flatpak.app-install";
+          else
+            action = "org.freedesktop.Flatpak.runtime-install";
+        }
+
+      polkit_details_insert (details, "origin", origin);
+      polkit_details_insert (details, "ref", ref);
+    }
+  else if (g_strcmp0 (method_name, "DeployAppstream") == 0)
+    {
+      const char *arch, *origin;
+
+      g_variant_get_child (parameters, 1, "&s", &origin);
+      g_variant_get_child (parameters, 2, "&s", &arch);
+
+      action = "org.freedesktop.Flatpak.appstream-update";
+
+      polkit_details_insert (details, "origin", origin);
+      polkit_details_insert (details, "arch", arch);
+    }
+  else if (g_strcmp0 (method_name, "InstallBundle") == 0)
+    {
+      const char *path;
+
+      g_variant_get_child (parameters, 0, "^&ay", &path);
+
+      action = "org.freedesktop.Flatpak.install-bundle";
+
+      polkit_details_insert (details, "path", path);
+    }
+  else if (g_strcmp0 (method_name, "Uninstall") == 0)
+    {
+      const char *ref;
+      gboolean is_app;
+
+      g_variant_get_child (parameters, 1, "&s", &ref);
+
+      is_app = g_str_has_prefix (ref, "app/");
+      if (is_app)
+        action = "org.freedesktop.Flatpak.app-uninstall";
+      else
+        action = "org.freedesktop.Flatpak.runtime-uninstall";
+
+      polkit_details_insert (details, "ref", ref);
+    }
+  else if (g_strcmp0 (method_name, "ConfigureRemote") == 0)
+    {
+      const char *remote;
+
+      g_variant_get_child (parameters, 1, "&s", &remote);
+
+      action = "org.freedesktop.Flatpak.configure-remote";
+
+      polkit_details_insert (details, "remote", remote);
+    }
+  else if (g_strcmp0 (method_name, "Configure") == 0)
+    {
+      const char *key;
+
+      g_variant_get_child (parameters, 1, "&s", &key);
+
+      action = "org.freedesktop.Flatpak.configure";
+
+      polkit_details_insert (details, "key", key);
+    }
+  else if (g_strcmp0 (method_name, "UpdateRemote") == 0)
+    {
+      const char *remote;
+
+      g_variant_get_child (parameters, 1, "&s", &remote);
+
+      action = "org.freedesktop.Flatpak.update-remote";
+
+      polkit_details_insert (details, "remote", remote);
+    }
+  else if (g_strcmp0 (method_name, "RemoveLocalRef") == 0 ||
+           g_strcmp0 (method_name, "PruneLocalRepo") == 0)
+    {
+      const char *remote;
+
+      g_variant_get_child (parameters, 0, "&s", &remote);
+
+      action = "org.freedesktop.Flatpak.modify-repo";
+
+      polkit_details_insert (details, "remote", remote);
+    }
+
+  if (action)
+    {
+      g_autoptr(AutoPolkitAuthorizationResult) result = NULL;
+      g_autoptr(GError) error = NULL;
+
+      result = polkit_authority_check_authorization_sync (authority, subject,
+                                                          action, details,
+                                                          POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+                                                          NULL, &error);
+      if (result == NULL)
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+                                                 "Authorization error: %s", error->message);
+          return FALSE;
+        }
+
+      authorized = polkit_authorization_result_get_is_authorized (result);
+    }
+
+  if (!authorized)
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             G_DBUS_ERROR,
+                                             G_DBUS_ERROR_ACCESS_DENIED,
+                                             "Flatpak system operation %s not allowed for user", method_name);
+    }
+
+  return authorized;
+}
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
+{
+  GError *error = NULL;
+
+  g_debug ("Bus acquired, creating skeleton");
+
+  helper = flatpak_system_helper_skeleton_new ();
+
+  flatpak_system_helper_set_version (FLATPAK_SYSTEM_HELPER (helper), 1);
+
+  g_object_set_data_full (G_OBJECT(helper), "track-alive", GINT_TO_POINTER(42), skeleton_died_cb);
+
+  g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (helper),
+                                       G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);
+
+  g_signal_connect (helper, "handle-deploy", G_CALLBACK (handle_deploy), NULL);
+  g_signal_connect (helper, "handle-deploy-appstream", G_CALLBACK (handle_deploy_appstream), NULL);
+  g_signal_connect (helper, "handle-uninstall", G_CALLBACK (handle_uninstall), NULL);
+  g_signal_connect (helper, "handle-install-bundle", G_CALLBACK (handle_install_bundle), NULL);
+  g_signal_connect (helper, "handle-configure-remote", G_CALLBACK (handle_configure_remote), NULL);
+  g_signal_connect (helper, "handle-configure", G_CALLBACK (handle_configure), NULL);
+  g_signal_connect (helper, "handle-update-remote", G_CALLBACK (handle_update_remote), NULL);
+  g_signal_connect (helper, "handle-remove-local-ref", G_CALLBACK (handle_remove_local_ref), NULL);
+  g_signal_connect (helper, "handle-prune-local-repo", G_CALLBACK (handle_prune_local_repo), NULL);
+
+  g_signal_connect (helper, "g-authorize-method",
+                    G_CALLBACK (flatpak_authorize_method_handler),
+                    NULL);
+
+  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
+                                         connection,
+                                         "/org/freedesktop/Flatpak/SystemHelper",
+                                         &error))
+    {
+      g_warning ("error: %s", error->message);
+      g_error_free (error);
+    }
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+                  const gchar     *name,
+                  gpointer         user_data)
+{
+  g_debug ("Name acquired");
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+              const gchar     *name,
+              gpointer         user_data)
+{
+  g_debug ("Name lost");
+  unref_skeleton_in_timeout ();
+}
+
+static void
+binary_file_changed_cb (GFileMonitor *file_monitor,
+                        GFile *file,
+                        GFile *other_file,
+                        GFileMonitorEvent event_type,
+                        gpointer data)
+{
+  static gboolean got_it = FALSE;
+
+  if (!got_it)
+    {
+      g_debug ("binary file changed");
+      unref_skeleton_in_timeout ();
+    }
+
+  got_it = TRUE;
+}
+
+static void
+message_handler (const gchar   *log_domain,
+                 GLogLevelFlags log_level,
+                 const gchar   *message,
+                 gpointer       user_data)
+{
+  /* Make this look like normal console output */
+  if (log_level & G_LOG_LEVEL_DEBUG)
+    g_printerr ("F: %s\n", message);
+  else
+    g_printerr ("%s: %s\n", g_get_prgname (), message);
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+  gchar exe_path[PATH_MAX+1];
+  ssize_t exe_path_len;
+  gboolean replace;
+  gboolean verbose;
+  gboolean show_version;
+  GBusNameOwnerFlags flags;
+  GOptionContext *context;
+  g_autoptr(GError) error = NULL;
+  const GOptionEntry options[] = {
+    { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace,  "Replace old daemon.", NULL },
+    { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,  "Enable debug output.", NULL },
+    { "session", 0, 0, G_OPTION_ARG_NONE, &on_session_bus,  "Run in session, not system scope (for tests).", NULL },
+    { "no-idle-exit", 0, 0, G_OPTION_ARG_NONE, &no_idle_exit,  "Don't exit when idle.", NULL },
+    { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "Show program version.", NULL},
+    { NULL }
+  };
+
+  setlocale (LC_ALL, "");
+
+  g_setenv ("GIO_USE_VFS", "local", TRUE);
+
+  g_set_prgname (argv[0]);
+
+  g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, message_handler, NULL);
+
+  context = g_option_context_new ("");
+
+  replace = FALSE;
+  verbose = FALSE;
+  show_version = FALSE;
+
+  g_option_context_set_summary (context, "Flatpak system helper");
+  g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+
+  if (!g_option_context_parse (context, &argc, &argv, &error))
+    {
+      g_printerr ("%s: %s", g_get_application_name(), error->message);
+      g_printerr ("\n");
+      g_printerr ("Try \"%s --help\" for more information.",
+                  g_get_prgname ());
+      g_printerr ("\n");
+      g_option_context_free (context);
+      return 1;
+    }
+
+  if (show_version)
+    {
+      g_print (PACKAGE_STRING "\n");
+      return 0;
+    }
+
+  if (verbose)
+    g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+
+  if (!on_session_bus)
+    {
+      authority = polkit_authority_get_sync (NULL, &error);
+      if (authority == NULL)
+        {
+          g_printerr ("Can't get polkit authority: %s\n", error->message);
+          return 1;
+        }
+    }
+
+  exe_path_len = readlink ("/proc/self/exe", exe_path, sizeof (exe_path) - 1);
+  if (exe_path_len > 0)
+    {
+      exe_path[exe_path_len] = 0;
+      GFileMonitor *monitor;
+      g_autoptr(GFile) exe = NULL;
+      g_autoptr(GError) local_error = NULL;
+
+      exe = g_file_new_for_path (exe_path);
+      monitor =  g_file_monitor_file (exe,
+                                      G_FILE_MONITOR_NONE,
+                                      NULL,
+                                      &local_error);
+      if (monitor == NULL)
+        g_warning ("Failed to set watch on %s: %s", exe_path, error->message);
+      else
+        g_signal_connect (monitor, "changed",
+                          G_CALLBACK (binary_file_changed_cb), NULL);
+    }
+
+  flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
+  if (replace)
+    flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
+
+  name_owner_id = g_bus_own_name (on_session_bus ? G_BUS_TYPE_SESSION  : G_BUS_TYPE_SYSTEM,
+                                  "org.freedesktop.Flatpak.SystemHelper",
+                                  flags,
+                                  on_bus_acquired,
+                                  on_name_acquired,
+                                  on_name_lost,
+                                  NULL,
+                                  NULL);
+
+  /* Ensure we don't idle exit */
+  schedule_idle_callback ();
+
+  main_loop = g_main_loop_new (NULL, FALSE);
+  g_main_loop_run (main_loop);
+
+  return 0;
+}
diff --git a/system-helper/flatpak-system-helper.service.in b/system-helper/flatpak-system-helper.service.in
new file mode 100644 (file)
index 0000000..2ba5e03
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=flatpak system helper
+
+[Service]
+BusName=org.freedesktop.Flatpak.SystemHelper
+Environment=XDG_DATA_DIRS=@localstatedir@/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
+ExecStart=@libexecdir@/flatpak-system-helper
+Type=dbus
diff --git a/system-helper/org.freedesktop.Flatpak.SystemHelper.conf b/system-helper/org.freedesktop.Flatpak.SystemHelper.conf
new file mode 100644 (file)
index 0000000..4aac5b8
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- This configuration file specifies the required security policies
+       for the the flatpak system helper to work. -->
+
+  <policy user="root">
+    <allow own="org.freedesktop.Flatpak.SystemHelper"/>
+  </policy>
+
+ <!-- Allow anyone to call into the service - we'll reject callers using PolicyKit -->
+  <policy context="default">
+    <allow send_destination="org.freedesktop.Flatpak.SystemHelper"
+           send_interface="org.freedesktop.Flatpak.SystemHelper"/>
+    <allow send_destination="org.freedesktop.Flatpak.SystemHelper"
+           send_interface="org.freedesktop.DBus.Introspectable"/>
+    <allow send_destination="org.freedesktop.Flatpak.SystemHelper"
+           send_interface="org.freedesktop.DBus.Peer"/>
+  </policy>
+
+</busconfig>
diff --git a/system-helper/org.freedesktop.Flatpak.SystemHelper.service.in b/system-helper/org.freedesktop.Flatpak.SystemHelper.service.in
new file mode 100644 (file)
index 0000000..a6c7715
--- /dev/null
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.freedesktop.Flatpak.SystemHelper
+Exec=@libexecdir@/flatpak-system-helper@extraargs@
+SystemdService=flatpak-system-helper.service
+User=root
diff --git a/system-helper/org.freedesktop.Flatpak.policy.in b/system-helper/org.freedesktop.Flatpak.policy.in
new file mode 100644 (file)
index 0000000..a859cf8
--- /dev/null
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
+<policyconfig>
+
+  <!--
+    Policy definitions for Flatpak system actions.
+    Copyright (c) 2016 Alexander Larsson <alexl@redhat.com>
+  -->
+
+  <vendor>The Flatpak Project</vendor>
+  <vendor_url>https://cgit.freedesktop.org/xdg-app/xdg-app/</vendor_url>
+  <icon_name>package-x-generic</icon_name>
+
+  <action id="org.freedesktop.Flatpak.app-install">
+    <!-- SECURITY:
+          - Normal users do not need authentication to install signed applications
+            from signed repositories, as this cannot exploit a system.
+          - Paranoid users (or parents!) can change this to 'auth_admin' or
+            'auth_admin_keep'.
+     -->
+    <description>Install signed application</description>
+    <message>Authentication is required to install software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.runtime-install">
+    <!-- SECURITY:
+          - Normal users do not need authentication to install signed applications
+            from signed repositories, as this cannot exploit a system.
+          - Paranoid users (or parents!) can change this to 'auth_admin' or
+            'auth_admin_keep'.
+     -->
+    <description>Install signed runtime</description>
+    <message>Authentication is required to install software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.app-update">
+    <!-- SECURITY:
+          - Normal users do not require admin authentication to update an
+            app as the commit will be signed, and the action is required
+            to update the system when unattended.
+          - Changing this to anything other than 'yes' will break unattended
+            updates.
+     -->
+    <description>Update signed application</description>
+    <message>Authentication is required to update software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>yes</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.runtime-update">
+    <!-- SECURITY:
+          - Normal users do not require admin authentication to update a
+            runtime as the commit will be signed, and the action is required
+            to update the system when unattended.
+          - Changing this to anything other than 'yes' will break unattended
+            updates.
+     -->
+    <description>Update signed runtime</description>
+    <message>Authentication is required to update software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>yes</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.update-remote">
+    <!-- SECURITY:
+          - Normal users do not need authentication to update metadata
+            from signed repositories.
+     -->
+    <description>Update remote metadata</description>
+    <message>Authentication is required to update remote info</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>yes</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.modify-repo">
+    <!-- SECURITY:
+          - Normal users do not need authentication to modify the
+            OSTree repository
+     -->
+    <description>Update system repository</description>
+    <message>Authentication is required to update the system repository</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>yes</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.install-bundle">
+    <description>Install bundle</description>
+    <message>Authentication is required to install software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.runtime-uninstall">
+    <description>Uninstall runtime</description>
+    <message>Authentication is required to uninstall software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.app-uninstall">
+    <description>Uninstall app</description>
+    <message>Authentication is required to uninstall software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.configure-remote">
+    <description>Configure Remote</description>
+    <message>Authentication is required to configure software repositories</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.configure">
+    <description>Configure</description>
+    <message>Authentication is required to configure software installation</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+
+  <action id="org.freedesktop.Flatpak.appstream-update">
+    <!-- SECURITY:
+          - Normal users do not require admin authentication to update
+            appstream data as it will be signed, and the action is required
+            to update the system when unattended.
+          - Changing this to anything other than 'yes' will break unattended
+            updates.
+     -->
+    <description>Update appstream</description>
+    <message>Authentication is required to update software</message>
+    <icon_name>package-x-generic</icon_name>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>yes</allow_active>
+    </defaults>
+  </action>
+
+</policyconfig>
diff --git a/system-helper/org.freedesktop.Flatpak.rules.in b/system-helper/org.freedesktop.Flatpak.rules.in
new file mode 100644 (file)
index 0000000..c2ec6a9
--- /dev/null
@@ -0,0 +1,11 @@
+polkit.addRule(function(action, subject) {
+    if ((action.id == "org.freedesktop.Flatpak.app-install" ||
+         action.id == "org.freedesktop.Flatpak.runtime-install"||
+         action.id == "org.freedesktop.Flatpak.app-uninstall" ||
+         action.id == "org.freedesktop.Flatpak.runtime-uninstall" ||
+         action.id == "org.freedesktop.Flatpak.modify-repo") &&
+        subject.active == true && subject.local == true &&
+        subject.isInGroup("@privileged_group@")) {
+            return polkit.Result.YES;
+    }
+});
diff --git a/test-driver b/test-driver
new file mode 100755 (executable)
index 0000000..8e575b0
--- /dev/null
@@ -0,0 +1,148 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2013-07-13.22; # UTC
+
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+  echo "$0: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
+              [--enable-hard-errors={yes|no}] [--]
+              TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+test_name= # Used for reporting.
+log_file=  # Where to save the output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "test-driver $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+   *) break;;
+  esac
+  shift
+done
+
+missing_opts=
+test x"$test_name" = x && missing_opts="$missing_opts --test-name"
+test x"$log_file"  = x && missing_opts="$missing_opts --log-file"
+test x"$trs_file"  = x && missing_opts="$missing_opts --trs-file"
+if test x"$missing_opts" != x; then
+  usage_error "the following mandatory options are missing:$missing_opts"
+fi
+
+if test $# -eq 0; then
+  usage_error "missing argument"
+fi
+
+if test $color_tests = yes; then
+  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+  red='\e[0;31m' # Red.
+  grn='\e[0;32m' # Green.
+  lgn='\e[1;32m' # Light green.
+  blu='\e[1;34m' # Blue.
+  mgn='\e[0;35m' # Magenta.
+  std='\e[m'     # No color.
+else
+  red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+  tweaked_estatus=1
+else
+  tweaked_estatus=$estatus
+fi
+
+case $tweaked_estatus:$expect_failure in
+  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
+  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
+  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
+  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
+  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
+esac
+
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc
new file mode 100644 (file)
index 0000000..2aef5d5
--- /dev/null
@@ -0,0 +1,141 @@
+AM_TESTS_ENVIRONMENT = FLATPAK_TESTS_DEBUG=1 \
+       FLATPAK_TRIGGERSDIR=$$(cd $(top_srcdir) && pwd)/triggers \
+       FLATPAK_DBUSPROXY=$$(cd $(top_builddir) && pwd)/flatpak-dbus-proxy \
+       GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
+       LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd)$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \
+       PATH=$$(cd $(top_builddir) && pwd):$${PATH} \
+       $(NULL)
+
+if WITH_SYSTEM_BWRAP
+AM_TESTS_ENVIRONMENT += FLATPAK_BWRAP=$(BWRAP)
+else
+AM_TESTS_ENVIRONMENT += FLATPAK_BWRAP=$$(cd $(top_builddir) && pwd)/flatpak-bwrap
+endif
+
+testdb_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+testdb_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             $(OSTREE_LIBS) \
+             libglnx.la \
+             libflatpak-common.la \
+             $(NULL)
+testdb_SOURCES = tests/testdb.c
+
+test_doc_portal_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+test_doc_portal_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             $(OSTREE_LIBS) \
+             libglnx.la \
+             libflatpak-common.la \
+             $(NULL)
+test_doc_portal_SOURCES = tests/test-doc-portal.c
+nodist_test_doc_portal_SOURCES = $(xdp_dbus_built_sources)
+
+testlibrary_CFLAGS = $(AM_CFLAGS) $(BASE_CFLAGS)
+testlibrary_LDADD = \
+             $(AM_LDADD) \
+             $(BASE_LIBS) \
+             libglnx.la \
+             libflatpak.la \
+             $(NULL)
+testlibrary_SOURCES = tests/testlibrary.c
+
+EXTRA_test_doc_portal_DEPENDENCIES = tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service  tests/services/org.freedesktop.Flatpak.service tests/services/org.freedesktop.Flatpak.SystemHelper.service
+
+tests/services/org.freedesktop.portal.Documents.service: document-portal/org.freedesktop.portal.Documents.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.impl.portal.PermissionStore.service: permission-store/org.freedesktop.impl.portal.PermissionStore.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.Flatpak.service: session-helper/org.freedesktop.Flatpak.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@
+
+tests/services/org.freedesktop.Flatpak.SystemHelper.service: system-helper/org.freedesktop.Flatpak.SystemHelper.service.in
+       mkdir -p tests/services
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $< > $@
+
+tests/libtest.sh: tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service  tests/services/org.freedesktop.Flatpak.service
+
+install-test-data-hook:
+if ENABLE_INSTALLED_TESTS
+       mkdir -p $(DESTDIR)$(installed_testdir)/services
+       ln -sf $(dbus_servicedir)/org.freedesktop.Flatpak.service $(DESTDIR)$(installed_testdir)/services/
+       ln -sf $(dbus_servicedir)/org.freedesktop.portal.Documents.service $(DESTDIR)$(installed_testdir)/services/
+       ln -sf $(dbus_servicedir)/org.freedesktop.impl.portal.PermissionStore.service $(DESTDIR)$(installed_testdir)/services/
+       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $(top_srcdir)/system-helper/org.freedesktop.Flatpak.SystemHelper.service.in > $(DESTDIR)$(installed_testdir)/services/org.freedesktop.Flatpak.SystemHelper.service
+endif
+
+tests/package_version.txt: Makefile
+       echo $(PACKAGE_VERSION) > tests/package_version.txt
+
+tests/test-basic.sh: tests/package_version.txt
+
+dist_installed_test_extra_scripts += \
+       buildutil/tap-driver.sh \
+       tests/make-test-app.sh \
+       tests/make-test-runtime.sh \
+       tests/make-test-bundles.sh \
+       tests/test-webserver.sh \
+       $(NULL)
+
+dist_installed_test_data = \
+       tests/libtest.sh \
+       tests/org.test.Hello.png \
+       tests/package_version.txt \
+       tests/session.conf.in \
+       $(NULL)
+
+installed_test_keyringdir = $(installed_testdir)/test-keyring
+installed_test_keyring2dir = $(installed_testdir)/test-keyring2
+installed_test_dbsdir = $(installed_testdir)/dbs
+
+if ENABLE_INSTALLED_TESTS
+dist_installed_test_keyring_DATA = \
+       tests/test-keyring/README \
+       tests/test-keyring/pubring.gpg \
+       tests/test-keyring/secring.gpg \
+       $(NULL)
+dist_installed_test_keyring2_DATA = \
+       tests/test-keyring2/README \
+       tests/test-keyring2/pubring.gpg \
+       tests/test-keyring2/secring.gpg \
+       $(NULL)
+dist_installed_test_dbs_DATA = tests/dbs/no_tables
+endif
+
+dist_test_scripts = \
+       tests/test-basic.sh \
+       tests/test-run.sh \
+       tests/test-run-system.sh \
+       tests/test-run-deltas.sh \
+       tests/test-run-system-deltas.sh \
+       tests/test-repo.sh \
+       tests/test-repo-collections.sh \
+       tests/test-repo-collections-server-only.sh \
+       tests/test-repo-system.sh \
+       tests/test-extensions.sh \
+       tests/test-bundle.sh \
+       tests/test-bundle-system.sh \
+       tests/test-oci.sh \
+       tests/test-unsigned-summaries.sh \
+       tests/test-update-remote-configuration.sh \
+       $(NULL)
+
+test_programs = testdb test-doc-portal testlibrary
+
+@VALGRIND_CHECK_RULES@
+VALGRIND_SUPPRESSIONS_FILES=tests/flatpak.supp tests/glib.supp
+EXTRA_DIST += tests/flatpak.supp tests/glib.supp
+DISTCLEANFILES += \
+       tests/services/org.freedesktop.Flatpak.service \
+       tests/services/org.freedesktop.portal.Documents.service \
+       tests/services/org.freedesktop.impl.portal.PermissionStore.service \
+       tests/services/org.freedesktop.Flatpak.SystemHelper.service \
+       tests/package_version.txt \
+       $(NULL)
diff --git a/tests/dbs/no_tables b/tests/dbs/no_tables
new file mode 100644 (file)
index 0000000..c700bdb
Binary files /dev/null and b/tests/dbs/no_tables differ
diff --git a/tests/flatpak.supp b/tests/flatpak.supp
new file mode 100644 (file)
index 0000000..f053fb1
--- /dev/null
@@ -0,0 +1,140 @@
+# Use this to suppress "possibly lost" for global statics
+{
+   handle_reflink
+   Memcheck:Param
+   ioctl(generic)
+   fun:ioctl
+   fun:btrfs_reflink_with_progress
+   fun:file_copy_fallback
+}
+
+# https://github.com/ostreedev/ostree/issues/533
+{
+   ignore_static_delta_uninitialized
+   Memcheck:Cond
+   ...
+   fun:_ostree_lzma_compressor_convert
+   fun:write_internal
+   fun:g_output_stream_real_splice
+   fun:g_output_stream_splice
+   fun:ostree_repo_static_delta_generate
+}
+
+# ioctl FICLONE is apparently not supported
+{
+   ignore_ioctl_ficlone
+   Memcheck:Param
+   ioctl(generic)
+   fun:ioctl
+   fun:glnx_regfile_copy_bytes
+   fun:glnx_file_copy_at
+}
+
+# There seem to be some leaks in "ostree pull", lets just ignore them for now
+{
+  ignore_ostree_pull1
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:ostree_fetcher_session_thread
+}
+{
+  ignore_ostree_pull2
+  Memcheck:Leak
+  fun:realloc
+  ...
+  fun:ostree_fetcher_session_thread
+}
+{
+  ignore_ostree_pull3
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:ostree_repo_write_metadata_async
+}
+{
+  ignore_ostree_pull4
+  Memcheck:Leak
+  fun:calloc
+  ...
+  fun:ostree_repo_write_metadata_async
+}
+{
+  ignore_ostree_pull5
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:write_metadata_thread
+}
+{
+  ignore_ostree_pull6
+  Memcheck:Leak
+  fun:calloc
+  ...
+  fun:write_metadata_thread
+}
+# static delta generation seem to leak too...
+{
+  ignore_ostree_delta1
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:generate_delta_thread
+}
+{
+  ignore_ostree_delta2
+  Memcheck:Leak
+  fun:calloc
+  ...
+  fun:generate_delta_thread
+}
+{
+  ignore_ostree_delta3
+  Memcheck:Leak
+  fun:realloc
+  ...
+  fun:generate_delta_thread
+}
+# writing content...
+{
+  ignore_ostree_write_content1
+  Memcheck:Leak
+  fun:g_type_create_instance
+  ...
+  fun:write_content_thread
+}
+{
+  ignore_ostree_write_content2
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:write_content_thread
+}
+{
+  ignore_ostree_write_content3
+  Memcheck:Leak
+  fun:malloc
+  ...
+  fun:ostree_repo_write_content_async
+}
+
+# Some glib threadpool issue?
+{
+  ignore_gthreadpool1
+  Memcheck:Leak
+  fun:calloc
+  ...
+  fun:g_idle_source_new
+  ...
+  fun:g_thread_pool_thread_proxy
+}
+
+# libsoup thing
+{
+  ignore_libsoup_file_leak
+  Memcheck:Leak
+  fun:calloc
+  ...
+  fun:_g_local_file_new
+  fun:soup_request_file_ensure_file
+}
diff --git a/tests/glib.supp b/tests/glib.supp
new file mode 100644 (file)
index 0000000..c3e00ed
--- /dev/null
@@ -0,0 +1,580 @@
+# Based on the libhif supressions
+{
+   gobject_init_1
+   Memcheck:Leak
+   ...
+   fun:gobject_init
+}
+{
+   g_type_register_static_1
+   Memcheck:Leak
+   ...
+   fun:g_type_register_static
+}
+{
+   g_type_register_fundamental
+   Memcheck:Leak
+   ...
+   fun:g_type_register_fundamental
+}
+{
+   g_type_register_dynamic_1
+   Memcheck:Leak
+   ...
+   fun:g_type_register_dynamic
+}
+{
+   g_type_init_with_debug_flags
+   Memcheck:Leak
+   ...
+   fun:g_type_init_with_debug_flags
+}
+{
+   g_type_class_ref_1
+   Memcheck:Leak
+   ...
+   fun:type_iface_vtable_base_init_Wm
+   ...
+   fun:g_type_class_ref
+}
+{
+   g_type_class_ref_2
+   Memcheck:Leak
+   ...
+   fun:type_class_init_Wm
+   ...
+   fun:g_type_class_ref
+}
+{
+   g_type_add_interface_static
+   Memcheck:Leak
+   ...
+   fun:g_type_add_interface_static
+}
+{
+   g_param_spec_internal
+   Memcheck:Leak
+   ...
+   fun:g_type_class_ref
+   fun:g_type_create_instance
+   fun:g_param_spec_internal
+}
+{
+   g_param_spec_enum
+   Memcheck:Leak
+   ...
+   fun:g_type_class_ref
+   fun:g_param_spec_enum
+}
+{
+   g_param_spec_flags
+   Memcheck:Leak
+   ...
+   fun:g_type_class_ref
+   fun:g_param_spec_flags
+}
+{
+   g_quark_from_static_string
+   Memcheck:Leak
+   ...
+   fun:g_quark_from_static_string
+}
+{
+   g_quark_from_string
+   Memcheck:Leak
+   ...
+   fun:g_quark_from_string
+}
+{
+   g_value_register_transform_func
+   Memcheck:Leak
+   ...
+   fun:g_value_register_transform_func
+}
+{
+   test_run_seed
+   Memcheck:Leak
+   ...
+   fun:g_rand_new_with_seed_array
+   fun:test_run_seed
+   ...
+   fun:g_test_run_suite
+}
+{
+   g_test_init
+   Memcheck:Leak
+   ...
+   fun:g_rand_new_with_seed_array
+   ...
+   fun:g_test_init
+}
+{
+   g_intern_static_string
+   Memcheck:Leak
+   ...
+   fun:g_intern_static_string
+}
+{
+   g_main_context_push_thread_default
+   Memcheck:Leak
+   ...
+   fun:g_queue_new
+   fun:g_main_context_push_thread_default
+}
+{
+   g_main_context_push_thread_default_inlined
+   Memcheck:Leak
+   ...
+   fun:g_slice_alloc0
+   fun:g_main_context_push_thread_default
+}
+{
+   g_dbus_error_register_error
+   Memcheck:Leak
+   ...
+   fun:g_dbus_error_register_error
+}
+{
+   g_param_spec_pool_insert
+   Memcheck:Leak
+   ...
+   fun:g_param_spec_pool_insert
+}
+{
+   g_main_context_default
+   Memcheck:Leak
+   ...
+   fun:g_main_context_default
+}
+{
+   g_main_context_check
+   Memcheck:Leak
+   ...
+   fun:g_ptr_array_add
+   fun:g_main_context_check
+}
+{
+   g_test_run_suite
+   Memcheck:Leak
+   ...
+   fun:g_slist_copy
+   fun:g_test_run_suite_internal
+   fun:g_test_run_suite
+}
+{
+   g_dbus_interface_info_cache_build
+   Memcheck:Leak
+   ...
+   fun:g_dbus_interface_info_cache_build
+}
+{
+   g_cancellable_push_current
+   Memcheck:Leak
+   ...
+   fun:thread_memory_from_self
+   ...
+   fun:g_cancellable_push_current
+}
+{
+   _g_io_module_get_default
+   Memcheck:Leak
+   ...
+   fun:g_io_module_new
+   fun:g_io_modules_scan_all_in_directory_with_scope
+   fun:_g_io_modules_ensure_loaded
+   fun:_g_io_module_get_default
+}
+{
+   g_io_scheduler_push_job
+   Memcheck:Leak
+   ...
+   fun:init_scheduler
+   fun:g_once_impl
+   fun:g_io_scheduler_push_job
+}
+{
+   g_io_scheduler_push_job_2
+   Memcheck:Leak
+   ...
+   fun:g_system_thread_new
+   ...
+   fun:g_io_scheduler_push_job
+}
+{
+   g_bus_get_sync__available_connections
+   Memcheck:Leak
+   ...
+   fun:g_hash_table_new
+   fun:initable_init
+   fun:g_initable_init
+   fun:g_bus_get_sync
+}
+{
+   g_socket_connection_factory_register_type
+   Memcheck:Leak
+   ...
+   fun:g_socket_connection_factory_register_type
+}
+{
+   g_test_add_vtable
+   Memcheck:Leak
+   ...
+   fun:g_test_add_vtable
+}
+{
+   g_mutex_lock
+   Memcheck:Leak
+   ...
+   fun:g_mutex_impl_new
+   fun:g_mutex_get_impl
+   fun:g_mutex_lock
+}
+{
+   g_thread_self
+   Memcheck:Leak
+   ...
+   fun:g_thread_self
+}
+{
+   g_rec_mutex_lock
+   Memcheck:Leak
+   ...
+   fun:g_rec_mutex_impl_new
+   fun:g_rec_mutex_get_impl
+   fun:g_rec_mutex_lock
+}
+{
+   test_case_run
+   Memcheck:Leak
+   ...
+   fun:g_malloc0
+   fun:test_case_run
+   ...
+   fun:g_test_run_suite
+}
+{
+   g_get_charset
+   Memcheck:Leak
+   ...
+   fun:g_get_charset
+}
+{
+   g_test_run_suite__timer_new
+   Memcheck:Leak
+   ...
+   fun:g_timer_new
+   fun:test_case_run
+   ...
+   fun:g_test_run_suite
+}
+{
+   g_test_run_suite__timer_new2
+   Memcheck:Leak
+   ...
+   fun:g_timer_new
+   fun:test_case_run_suite_internal
+   ...
+   fun:g_test_run_suite
+}
+{
+   g_test_run_suite__strconcat
+   Memcheck:Leak
+   ...
+   fun:g_strconcat
+   fun:test_case_run
+   ...
+   fun:g_test_run_suite
+   fun:g_test_run
+}
+{
+   g_type_interface_add_prerequisite
+   Memcheck:Leak
+   ...
+   fun:g_type_interface_add_prerequisite
+}
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Leak
+   ...
+   fun:g_slist_copy
+   fun:g_test_run_suite_internal
+   ...
+   fun:g_test_run_suite
+}
+{
+   g_set_prgname
+   Memcheck:Leak
+   ...
+   fun:g_set_prgname
+}
+{
+   g_test_run_suite__strconcat_2
+   Memcheck:Leak
+   ...
+   fun:g_strconcat
+   fun:g_test_run_suite_internal
+}
+{
+   g_test_run_suite__strdup
+   Memcheck:Leak
+   ...
+   fun:g_strdup
+   fun:g_test_run_suite_internal
+}
+{
+   g_private_get
+   Memcheck:Leak
+   ...
+   fun:g_private_get
+}
+{
+   g_private_set
+   Memcheck:Leak
+   ...
+   fun:g_private_set
+}
+{
+   g_static_mutex_get_mutex_impl
+   Memcheck:Leak
+   ...
+   fun:g_static_mutex_get_mutex_impl
+}
+{
+   g_variant_type_info_unref
+   Memcheck:Leak
+   ...
+   fun:g_hash_table_remove
+   fun:g_variant_type_info_unref
+}
+{
+   g_rw_lock_reader_lock
+   Memcheck:Leak
+   ...
+   fun:g_rw_lock_impl_new
+   fun:g_rw_lock_get_impl
+   fun:g_rw_lock_reader_lock
+}
+{
+   g_child_watch_finalize__rt_sigaction
+   Memcheck:Param
+   rt_sigaction(act->sa_flags)
+   fun:__libc_sigaction
+   ...
+   fun:g_child_watch_finalize
+}
+{
+   g_dbus_worker_new
+   Memcheck:Leak
+   fun:calloc
+   ...
+   fun:_g_dbus_worker_new
+}
+{
+   gdbus_shared_thread_func
+   Memcheck:Leak
+   match-leak-kinds: definite
+   ...
+   fun:g_malloc
+   ...
+   fun:gdbus_shared_thread_func
+}
+{
+   g_task_start_task_thread
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_slice_alloc0
+   ...
+   fun:g_thread_pool_push
+   fun:g_task_start_task_thread
+}
+{
+   g_get_language_names
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:calloc
+   fun:g_malloc0
+   fun:g_get_language_names
+}
+{
+   g_get_filename_charsets
+   Memcheck:Leak
+   match-leak-kinds: definite
+   ...
+   fun:g_get_filename_charsets
+   fun:g_filename_display_name
+}
+{
+   g_main_current_source
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   ...
+   fun:g_main_current_source
+   fun:g_task_return
+   fun:g_task_thread_pool_thread
+}
+{
+   g_once_init_enter
+   Memcheck:Leak
+   match-leak-kinds: definite
+   ...
+   fun:g_once_init_enter
+}
+{
+   g_child_watch_source_new
+   Memcheck:Leak
+   match-leak-kinds: definite
+   ...
+   fun:g_thread_new
+   ...
+   fun:g_child_watch_source_new
+}
+{
+   continue_writing_in_idle_cb
+   Memcheck:Leak
+   match-leak-kinds: definite
+   ...
+   fun:g_task_new
+   ...
+   fun:continue_writing_in_idle_cb
+   fun:g_main_context_dispatch
+}
+{
+   g_main_current_source
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   ...
+   fun:g_main_current_source
+}
+{
+   g_thread_pool_push
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   ...
+   fun:g_thread_pool_push
+}
+{
+   leak_test_dbus_dispose
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   ...
+   fun:g_main_loop_run
+   fun:g_test_dbus_down
+}
+{
+   leak_test_dbus_down
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:calloc
+   fun:g_malloc0
+   fun:g_main_loop_new
+   fun:g_test_dbus_down
+}
+{
+   leak_socket_client_connect
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   fun:g_slice_alloc
+   fun:g_slice_alloc0
+   fun:g_socket_client_connect_async
+   fun:g_socket_client_connect_to_uri_async
+}
+{
+   leak_signal_handlers_disconnect_matched
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:calloc
+   fun:g_malloc0
+   ...
+   fun:g_slice_alloc
+   ...
+   fun:g_signal_handlers_disconnect_matched
+}
+{
+   g_tls_connection_gnutls_init_priorities
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_tls_connection_gnutls_init_priorities
+}
+{
+   g_tls_connection_gnutls_heisenbug_likely_same_as_above
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   ...
+   fun:g_tls_client_connection_new
+}
+{
+   g_unix_signal_add_full
+   Memcheck:Leak
+   match-leak-kinds: definite
+   fun:malloc
+   fun:g_malloc
+   ...
+   fun:g_thread_new
+   ...
+   fun:g_unix_signal_add_full
+}
+{
+   glib_worker_1
+   Memcheck:Leak
+   ...
+   fun:glib_worker_main
+}
+{
+   glib_dispatch_1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   ...
+   fun:get_dispatch
+   fun:g_main_dispatch
+}
+{
+   glib_dispatch_2
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   ...
+   fun:get_dispatch
+   fun:g_main_current_source
+}
+{
+   glib_dlopen_1
+   Memcheck:Leak
+   fun:calloc
+   fun:_dlerror_run
+   fun:dlopen*
+   ...
+   fun:g_module_open
+}
+{
+   libc_tls
+   Memcheck:Leak
+   fun:calloc
+   fun:_dl_allocate_tls
+   fun:pthread_create*
+}
+{
+   soup_callback_1
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_source_set_callback
+   fun:soup_add_completion_reffed
+   fun:soup_session_real_kick_queue
+}
diff --git a/tests/libtest.sh b/tests/libtest.sh
new file mode 100644 (file)
index 0000000..6a3aafa
--- /dev/null
@@ -0,0 +1,367 @@
+# Source library for shell script tests
+#
+# Copyright (C) 2016 Alexander Larsson <alexl@redhat.com>
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+if [ -n "${G_TEST_SRCDIR:-}" ]; then
+    test_srcdir="${G_TEST_SRCDIR}"
+else
+    test_srcdir=$(dirname $0)
+fi
+
+if [ -n "${G_TEST_BUILDDIR:-}" ]; then
+    test_builddir="${G_TEST_BUILDDIR}"
+else
+    test_builddir=$(dirname $0)
+fi
+
+assert_not_reached () {
+    echo $@ 1>&2; exit 1
+}
+
+test_tmpdir=$(pwd)
+
+# Sanity check that we're in a tmpdir that has
+# just .testtmp (created by tap-driver for `make check`,
+# or nothing at all (as ginstest-runner does)
+if ! test -f .testtmp; then
+    files=$(ls)
+    if test -n "${files}"; then
+        ls -l
+        assert_not_reached "test tmpdir=${test_tmpdir} is not empty; run this test via \`make check TESTS=\`, not directly"
+    fi
+    # Remember that this is an acceptable test $(pwd), for the benefit of
+    # C and JS tests which may source this file again
+    touch .testtmp
+fi
+
+export G_DEBUG=fatal-warnings
+
+# Also, unbreak `tar` inside `make check`...Automake will inject
+# TAR_OPTIONS: --owner=0 --group=0 --numeric-owner presumably so that
+# tarballs are predictable, except we don't want this in our tests.
+unset TAR_OPTIONS
+
+if test -n "${FLATPAK_TESTS_DEBUG:-}"; then
+    set -x
+fi
+
+if test -n "${FLATPAK_TESTS_VALGRIND:-}"; then
+    CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=no --error-exitcode=1 --num-callers=30 --suppressions=${test_srcdir}/flatpak.supp --suppressions=${test_srcdir}/glib.supp"
+elif test -n "${FLATPAK_TESTS_VALGRIND_LEAKS:-}"; then
+    CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=full --error-exitcode=1 --num-callers=30 --suppressions=${test_srcdir}/flatpak.supp --suppressions=${test_srcdir}/glib.supp"
+else
+    CMD_PREFIX=""
+fi
+
+export MALLOC_CHECK_=3
+export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
+
+# We need this to be in /var/tmp because /tmp has no xattr support
+TEST_DATA_DIR=`mktemp -d /var/tmp/test-flatpak-XXXXXX`
+mkdir -p ${TEST_DATA_DIR}/home
+mkdir -p ${TEST_DATA_DIR}/runtime
+mkdir -p ${TEST_DATA_DIR}/system
+export FLATPAK_SYSTEM_DIR=${TEST_DATA_DIR}/system
+export FLATPAK_SYSTEM_CACHE_DIR=${TEST_DATA_DIR}/system-cache
+export FLATPAK_SYSTEM_HELPER_ON_SESSION=1
+
+export HOME=${TEST_DATA_DIR}/home
+export XDG_CACHE_HOME=${TEST_DATA_DIR}/home/cache
+export XDG_CONFIG_HOME=${TEST_DATA_DIR}/home/config
+export XDG_DATA_HOME=${TEST_DATA_DIR}/home/share
+export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
+
+export USERDIR=${TEST_DATA_DIR}/home/share/flatpak
+export SYSTEMDIR=${TEST_DATA_DIR}/system
+export ARCH=`flatpak --default-arch`
+
+if [ x${USE_SYSTEMDIR-} == xyes ] ; then
+    export FL_DIR=${SYSTEMDIR}
+    export U=
+else
+    export FL_DIR=${USERDIR}
+    export U="--user"
+fi
+
+if [ x${USE_DELTAS-} == xyes ] ; then
+    export UPDATE_REPO_ARGS="--generate-static-deltas"
+fi
+
+export FLATPAK="${CMD_PREFIX} flatpak"
+
+assert_streq () {
+    test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
+}
+
+assert_not_streq () {
+    (! test "$1" = "$2") || (echo 1>&2 "$1 == $2"; exit 1)
+}
+
+assert_has_file () {
+    test -f "$1" || (echo 1>&2 "Couldn't find '$1'"; exit 1)
+}
+
+assert_has_symlink () {
+    test -L "$1" || (echo 1>&2 "Couldn't find '$1'"; exit 1)
+}
+
+assert_has_dir () {
+    test -d "$1" || (echo 1>&2 "Couldn't find '$1'"; exit 1)
+}
+
+assert_not_has_file () {
+    if test -f "$1"; then
+        sed -e 's/^/# /' < "$1" >&2
+        echo 1>&2 "File '$1' exists"
+        exit 1
+    fi
+}
+
+assert_not_file_has_content () {
+    if grep -q -e "$2" "$1"; then
+        sed -e 's/^/# /' < "$1" >&2
+        echo 1>&2 "File '$1' incorrectly matches regexp '$2'"
+        exit 1
+    fi
+}
+
+assert_file_has_mode () {
+    mode=$(stat -c '%a' $1)
+    if [ "$mode" != "$2" ]; then
+        echo 1>&2 "File '$1' has wrong mode: expected $2, but got $mode"
+        exit 1
+    fi
+}
+
+assert_not_has_dir () {
+    if test -d "$1"; then
+        echo 1>&2 "Directory '$1' exists"; exit 1
+    fi
+}
+
+assert_file_has_content () {
+    if ! grep -q -e "$2" "$1"; then
+        sed -e 's/^/# /' < "$1" >&2
+        echo 1>&2 "File '$1' doesn't match regexp '$2'"
+        exit 1
+    fi
+}
+
+assert_symlink_has_content () {
+    if ! readlink "$1" | grep -q -e "$2"; then
+        readlink "$1" |sed -e 's/^/# /' >&2
+        echo 1>&2 "Symlink '$1' doesn't match regexp '$2'"
+        exit 1
+    fi
+}
+
+assert_file_empty() {
+    if test -s "$1"; then
+        sed -e 's/^/# /' < "$1" >&2
+        echo 1>&2 "File '$1' is not empty"
+        exit 1
+    fi
+}
+
+export FL_GPG_HOMEDIR=${TEST_DATA_DIR}/gpghome
+export FL_GPG_HOMEDIR2=${TEST_DATA_DIR}/gpghome2
+mkdir -p ${FL_GPG_HOMEDIR}
+mkdir -p ${FL_GPG_HOMEDIR2}
+# This need to be writable, so copy the keys
+cp $(dirname $0)/test-keyring/*.gpg ${FL_GPG_HOMEDIR}/
+cp $(dirname $0)/test-keyring2/*.gpg ${FL_GPG_HOMEDIR2}/
+
+export FL_GPG_ID=7B0961FD
+export FL_GPG_ID2=B2314EFC
+export FL_GPGARGS="--gpg-homedir=${FL_GPG_HOMEDIR} --gpg-sign=${FL_GPG_ID}"
+export FL_GPGARGS2="--gpg-homedir=${FL_GPG_HOMEDIR2} --gpg-sign=${FL_GPG_ID2}"
+export FL_GPG_BASE64="mQENBFbPBvoBCADWbz5O+XzuyN+dDExK81pci+gIzBNWB+7SsN0EgoJppKgwBCX+Bd6ERe9Yz0nJbJB/tjazRp7MnnoPnh6fXnhIbHA766/Eciy4sL5X8laqDmWmROCqCe79QZH/w6vYTKsDmoLQrw9eKRP1ilCvECNGcVdhIyfTDlNrU//uy5U4h2PVUz1/Al87lvaJnrj5423m5GnX+qpEG8mmpmcw52lvXNPuC95ykylPQJjI0WnOuaTcxzRhm5eHPkqKQ+nPIS+66iw1SFdobYuye/vg/rDiyp8uyQkh7FWXnzHxz4J8ovesnrCM7pKI4VEHCnZ4/sj2v9E3l0wJlqZxLTULaV3lABEBAAG0D1hkZy1hcHAgdGVzdGluZ4kBOAQTAQIAIgUCVs8G+gIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQE4sx4HsJYf2DiAf7BQ8anU3CgYpJjuO2rT8jQPO0jGRCNaPyaeAcBx8IjFkjf8daKMPCAt6gQioEpC8OhDig86Bl5piYOB7L7JSB53mgUrADJXhgC/dG4soCt7/U4wW30MseXdlXSOqHGApblF/bIs4B30OBGReBj3DcWIqyb48GraSKlPlaCpkZFySNEAcGUCeCqbbygxCQAM8MDq9FgVRk5oVrE/nAUm6oScEBhseoB7+CaHaRTmLoe/SBs0z2AJ7alIH1Sv4X3mQXpfsAIcWf3Zu2MZydF/Vuh8vTMROwPYtOVEtGxZvEBN3h5uc88dHSk928maqsop9T6oEwM43mBKCOu1gdAOw4OLkBDQRWzwb6AQgAx/XuEaQvdI3J2YYmOE6RY0jJZXLauXH46cJR4q70mlDev/OqYKTSLlo4q06D4ozCwzTYflppDak7kmjWMN224/u1koqFOtF76LsglAeLaQmweWmX0ecbPrzFYaX30kaQAqQ9Wk0PRe0+arRzWDWfUv3qX3y1decKUrBCuEC6WvVVwooWs+zX0cUBS8CROhazTjvXFAz36mhK0u+B3WCBlK+T2tIPOjLjlYgzYARw+X7/J6B3C798r2Hw/yXqCDcKLrq7WWUB33kv3buuG2G6LUamctdD8IsTBxi+nIjAvQITFqq4cPbbXAJGaAnWGuLOddQ9e/GhCOI4JjopRnnjOwARAQABiQEfBBgBAgAJBQJWzwb6AhsMAAoJEBOLMeB7CWH9TC8H/A6oreCxeiL8DPOWN29OaQ5sEw7Dg7bnLSZLu8aREgwfCiFSv0numOABjn/G89Y5M6NiEXFZZhUa+SXOALiBLUy98O84lyp9hlP9qGbWRgBXwe5vOAJERqtoUwR5bygpAw5Nc4y3wddPC4vH7upJ8ftU/eEFtPdI0cKrrAZDFdhXFp3RxdCC6fD62wbofE0mo1Ea1iD3xqVh2t7jfWN1RhMV308htHRGkkmWcEbbvHqugwL6dWZEvQmLYi6/7tQyA1KdG4AZksBP/MBi3t2hthRqQx1v52JwdCaZNuItuEe5rWXhfvoGxPoqYZt9ZPjna6yJfcfJwPbMfjNwX2LR4p4="
+export FL_GPG_BASE642="mQENBFkSyx4BCACq/8XFcF+NTpJKfoo8F6YyR8RQXww6kCV47zN78Dt7aCh43WSYLRUBRt1tW5MRT8R60pwCsGvKnFiNS2Vqe4T1IW4mDnFMZIZJXdNVwKUqVBPL/jzkIDnQ9NXtuPNH0qET6VhYnb9aykLo/MiBmx6q+4MvYd/qwiN8kstRifRIxjjZx6wsg+muY6yx9fZKxlgvhc3nsrl3oyDo7/+V+b3heYLtMCQFwlHRKz3Yf2X9H0aUSbDYcgTy6w3q94HVNCpJSqeiR+kBG175BQYKR2l7WYdaVPFf5LMEvAJh0SGnqu77X+8TYYRQiiBB5fYjGOeHfOh6uH5GAJRQymVIJwy/ABEBAAG0KkZsYXRwYWsgKFRlc3Qga2V5IDIpIDxmbGF0cGFrQGZsYXRwYWsub3JnPokBOAQTAQIAIgUCWRLLHgIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQdZ9f0LIxTvyeUQf/euAZpipXBkGWxeW4G10r1QRi2tZAWNeLpy8SB17eo9E6yB61SdH80jALborVs/plnZzKcFf+nLvjCn51FLMh6QPL3S+079WHsed//qtUWfbJ85hLevfCMTZMLktUmqwwUh238WW/gKtbUjYOqr1IZSMBoMiQtc0iOVBP7HUdhYigxTKvs/MBEGHANeQkY07ZnX9oFXElOo+EIPAHScwEOSwEVrXUVHpQODzIfjOoPUHWAZtM1yJT+iWmVHe4HtU8CyBnPyUcnTmTWKr92QmgfWkb1T7ugT5gXt/6ZlYAaZGnr9yNuSk3MMhDMOyldtJBM5Zl8eScE9KBf7pRJoxnMLkBDQRZEsseAQgAvA29IyiJpB+jUHj3MOyVyTBOmvLme+0Ndhpt/mTh+swchJUvzb0IzQS9Le5yVAvn+ppAtDCMb+bV4Xh5zrbiH0Hu0qwK4Qk+KcIKRE8ImDiUM8NFE2SZoomZSsgZ1NBWbAdEyVpkBfrt3Dd8FssMrwPF6kqo02TZr7Pxng+BEHUZT6jPCxueqyXyv2cLbQMe1H0U7klsxPmnnIYUqdwOmPxUspVEYP9oJb5y123mx0yj5JuYdZMjWbP3cRLox1RKIlFWgQqOn2yJiEoWzpqdbtb7sE3ggnbZKJED0ZxUZIakjnyMhX+GAEA8ZMZ6+HfDt1iHV8qHcYiLW5A3AQTxZwARAQABiQEfBBgBAgAJBQJZEsseAhsMAAoJEHWfX9CyMU78Ns4IAJRQ5UJ9KkeZClHm1EjYlgsAq1UJr9wgbyBFKTEkGZ/CAvVmgg+BUXcN/SPAkELbEAOJZTyv8C5cuJC49iFHOxUbRZXZ5eN2SvhZzl+5gep2uHwVLdqRIxFDTHbLWnmtHxPeU7IRA9u86q3wV1N0pD7kreNN7BWKY3/tI33hY2/XVVFy0MN5sutPn+lVK66MqAHqtode5xqqz9Z8LmS7LlqokQkAytcGd6Xqsx99NTk8kk3bnk9HWsAvDO8tRZroeseKeRNmbhGvCNUxPSB6bpYBJLvQtjA9ZVv6sNm0E+SuiXKizZkBGO5AH50pDoy0+MCGoOhwwXeY5+1kZAOzkMI="
+
+setup_repo_no_add () {
+    REPONAME=${1:-test}
+    if [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+        COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+    else
+        COLLECTION_ID=
+    fi
+
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh ${REPONAME} org.test.Platform "${COLLECTION_ID}" bash ls cat echo readlink > /dev/null
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh ${REPONAME} "${COLLECTION_ID}" > /dev/null
+    update_repo $REPONAME "${COLLECTION_ID}"
+    if [ $REPONAME == "test" ]; then
+        $(dirname $0)/test-webserver.sh repos
+        FLATPAK_HTTP_PID=$(cat httpd-pid)
+        mv httpd-port httpd-port-main
+    fi
+}
+
+setup_repo () {
+    REPONAME=${1:-test}
+    COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+
+    setup_repo_no_add "$@"
+
+    port=$(cat httpd-port-main)
+    if [ x${GPGPUBKEY:-${FL_GPG_HOMEDIR}/pubring.gpg} != x ]; then
+        import_args=--gpg-import=${GPGPUBKEY:-${FL_GPG_HOMEDIR}/pubring.gpg}
+    else
+        import_args=
+    fi
+    if [ x${USE_COLLECTIONS_IN_CLIENT-} == xyes ] ; then
+        collection_args=--collection-id=${COLLECTION_ID}
+    else
+        collection_args=
+    fi
+
+    flatpak remote-add ${U} ${collection_args} ${import_args} ${REPONAME}-repo "http://127.0.0.1:${port}/$REPONAME"
+}
+
+update_repo () {
+    REPONAME=${1:-test}
+    COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+
+    if [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+        collection_args=--collection-id=${COLLECTION_ID}
+    else
+        collection_args=
+    fi
+
+    ${FLATPAK} build-update-repo ${collection_args} ${GPGARGS:-${FL_GPGARGS}} ${UPDATE_REPO_ARGS-} repos/${REPONAME}
+}
+
+make_updated_app () {
+    REPONAME=${1:-test}
+    if [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+        COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+    else
+        COLLECTION_ID=""
+    fi
+
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh ${REPONAME} "${COLLECTION_ID}" ${3:-UPDATED} > /dev/null
+    update_repo $REPONAME "${COLLECTION_ID}"
+}
+
+setup_sdk_repo () {
+    REPONAME=${1:-test}
+    if [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+        COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+    else
+        COLLECTION_ID=""
+    fi
+
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh ${REPONAME} org.test.Sdk "${COLLECTION_ID}" bash ls cat echo readlink make mkdir cp touch > /dev/null
+    update_repo $REPONAME "${COLLECTION_ID}"
+}
+
+setup_python2_repo () {
+    REPONAME=${1:-test}
+    if [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+        COLLECTION_ID=${2:-org.test.Collection.${REPONAME}}
+    else
+        COLLECTION_ID=""
+    fi
+
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh ${REPONAME} org.test.PythonPlatform "${COLLECTION_ID}" bash python2 ls cat echo rm readlink > /dev/null
+    GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh ${REPONAME} org.test.PythonSdk "${COLLECTION_ID}" python2 bash ls cat echo rm readlink make mkdir cp touch > /dev/null
+    update_repo $REPONAME "${COLLECTION_ID}"
+}
+
+install_repo () {
+    REPONAME=${1:-test}
+    ${FLATPAK} ${U} install ${REPONAME}-repo org.test.Platform master
+    ${FLATPAK} ${U} install ${REPONAME}-repo org.test.Hello master
+}
+
+install_sdk_repo () {
+    REPONAME=${1:-test}
+    ${FLATPAK} ${U} install ${REPONAME}-repo org.test.Sdk master
+}
+
+install_python2_repo () {
+    REPONAME=${1:-test}
+    ${FLATPAK} ${U} install ${REPONAME}-repo org.test.PythonPlatform master
+    ${FLATPAK} ${U} install ${REPONAME}-repo org.test.PythonSdk master
+}
+
+run () {
+    ${CMD_PREFIX} flatpak run "$@"
+
+}
+
+run_sh () {
+    ${CMD_PREFIX} flatpak run --command=bash ${ARGS-} org.test.Hello -c "$*"
+}
+
+skip_without_user_xattrs () {
+    touch ${TEST_DATA_DIR}/test-xattrs
+    if ! setfattr -n user.testvalue -v somevalue ${TEST_DATA_DIR}/test-xattrs; then
+        echo "1..0 # SKIP this test requires xattr support"
+        exit 0
+    fi
+}
+
+skip_without_bwrap () {
+    if [ -z "${FLATPAK_BWRAP:-}" ]; then
+        # running installed-tests: assume we know what we're doing
+        :
+    elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \
+            --ro-bind / / /bin/true > bwrap-result 2>&1; then
+        sed -e 's/^/# /' < bwrap-result
+        echo "1..0 # SKIP Cannot run bwrap"
+        exit 0
+    fi
+}
+
+skip_without_python2 () {
+    if ! test -f /usr/bin/python2 || ! /usr/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then
+        echo "1..0 # SKIP this test requires /usr/bin/python2 (2.7) support"
+        exit 0
+    fi
+}
+
+skip_without_p2p () {
+    if ! ${FLATPAK} remote-add --help | grep -q -e '--collection-id'; then
+        echo "1..0 # SKIP this test requires peer to peer support (--enable-p2p)"
+        exit 0
+    fi
+}
+
+
+sed s#@testdir@#${test_builddir}# ${test_srcdir}/session.conf.in > session.conf
+dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \
+    3> dbus-session-bus-address 4> dbus-session-bus-pid
+export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)"
+DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)"
+
+if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
+    assert_not_reached "Failed to start dbus-daemon"
+fi
+
+cleanup () {
+    /bin/kill $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-}
+    gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true
+    fusermount -u $XDG_RUNTIME_DIR/doc || :
+    if test -n "${TEST_SKIP_CLEANUP:-}"; then
+        echo "Skipping cleanup of ${TEST_DATA_DIR}"
+    else
+        rm -rf $TEST_DATA_DIR
+    fi
+}
+trap cleanup EXIT
diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh
new file mode 100755 (executable)
index 0000000..10631de
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+set -e
+
+DIR=`mktemp -d`
+
+REPONAME=$1
+shift
+COLLECTION_ID=$1
+shift
+
+EXTRA="${1-}"
+
+ARCH=`flatpak --default-arch`
+
+# Init dir
+cat > ${DIR}/metadata <<EOF
+[Application]
+name=org.test.Hello
+runtime=org.test.Platform/$ARCH/master
+sdk=org.test.Platform/$ARCH/master
+EOF
+
+mkdir -p ${DIR}/files/bin
+cat > ${DIR}/files/bin/hello.sh <<EOF
+#!/bin/sh
+echo "Hello world, from a sandbox$EXTRA"
+EOF
+chmod a+x ${DIR}/files/bin/hello.sh
+
+mkdir -p ${DIR}/files/share/applications
+cat > ${DIR}/files/share/applications/org.test.Hello.desktop <<EOF
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Hello
+Exec=hello.sh
+Icon=org.test.Hello
+MimeType=x-test/Hello;
+EOF
+
+mkdir -p ${DIR}/files/share/icons/hicolor/64x64/apps
+cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/hicolor/64x64/apps/
+cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/hicolor/64x64/apps/dont-export.png
+mkdir -p ${DIR}/files/share/icons/HighContrast/64x64/apps
+cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/HighContrast/64x64/apps/
+
+
+mkdir -p ${DIR}/files/share/app-info/xmls
+mkdir -p ${DIR}/files/share/app-info/icons/flatpak/64x64
+gzip -c > ${DIR}/files/share/app-info/xmls/org.test.Hello.xml.gz <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<components version="0.8">
+  <component type="desktop">
+    <id>org.test.Hello.desktop</id>
+    <name>Hello world test app</name>
+    <summary>Print a greeting</summary>
+    <description><p>This is a test app.</p></description>
+    <categories>
+      <category>Utility</category>
+    </categories>
+    <icon height="64" width="64" type="cached">64x64/org.gnome.gedit.png</icon>
+  </component>
+</components>
+EOF
+cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/app-info/icons/flatpak/64x64/
+
+if [ x$COLLECTION_ID != x ]; then
+    collection_args=--collection-id=${COLLECTION_ID}
+else
+    collection_args=
+fi
+
+flatpak build-finish --command=hello.sh ${DIR}
+mkdir -p repos
+flatpak build-export ${collection_args} ${GPGARGS-} repos/${REPONAME} ${DIR}
+rm -rf ${DIR}
diff --git a/tests/make-test-bundles.sh b/tests/make-test-bundles.sh
new file mode 100755 (executable)
index 0000000..7b7ea64
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+set -x
+
+./make-test-runtime.sh org.test.Platform bash ls cat echo readlink
+./make-test-app.sh
+
+URL=file://`pwd`/repo
+
+REF=`(cd repo/refs/heads; echo app/org.test.Hello/*/master)`
+
+flatpak build-bundle repo hello.flatpak org.test.Hello
+flatpak build-bundle repo hello-key.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello
+flatpak build-bundle repo --repo-url=${URL} hello-origin.flatpak org.test.Hello
+flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin.flatpak org.test.Hello
+
+ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD
+
+flatpak build-bundle repo hello-signed.flatpak org.test.Hello
+flatpak build-bundle repo hello-key-signed.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello
+flatpak build-bundle repo --repo-url=${URL} hello-origin-signed.flatpak org.test.Hello
+flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin-signed.flatpak org.test.Hello
+
+REF=`(cd repo/refs/heads; echo runtime/org.test.Platform/*/master)`
+ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD
+flatpak build-bundle --runtime repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg platform.flatpak org.test.Platform
+
+gpg-connect-agent --homedir test-keyring killagent /bye || true
diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh
new file mode 100755 (executable)
index 0000000..43f0997
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+set -e
+
+DIR=`mktemp -d`
+
+REPONAME=$1
+shift
+ID=$1
+shift
+COLLECTION_ID=$1
+shift
+
+mkdir ${DIR}/files
+mkdir ${DIR}/usr
+cat > ${DIR}/metadata <<EOF
+[Runtime]
+name=${ID}
+EOF
+
+cat ${DIR}/metadata
+
+# Add bash and dependencies
+mkdir -p ${DIR}/usr/bin
+mkdir -p ${DIR}/usr/lib
+ln -s ../lib ${DIR}/usr/lib64
+ln -s ../lib ${DIR}/usr/lib32
+if test -f /sbin/ldconfig.real; then
+    cp /sbin/ldconfig.real ${DIR}/usr/bin/ldconfig
+else
+    cp `which ldconfig` ${DIR}/usr/bin
+fi
+T=`mktemp`
+for i in $@; do
+    I=`which $i`
+    cp $I ${DIR}/usr/bin
+    ldd $I | sed "s/.* => //"  | awk '{ print $1}' | grep ^/ | grep ^/ >> $T
+    if test $i == python2; then
+        mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload
+        # This is a hardcoded minimal set of modules we need in the current tests.
+        # Pretty hacky stuff. Add modules as needed.
+        PYDIR=/usr/lib/python2.7
+        if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi
+        for py in site os stat posixpath genericpath warnings \
+                       linecache types UserDict abc _abcoll \
+                       _weakrefset copy_reg traceback sysconfig \
+                       re sre_compile sre_parse sre_constants \
+                       _sysconfigdata ; do
+            cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7
+        done
+        # These might not exist, depending how Python was configured; and the
+        # part after ${so} might be "module" or ".x86_64-linux-gnu" or
+        # something else
+        for so in _locale strop ; do
+            cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || :
+        done
+        for plat in $( cd ${PYDIR} && echo plat-* ); do
+            test -e ${PYDIR}/${plat} || continue
+            mkdir -p ${DIR}/usr/lib/python2.7/${plat}
+            cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/
+        done
+    fi
+done
+ln -s bash ${DIR}/usr/bin/sh
+for i in `sort -u $T`; do
+    cp "$i" ${DIR}/usr/lib/
+done
+
+# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
+# the real en_US locale is often not available, because its in the
+# local archive.
+mkdir -p ${DIR}/usr/lib/locale/
+cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US
+
+if [ x$COLLECTION_ID != x ]; then
+    collection_args=--collection-id=${COLLECTION_ID}
+else
+    collection_args=
+fi
+
+mkdir -p repos
+flatpak build-export ${collection_args} --runtime ${GPGARGS-} repos/${REPONAME} ${DIR}
+rm -rf ${DIR}
diff --git a/tests/org.test.Hello.png b/tests/org.test.Hello.png
new file mode 100644 (file)
index 0000000..751ddbd
Binary files /dev/null and b/tests/org.test.Hello.png differ
diff --git a/tests/package_version.txt b/tests/package_version.txt
new file mode 100644 (file)
index 0000000..5eef0f1
--- /dev/null
@@ -0,0 +1 @@
+0.10.2
diff --git a/tests/session.conf.in b/tests/session.conf.in
new file mode 100644 (file)
index 0000000..307f84a
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <!-- Our well-known bus type, don't change this -->
+  <type>session</type>
+
+  <!-- If we fork, keep the user's original umask to avoid affecting
+       the behavior of child processes. -->
+  <keep_umask/>
+
+  <listen>unix:tmpdir=/tmp</listen>
+
+  <servicedir>@testdir@/services</servicedir>
+
+  <!-- disabled for now; this causes gnome-keyring to be spawned, which can
+       interfere with user's real keyrings, as well as causing long delays
+       during D-BUS activation -->
+  <!-- <standard_session_servicedirs /> -->
+
+  <policy context="default">
+    <!-- Allow everything to be sent -->
+    <allow send_destination="*" eavesdrop="true"/>
+    <!-- Allow everything to be received -->
+    <allow eavesdrop="true"/>
+    <!-- Allow anyone to own anything -->
+    <allow own="*"/>
+  </policy>
+
+  <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
+
+  <!-- For the session bus, override the default relatively-low limits 
+       with essentially infinite limits, since the bus is just running 
+       as the user anyway, using up bus resources is not something we need 
+       to worry about. In some cases, we do set the limits lower than 
+       "all available memory" if exceeding the limit is almost certainly a bug, 
+       having the bus enforce a limit is nicer than a huge memory leak. But the 
+       intent is that these limits should never be hit. -->
+
+  <!-- the memory limits are 1G instead of say 4G because they can't exceed 32-bit signed int max -->
+  <limit name="max_incoming_bytes">1000000000</limit>
+  <limit name="max_incoming_unix_fds">250000000</limit>
+  <limit name="max_outgoing_bytes">1000000000</limit>
+  <limit name="max_outgoing_unix_fds">250000000</limit>
+  <limit name="max_message_size">1000000000</limit>
+  <limit name="max_message_unix_fds">4096</limit>
+  <limit name="service_start_timeout">120000</limit>  
+  <limit name="auth_timeout">240000</limit>
+  <limit name="max_completed_connections">100000</limit>  
+  <limit name="max_incomplete_connections">10000</limit>
+  <limit name="max_connections_per_user">100000</limit>
+  <limit name="max_pending_service_starts">10000</limit>
+  <limit name="max_names_per_connection">50000</limit>
+  <limit name="max_match_rules_per_connection">50000</limit>
+  <limit name="max_replies_per_connection">50000</limit>
+
+</busconfig>
diff --git a/tests/test-basic.sh b/tests/test-basic.sh
new file mode 100755 (executable)
index 0000000..bc08595
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+# This test looks for specific localized strings.
+export LC_ALL=C
+
+echo "1..3"
+
+${FLATPAK} --version > version_out
+
+VERSION=`cat "$test_builddir/package_version.txt"`
+assert_file_has_content version_out "^Flatpak $VERSION$"
+
+echo "ok version"
+
+${FLATPAK} --help > help_out
+
+assert_file_has_content help_out "^Usage:$"
+
+echo "ok help"
+
+${FLATPAK} --default-arch > arch
+
+${FLATPAK} --supported-arches > arches
+
+assert_streq `head -1 arches` `cat arch`
+
+echo "ok default arch"
diff --git a/tests/test-bundle-system.sh b/tests/test-bundle-system.sh
new file mode 100755 (executable)
index 0000000..f1452c5
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_SYSTEMDIR=yes
+
+. $(dirname $0)/test-bundle.sh
diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh
new file mode 100755 (executable)
index 0000000..c843e6b
--- /dev/null
@@ -0,0 +1,165 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+
+echo "1..7"
+
+mkdir bundles
+
+setup_repo
+
+${FLATPAK} build-bundle repos/test --repo-url=file://`pwd`/repos/test --gpg-keys=${FL_GPG_HOMEDIR}/pubring.gpg bundles/hello.flatpak org.test.Hello
+assert_has_file bundles/hello.flatpak
+
+${FLATPAK} build-bundle repos/test --runtime --repo-url=file://`pwd`/repos/test --gpg-keys=${FL_GPG_HOMEDIR}/pubring.gpg bundles/platform.flatpak org.test.Platform
+assert_has_file bundles/platform.flatpak
+
+echo "ok create bundles"
+
+${FLATPAK} install ${U} -y --bundle bundles/hello.flatpak
+
+# This should have installed the runtime dependency too
+assert_has_file $FL_DIR/repo/refs/remotes/test-repo/runtime/org.test.Platform/$ARCH/master
+
+assert_has_file $FL_DIR/repo/refs/remotes/org.test.Hello-origin/app/org.test.Hello/$ARCH/master
+APP_COMMIT=`cat $FL_DIR/repo/refs/remotes/org.test.Hello-origin/app/org.test.Hello/$ARCH/master`
+assert_has_file $FL_DIR/repo/objects/$(echo $APP_COMMIT | cut -b 1-2)/$(echo $APP_COMMIT | cut -b 3-).commit
+assert_has_file $FL_DIR/repo/objects/$(echo $APP_COMMIT | cut -b 1-2)/$(echo $APP_COMMIT | cut -b 3-).commitmeta
+
+assert_has_dir $FL_DIR/app/org.test.Hello
+assert_has_symlink $FL_DIR/app/org.test.Hello/current
+assert_symlink_has_content $FL_DIR/app/org.test.Hello/current ^$ARCH/master$
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master
+assert_has_symlink $FL_DIR/app/org.test.Hello/$ARCH/master/active
+ID=`readlink $FL_DIR/app/org.test.Hello/$ARCH/master/active`
+assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/deploy
+assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/metadata
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
+assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
+# Ensure Exec key is rewritten
+assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
+assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
+assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
+
+# Ensure triggers ran
+assert_has_file $FL_DIR/exports/share/applications/mimeinfo.cache
+assert_file_has_content $FL_DIR/exports/share/applications/mimeinfo.cache x-test/Hello
+assert_has_file $FL_DIR/exports/share/icons/hicolor/icon-theme.cache
+assert_has_file $FL_DIR/exports/share/icons/hicolor/index.theme
+
+$FLATPAK list ${U} | grep org.test.Hello > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep org.test.Hello-origin > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep current > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep ${ID:0:12} > /dev/null
+
+$FLATPAK info ${U} org.test.Hello > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep org.test.Hello-origin > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep $ID > /dev/null
+
+$FLATPAK remote-list ${U} -d | grep org.test.Hello-origin > /dev/null
+$FLATPAK remote-list ${U} -d | grep org.test.Hello-origin | grep no-enumerate > /dev/null
+assert_has_file $FL_DIR/repo/org.test.Hello-origin.trustedkeys.gpg
+
+echo "ok install app bundle"
+
+${FLATPAK} uninstall ${U} org.test.Platform
+
+assert_not_has_file $FL_DIR/repo/refs/remotes/org.test.Platform-origin/runtime/org.test.Platform/$ARCH/master
+
+${FLATPAK} install ${U} --bundle bundles/platform.flatpak
+
+assert_has_file $FL_DIR/repo/refs/remotes/org.test.Platform-origin/runtime/org.test.Platform/$ARCH/master
+RUNTIME_COMMIT=`cat $FL_DIR/repo/refs/remotes/org.test.Platform-origin/runtime/org.test.Platform/$ARCH/master`
+assert_has_file $FL_DIR/repo/objects/$(echo $RUNTIME_COMMIT | cut -b 1-2)/$(echo $RUNTIME_COMMIT | cut -b 3-).commit
+assert_has_file $FL_DIR/repo/objects/$(echo $RUNTIME_COMMIT | cut -b 1-2)/$(echo $RUNTIME_COMMIT | cut -b 3-).commitmeta
+
+assert_has_dir $FL_DIR/runtime/org.test.Platform
+assert_has_dir $FL_DIR/runtime/org.test.Platform/$ARCH/master
+assert_has_symlink $FL_DIR/runtime/org.test.Platform/$ARCH/master/active
+ID=`readlink $FL_DIR/runtime/org.test.Platform/$ARCH/master/active`
+assert_has_file $FL_DIR/runtime/org.test.Platform/$ARCH/master/active/deploy
+assert_has_file $FL_DIR/runtime/org.test.Platform/$ARCH/master/active/metadata
+assert_has_dir $FL_DIR/runtime/org.test.Platform/$ARCH/master/active/files
+
+$FLATPAK list ${U} --runtime | grep org.test.Platform > /dev/null
+$FLATPAK list ${U} -d --runtime | grep org.test.Platform | grep org.test.Platform-origin > /dev/null
+$FLATPAK list ${U} -d --runtime | grep org.test.Platform | grep ${ID:0:12} > /dev/null
+
+$FLATPAK info ${U} org.test.Platform > /dev/null
+$FLATPAK info ${U} org.test.Platform | grep org.test.Platform-origin > /dev/null
+$FLATPAK info ${U} org.test.Platform | grep $ID > /dev/null
+
+$FLATPAK remote-list ${U} -d | grep org.test.Platform-origin > /dev/null
+$FLATPAK remote-list ${U} -d | grep org.test.Platform-origin | grep no-enumerate > /dev/null
+assert_has_file $FL_DIR/repo/org.test.Platform-origin.trustedkeys.gpg
+
+echo "ok install runtime bundle"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandbox$'
+
+echo "ok run"
+
+
+OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+# TODO: For weird reasons this breaks in the system case. Needs debugging
+if [ x${USE_SYSTEMDIR-} != xyes ] ; then
+    ${FLATPAK} ${U} update -v org.test.Hello master
+    ALSO_OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+    assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
+fi
+
+echo "ok null update"
+
+make_updated_app
+
+${FLATPAK} ${U} update org.test.Hello
+
+NEW_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+assert_not_streq "$OLD_COMMIT" "$NEW_COMMIT"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
+
+echo "ok update"
+
+make_updated_app test org.test.Collection.test UPDATED2
+
+${FLATPAK} build-bundle repos/test --repo-url=file://`pwd`/repos/test --gpg-keys=${FL_GPG_HOMEDIR}/pubring.gpg bundles/hello2.flatpak org.test.Hello
+assert_has_file bundles/hello2.flatpak
+
+${FLATPAK} install ${U} -y --bundle bundles/hello2.flatpak
+
+NEW2_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+assert_not_streq "$NEW_COMMIT" "$NEW2_COMMIT"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED2$'
+
+echo "ok update as bundle"
diff --git a/tests/test-doc-portal.c b/tests/test-doc-portal.c
new file mode 100644 (file)
index 0000000..ff08316
--- /dev/null
@@ -0,0 +1,505 @@
+#include "config.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "libglnx/libglnx.h"
+
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
+
+#include "document-portal/xdp-dbus.h"
+
+#include "flatpak-dbus.h"
+
+char outdir[] = "/tmp/xdp-test-XXXXXX";
+
+GTestDBus *dbus;
+GDBusConnection *session_bus;
+XdpDbusDocuments *documents;
+char *mountpoint;
+static gboolean have_fuse;
+
+static char *
+make_doc_dir (const char *id, const char *app)
+{
+  if (app)
+    return g_build_filename (mountpoint, "by-app", app, id, NULL);
+  else
+    return g_build_filename (mountpoint, id, NULL);
+}
+
+static char *
+make_doc_path (const char *id, const char *basename, const char *app)
+{
+  g_autofree char *dir = make_doc_dir (id, app);
+
+  return g_build_filename (dir, basename, NULL);
+}
+
+static void
+assert_host_has_contents (const char *basename, const char *expected_contents)
+{
+  g_autofree char *path = g_build_filename (outdir, basename, NULL);
+  g_autofree char *real_contents = NULL;
+  gsize real_contents_length;
+  GError *error = NULL;
+
+  g_file_get_contents (path, &real_contents, &real_contents_length, &error);
+  g_assert_no_error (error);
+  g_assert_cmpstr (real_contents, ==, expected_contents);
+  g_assert_cmpuint (real_contents_length, ==, strlen (expected_contents));
+}
+
+static void
+assert_doc_has_contents (const char *id, const char *basename, const char *app, const char *expected_contents)
+{
+  g_autofree char *path = make_doc_path (id, basename, app);
+  g_autofree char *real_contents = NULL;
+  gsize real_contents_length;
+  GError *error = NULL;
+
+  g_file_get_contents (path, &real_contents, &real_contents_length, &error);
+  g_assert_no_error (error);
+  g_assert_cmpstr (real_contents, ==, expected_contents);
+  g_assert_cmpuint (real_contents_length, ==, strlen (expected_contents));
+}
+
+static void
+assert_doc_not_exist (const char *id, const char *basename, const char *app)
+{
+  g_autofree char *path = make_doc_path (id, basename, app);
+  struct stat buf;
+  int res, fd;
+
+  res = stat (path, &buf);
+  g_assert_cmpint (res, ==, -1);
+  g_assert_cmpint (errno, ==, ENOENT);
+
+  fd = open (path, O_RDONLY);
+  g_assert_cmpint (fd, ==, -1);
+  g_assert_cmpint (errno, ==, ENOENT);
+}
+
+static char *
+export_file (const char *path, gboolean unique)
+{
+  int fd, fd_id;
+  GUnixFDList *fd_list = NULL;
+
+  g_autoptr(GVariant) reply = NULL;
+  GError *error = NULL;
+  char *doc_id;
+
+  fd = open (path, O_PATH | O_CLOEXEC);
+  g_assert (fd >= 0);
+
+  fd_list = g_unix_fd_list_new ();
+  fd_id = g_unix_fd_list_append (fd_list, fd, &error);
+  g_assert_no_error (error);
+  close (fd);
+
+  reply = g_dbus_connection_call_with_unix_fd_list_sync (session_bus,
+                                                         "org.freedesktop.portal.Documents",
+                                                         "/org/freedesktop/portal/documents",
+                                                         "org.freedesktop.portal.Documents",
+                                                         "Add",
+                                                         g_variant_new ("(hbb)", fd_id, !unique, FALSE),
+                                                         G_VARIANT_TYPE ("(s)"),
+                                                         G_DBUS_CALL_FLAGS_NONE,
+                                                         30000,
+                                                         fd_list, NULL,
+                                                         NULL,
+                                                         &error);
+  g_object_unref (fd_list);
+  g_assert_no_error (error);
+  g_assert (reply != NULL);
+
+  g_variant_get (reply, "(s)", &doc_id);
+  g_assert (doc_id != NULL);
+  return doc_id;
+}
+
+static char *
+export_new_file (const char *basename, const char *contents, gboolean unique)
+{
+  g_autofree char *path = NULL;
+  GError *error = NULL;
+
+  path = g_build_filename (outdir, basename, NULL);
+
+  g_file_set_contents (path, contents, -1, &error);
+  g_assert_no_error (error);
+
+  return export_file (path, unique);
+}
+
+static gboolean
+update_doc (const char *id, const char *basename, const char *app, const char *contents, GError **error)
+{
+  g_autofree char *path = make_doc_path (id, basename, app);
+
+  return g_file_set_contents (path, contents, -1, error);
+}
+
+static gboolean
+update_from_host (const char *basename, const char *contents, GError **error)
+{
+  g_autofree char *path = g_build_filename (outdir, basename, NULL);
+
+  return g_file_set_contents (path, contents, -1, error);
+}
+
+
+static void
+grant_permissions (const char *id, const char *app, gboolean write)
+{
+  g_autoptr(GPtrArray) permissions = g_ptr_array_new ();
+  GError *error = NULL;
+
+  g_ptr_array_add (permissions, "read");
+  if (write)
+    g_ptr_array_add (permissions, "write");
+  g_ptr_array_add (permissions, NULL);
+
+  xdp_dbus_documents_call_grant_permissions_sync (documents,
+                                                  id,
+                                                  app,
+                                                  (const char **) permissions->pdata,
+                                                  NULL,
+                                                  &error);
+  g_assert_no_error (error);
+}
+
+static void
+test_create_doc (void)
+{
+  g_autofree char *doc_path = NULL;
+  g_autofree char *doc_app_path = NULL;
+  g_autofree char *host_path = NULL;
+  g_autofree char *id = NULL;
+  g_autofree char *id2 = NULL;
+  g_autofree char *id3 = NULL;
+  g_autofree char *id4 = NULL;
+  g_autofree char *id5 = NULL;
+  const char *basename = "a-file";
+  GError *error = NULL;
+
+  if (!have_fuse)
+    {
+      g_test_skip ("this test requires FUSE");
+      return;
+    }
+
+  /* Export a document */
+  id = export_new_file (basename, "content", FALSE);
+
+  /* Ensure its there and not viewable by apps */
+  assert_doc_has_contents (id, basename, NULL, "content");
+  assert_host_has_contents (basename, "content");
+  assert_doc_not_exist (id, basename, "com.test.App1");
+  assert_doc_not_exist (id, basename, "com.test.App2");
+  assert_doc_not_exist (id, "another-file", NULL);
+  assert_doc_not_exist ("anotherid", basename, NULL);
+
+  /* Create a tmp file in same dir, ensure it works and can't be seen by other apps */
+  assert_doc_not_exist (id, "tmp1", NULL);
+  update_doc (id, "tmp1", NULL, "tmpdata1", &error);
+  g_assert_no_error (error);
+  assert_doc_has_contents (id, "tmp1", NULL, "tmpdata1");
+  assert_doc_not_exist (id, "tmp1", "com.test.App1");
+
+  /* Let App 1 see the document (but not write) */
+  grant_permissions (id, "com.test.App1", FALSE);
+
+  /* Ensure App 1 and only it can see the document and tmpfile */
+  assert_doc_has_contents (id, basename, "com.test.App1", "content");
+  assert_doc_not_exist (id, basename, "com.test.App2");
+  assert_doc_not_exist (id, "tmp1", "com.test.App1");
+
+  /* Make sure App 1 can't create a tmpfile */
+  assert_doc_not_exist (id, "tmp2", "com.test.App1");
+  update_doc (id, "tmp2", "com.test.App1", "tmpdata2", &error);
+  g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+  g_clear_error (&error);
+  assert_doc_not_exist (id, "tmp2", "com.test.App1");
+
+  /* Update the document contents, ensure this is propagater */
+  update_doc (id, basename, NULL, "content2", &error);
+  g_assert_no_error (error);
+  assert_host_has_contents (basename, "content2");
+  assert_doc_has_contents (id, basename, NULL, "content2");
+  assert_doc_has_contents (id, basename, "com.test.App1", "content2");
+  assert_doc_not_exist (id, basename, "com.test.App2");
+  assert_doc_not_exist (id, "tmp1", "com.test.App2");
+
+  /* Update the document contents outside fuse fd, ensure this is propagater */
+  update_from_host (basename, "content3", &error);
+  g_assert_no_error (error);
+  assert_host_has_contents (basename, "content3");
+  assert_doc_has_contents (id, basename, NULL, "content3");
+  assert_doc_has_contents (id, basename, "com.test.App1", "content3");
+  assert_doc_not_exist (id, basename, "com.test.App2");
+  assert_doc_not_exist (id, "tmp1", "com.test.App2");
+
+  /* Try to update the doc from an app that can't write to it */
+  update_doc (id, basename, "com.test.App1", "content4", &error);
+  g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+  g_clear_error (&error);
+
+  /* Try to create a tmp file for an app that is not allowed */
+  assert_doc_not_exist (id, "tmp2", "com.test.App1");
+  update_doc (id, "tmp2", "com.test.App1", "tmpdata2", &error);
+  g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+  g_clear_error (&error);
+  assert_doc_not_exist (id, "tmp2", "com.test.App1");
+  assert_doc_not_exist (id, "tmp2", NULL);
+
+  /* Grant write permissions to App1 */
+  grant_permissions (id, "com.test.App1", TRUE);
+
+  /* update the doc from an app with write access */
+  update_doc (id, basename, "com.test.App1", "content5", &error);
+  g_assert_no_error (error);
+  assert_host_has_contents (basename, "content5");
+  assert_doc_has_contents (id, basename, NULL, "content5");
+  assert_doc_has_contents (id, basename, "com.test.App1", "content5");
+  assert_doc_not_exist (id, basename, "com.test.App2");
+
+  /* Try to create a tmp file for an app */
+  assert_doc_not_exist (id, "tmp3", "com.test.App1");
+  update_doc (id, "tmp3", "com.test.App1", "tmpdata3", &error);
+  g_assert_no_error (error);
+  assert_doc_has_contents (id, "tmp3", "com.test.App1", "tmpdata3");
+  assert_doc_not_exist (id, "tmp3", NULL);
+
+  /* Re-Create a file from a fuse document file, in various ways */
+  doc_path = make_doc_path (id, basename, NULL);
+  doc_app_path = make_doc_path (id, basename, "com.test.App1");
+  host_path = g_build_filename (outdir, basename, NULL);
+  id2 = export_file (doc_path, FALSE);
+  g_assert_cmpstr (id, ==, id2);
+  id3 = export_file (doc_app_path, FALSE);
+  g_assert_cmpstr (id, ==, id3);
+  id4 = export_file (host_path, FALSE);
+  g_assert_cmpstr (id, ==, id4);
+
+  /* Ensure we can make a unique document */
+  id5 = export_file (host_path, TRUE);
+  g_assert_cmpstr (id, !=, id5);
+}
+
+static void
+test_recursive_doc (void)
+{
+  g_autofree char *id = NULL;
+  g_autofree char *id2 = NULL;
+  g_autofree char *id3 = NULL;
+  const char *basename = "recursive-file";
+  g_autofree char *path = NULL;
+  g_autofree char *app_path = NULL;
+
+  if (!have_fuse)
+    {
+      g_test_skip ("this test requires FUSE");
+      return;
+    }
+
+  id = export_new_file (basename, "recursive-content", FALSE);
+
+  assert_doc_has_contents (id, basename, NULL, "recursive-content");
+
+  path = make_doc_path (id, basename, NULL);
+  g_print ("path: %s\n", path);
+
+  id2 = export_file (path, FALSE);
+
+  g_assert_cmpstr (id, ==, id2);
+
+  grant_permissions (id, "com.test.App1", FALSE);
+
+  app_path = make_doc_path (id, basename, "com.test.App1");
+
+  id3 = export_file (app_path, FALSE);
+
+  g_assert_cmpstr (id, ==, id3);
+}
+
+static void
+test_create_docs (void)
+{
+  GError *error = NULL;
+  g_autofree char *path1 = NULL;
+  g_autofree char *path2 = NULL;
+  int fd1, fd2;
+  guint32 fd_ids[2];
+  GUnixFDList *fd_list = NULL;
+  gboolean res;
+  char **out_doc_ids;
+  g_autoptr(GVariant) out_extra = NULL;
+  const char *permissions[] = { "read", NULL };
+  const char *basenames[] = { "doc1", "doc2" };
+  int i;
+
+  if (!have_fuse)
+    {
+      g_test_skip ("this test requires FUSE");
+      return;
+    }
+
+  path1 = g_build_filename (outdir, basenames[0], NULL);
+  g_file_set_contents (path1, basenames[0], -1, &error);
+  g_assert_no_error (error);
+
+  fd1 = open (path1, O_PATH | O_CLOEXEC);
+  g_assert (fd1 >= 0);
+
+  path2 = g_build_filename (outdir, basenames[1], NULL);
+  g_file_set_contents (path2, basenames[1], -1, &error);
+  g_assert_no_error (error);
+
+  fd2 = open (path2, O_PATH | O_CLOEXEC);
+  g_assert (fd2 >= 0);
+
+  fd_list = g_unix_fd_list_new ();
+  fd_ids[0] = g_unix_fd_list_append (fd_list, fd1, &error);
+  g_assert_no_error (error);
+  close (fd1);
+  fd_ids[1] = g_unix_fd_list_append (fd_list, fd2, &error);
+  g_assert_no_error (error);
+  close (fd2);
+
+  res = xdp_dbus_documents_call_add_full_sync (documents,
+                                               g_variant_new_fixed_array (G_VARIANT_TYPE_HANDLE,
+                                                                          fd_ids, 2, sizeof (guint32)),
+                                               0,
+                                               "org.other.App",
+                                               permissions,
+                                               fd_list,
+                                               &out_doc_ids,
+                                               &out_extra,
+                                               NULL,
+                                               NULL, &error);
+  g_assert_no_error (error);
+  g_assert (res);
+
+  g_assert (g_strv_length (out_doc_ids) == 2);
+  for (i = 0; i < 2; i++)
+    {
+      const char *id = out_doc_ids[i];
+
+      /* Ensure its there and not viewable by apps */
+      assert_doc_has_contents (id, basenames[i], NULL, basenames[i]);
+      assert_host_has_contents (basenames[i], basenames[i]);
+      assert_doc_not_exist (id, basenames[i], "com.test.App1");
+      assert_doc_not_exist (id, basenames[i], "com.test.App2");
+      assert_doc_not_exist (id, "another-file", NULL);
+      assert_doc_not_exist ("anotherid", basenames[i], NULL);
+
+      assert_doc_has_contents (id, basenames[i], "org.other.App", basenames[i]);
+      update_doc (id, basenames[i], "org.other.App", "tmpdata2", &error);
+      g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+      g_clear_error (&error);
+    }
+  g_assert (g_variant_lookup_value (out_extra, "mountpoint", G_VARIANT_TYPE_VARIANT) == 0);
+}
+
+
+static void
+global_setup (void)
+{
+  gboolean inited;
+  g_autofree gchar *fusermount = NULL;
+  GError *error = NULL;
+  g_autofree gchar *services = NULL;
+
+  fusermount = g_find_program_in_path ("fusermount");
+  /* cache result so subsequent tests can be marked as skipped */
+  have_fuse = (access ("/dev/fuse", W_OK) == 0 &&
+               fusermount != NULL &&
+               g_file_test (fusermount, G_FILE_TEST_IS_EXECUTABLE));
+
+  if (!have_fuse)
+    return;
+
+  g_mkdtemp (outdir);
+  g_print ("outdir: %s\n", outdir);
+
+  g_setenv ("XDG_RUNTIME_DIR", outdir, TRUE);
+  g_setenv ("XDG_DATA_HOME", outdir, TRUE);
+
+  dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
+  services = g_test_build_filename (G_TEST_BUILT, "services", NULL);
+  g_test_dbus_add_service_dir (dbus, services);
+  g_test_dbus_up (dbus);
+
+  /* g_test_dbus_up unsets this, so re-set */
+  g_setenv ("XDG_RUNTIME_DIR", outdir, TRUE);
+
+  session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+  g_assert_no_error (error);
+
+  documents = xdp_dbus_documents_proxy_new_sync (session_bus, 0,
+                                                 "org.freedesktop.portal.Documents",
+                                                 "/org/freedesktop/portal/documents",
+                                                 NULL, &error);
+  g_assert_no_error (error);
+  g_assert (documents != NULL);
+
+  inited = xdp_dbus_documents_call_get_mount_point_sync (documents, &mountpoint,
+                                                         NULL, &error);
+  g_assert_no_error (error);
+  g_assert (inited);
+  g_assert (mountpoint != NULL);
+}
+
+static void
+global_teardown (void)
+{
+  GError *error = NULL;
+
+  if (!have_fuse)
+    return;
+
+  g_free (mountpoint);
+
+  g_object_unref (documents);
+
+  g_dbus_connection_close_sync (session_bus, NULL, &error);
+  g_assert_no_error (error);
+
+  g_object_unref (session_bus);
+
+  g_test_dbus_down (dbus);
+
+  g_object_unref (dbus);
+
+  /* We race on the unmount of the fuse fs, which causes the rm -rf to stop at the doc dir.
+     This makes the chance of completely removing the directory higher */
+  sleep (1);
+
+  glnx_shutil_rm_rf_at (-1, outdir, NULL, NULL);
+}
+
+int
+main (int argc, char **argv)
+{
+  int res;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/db/create_doc", test_create_doc);
+  g_test_add_func ("/db/recursive_doc", test_recursive_doc);
+  g_test_add_func ("/db/create_docs", test_create_docs);
+
+  global_setup ();
+
+  res = g_test_run ();
+
+  global_teardown ();
+
+  return res;
+}
diff --git a/tests/test-extensions.sh b/tests/test-extensions.sh
new file mode 100755 (executable)
index 0000000..ce9d317
--- /dev/null
@@ -0,0 +1,165 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+
+echo "1..2"
+
+make_extension () {
+    local ID=$1
+    local VERSION=$2
+
+    local DIR=`mktemp -d`
+
+    cat > ${DIR}/metadata <<EOF
+[Runtime]
+name=${ID}
+EOF
+    mkdir -p ${DIR}/usr
+    mkdir -p ${DIR}/files
+    touch ${DIR}/usr/exists
+    touch ${DIR}/usr/extension-$ID:$VERSION
+
+    ${FLATPAK} build-export --runtime ${GPGARGS-} repos/test ${DIR} ${VERSION}
+    rm -rf ${DIR}
+
+    ${FLATPAK} --user install test-repo $ID $VERSION
+}
+
+add_extensions () {
+    local DIR=$1
+
+    mkdir -p $DIR/files/foo/ext1
+    mkdir -p $DIR/files/foo/ext2
+    mkdir -p $DIR/files/foo/ext3
+    mkdir -p $DIR/files/foo/ext4
+    mkdir -p $DIR/files/foo/none
+    mkdir -p $DIR/files/foo/dir
+    mkdir -p $DIR/files/foo/dir2
+
+    cat >> $DIR/metadata <<EOF
+[Extension org.test.Extension1]
+directory=foo/ext1
+
+[Extension org.test.Extension2]
+directory=foo/ext2
+version=master
+
+[Extension org.test.Extension3]
+directory=foo/ext3
+version=not-master
+
+[Extension org.test.Extension4]
+directory=foo/ext4
+version=not-master
+
+[Extension org.test.None]
+directory=foo/none
+
+[Extension org.test.Dir]
+directory=foo/dir
+subdirectories=true
+
+[Extension org.test.Dir2]
+directory=foo/dir2
+subdirectories=true
+
+EOF
+}
+
+mkdir -p repos
+ostree init --repo=repos/test --mode=archive-z2
+. $(dirname $0)/make-test-runtime.sh test org.test.Platform "" bash ls cat echo readlink > /dev/null
+. $(dirname $0)/make-test-app.sh test "" > /dev/null
+
+# Modify platform metadata
+ostree checkout -U --repo=repos/test runtime/org.test.Platform/${ARCH}/master platform
+add_extensions platform
+ostree commit --repo=repos/test --owner-uid=0 --owner-gid=0 --no-xattrs --branch=runtime/org.test.Platform/${ARCH}/master -s "modified metadata" platform
+ostree summary -u --repo=repos/test
+
+${FLATPAK} remote-add --user --no-gpg-verify test-repo repos/test
+${FLATPAK} --user install test-repo org.test.Platform master
+${FLATPAK} --user install test-repo org.test.Hello master
+
+make_extension org.test.Extension1 master
+make_extension org.test.Extension1 not-master
+make_extension org.test.Extension2 master
+make_extension org.test.Extension2 not-master
+make_extension org.test.Extension3 master
+make_extension org.test.Extension3 not-master
+make_extension org.test.Extension4 master
+make_extension org.test.Dir.foo master
+make_extension org.test.Dir.bar master
+
+assert_has_extension_file () {
+    local prefix=$1
+    local file=$2 
+    run_sh "test -f $prefix/foo/$file" || (echo 1>&2 "Couldn't find '$file'"; exit 1)
+}
+
+assert_not_has_extension_file () {
+    local prefix=$1
+    local file=$2 
+    if run_sh "test -f $prefix/foo/$file" ; then
+        echo 1>&2 "File '$file' exists";
+        exit 1
+    fi
+}
+
+assert_has_extension_file /usr ext1/exists
+assert_has_extension_file /usr ext1/extension-org.test.Extension1:master
+assert_has_extension_file /usr ext2/exists
+assert_has_extension_file /usr ext2/extension-org.test.Extension2:master
+assert_has_extension_file /usr ext3/exists
+assert_has_extension_file /usr ext3/extension-org.test.Extension3:not-master
+assert_not_has_extension_file /usr ext4/exists
+assert_has_extension_file /usr dir/foo/exists
+assert_has_extension_file /usr dir/foo/extension-org.test.Dir.foo:master
+assert_has_extension_file /usr dir/bar/extension-org.test.Dir.bar:master
+assert_not_has_extension_file /usr dir2/foo/exists
+
+echo "ok runtime extensions"
+
+# Modify app metadata
+ostree checkout -U --repo=repos/test app/org.test.Hello/${ARCH}/master hello
+add_extensions hello
+ostree commit --repo=repos/test --owner-uid=0 --owner-gid=0 --no-xattrs --branch=app/org.test.Hello/${ARCH}/master -s "modified metadata" hello
+ostree summary -u --repo=repos/test
+
+${FLATPAK} --user update org.test.Hello master
+
+assert_has_extension_file /app ext1/exists
+assert_has_extension_file /app ext1/extension-org.test.Extension1:master
+assert_has_extension_file /app ext2/exists
+assert_has_extension_file /app ext2/extension-org.test.Extension2:master
+assert_has_extension_file /app ext3/exists
+assert_has_extension_file /app ext3/extension-org.test.Extension3:not-master
+assert_not_has_extension_file /app ext4/exists
+assert_has_extension_file /app dir/foo/exists
+assert_has_extension_file /app dir/foo/extension-org.test.Dir.foo:master
+assert_has_extension_file /app dir/bar/extension-org.test.Dir.bar:master
+assert_not_has_extension_file /app dir2/foo/exists
+
+echo "ok app extensions"
diff --git a/tests/test-keyring/README b/tests/test-keyring/README
new file mode 100644 (file)
index 0000000..7586ed3
--- /dev/null
@@ -0,0 +1,3 @@
+These are completely random keys, which include the secret key.
+Use these for testing gpg signing, do *NOT* ever use these for any
+real application.
diff --git a/tests/test-keyring/pubring.gpg b/tests/test-keyring/pubring.gpg
new file mode 100644 (file)
index 0000000..7879191
Binary files /dev/null and b/tests/test-keyring/pubring.gpg differ
diff --git a/tests/test-keyring/secring.gpg b/tests/test-keyring/secring.gpg
new file mode 100644 (file)
index 0000000..03bc3fa
Binary files /dev/null and b/tests/test-keyring/secring.gpg differ
diff --git a/tests/test-keyring2/README b/tests/test-keyring2/README
new file mode 100644 (file)
index 0000000..7586ed3
--- /dev/null
@@ -0,0 +1,3 @@
+These are completely random keys, which include the secret key.
+Use these for testing gpg signing, do *NOT* ever use these for any
+real application.
diff --git a/tests/test-keyring2/pubring.gpg b/tests/test-keyring2/pubring.gpg
new file mode 100644 (file)
index 0000000..f5bf51a
Binary files /dev/null and b/tests/test-keyring2/pubring.gpg differ
diff --git a/tests/test-keyring2/secring.gpg b/tests/test-keyring2/secring.gpg
new file mode 100644 (file)
index 0000000..321581d
Binary files /dev/null and b/tests/test-keyring2/secring.gpg differ
diff --git a/tests/test-oci.sh b/tests/test-oci.sh
new file mode 100755 (executable)
index 0000000..916e533
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+export FLATPAK_ENABLE_EXPERIMENTAL_OCI=1
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+
+echo "1..2"
+
+setup_repo
+
+${FLATPAK} ${U} install test-repo org.test.Platform master
+
+mkdir -p oci
+${FLATPAK} build-bundle --oci $FL_GPGARGS repos/test oci/registry org.test.Hello
+
+assert_has_file oci/registry/oci-layout
+assert_has_dir oci/registry/blobs/sha256
+assert_has_file oci/registry/index.json
+
+for i in oci/registry/blobs/sha256/*; do
+     echo $(basename $i) $i >> sums
+done
+sha256sum -c sums
+
+echo "ok export oci"
+
+ostree --repo=repo2 init --mode=archive-z2
+
+$FLATPAK build-import-bundle --oci repo2 oci/registry
+
+ostree checkout -U --repo=repo2 app/org.test.Hello/$ARCH/master checked-out
+
+assert_has_dir checked-out/files
+assert_has_file checked-out/files/bin/hello.sh
+assert_has_file checked-out/metadata
+
+echo "ok import oci"
diff --git a/tests/test-repo-collections-server-only.sh b/tests/test-repo-collections-server-only.sh
new file mode 100755 (executable)
index 0000000..69b7168
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright © 2017 Endless Mobile, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_COLLECTIONS_IN_SERVER=yes
+export USE_COLLECTIONS_IN_CLIENT=no
+
+. $(dirname $0)/test-repo.sh
diff --git a/tests/test-repo-collections.sh b/tests/test-repo-collections.sh
new file mode 100755 (executable)
index 0000000..044ca24
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright © 2017 Endless Mobile, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_COLLECTIONS_IN_SERVER=yes
+export USE_COLLECTIONS_IN_CLIENT=yes
+
+. $(dirname $0)/test-repo.sh
diff --git a/tests/test-repo-system.sh b/tests/test-repo-system.sh
new file mode 100755 (executable)
index 0000000..a8410b0
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_SYSTEMDIR=yes
+
+. $(dirname $0)/test-repo.sh
diff --git a/tests/test-repo.sh b/tests/test-repo.sh
new file mode 100755 (executable)
index 0000000..2628c87
--- /dev/null
@@ -0,0 +1,296 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+
+if [ x${USE_COLLECTIONS_IN_CLIENT-} == xyes ] || [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+    skip_without_p2p
+fi
+
+echo "1..12"
+
+#Regular repo
+setup_repo
+
+# Unsigned repo (not supported with collections; client-side use of collections requires GPG)
+if [ x${USE_COLLECTIONS_IN_CLIENT-} == xyes ] ; then
+    if GPGPUBKEY=" " GPGARGS=" " setup_repo test-no-gpg org.test.Collection.NoGpg; then
+        assert_not_reached "Should fail remote-add due to missing GPG key"
+    fi
+elif [ x${USE_COLLECTIONS_IN_SERVER-} == xyes ] ; then
+    # Set a collection ID and GPG on the server, but not in the client configuration
+    setup_repo_no_add test-no-gpg org.test.Collection.NoGpg
+    port=$(cat httpd-port-main)
+    flatpak remote-add ${U} --no-gpg-verify test-no-gpg-repo "http://127.0.0.1:${port}/test-no-gpg"
+else
+    GPGPUBKEY="" GPGARGS="" setup_repo test-no-gpg
+fi
+
+#alternative gpg key repo
+GPGPUBKEY="${FL_GPG_HOMEDIR2}/pubring.gpg" GPGARGS="${FL_GPGARGS2}" setup_repo test-gpg2 org.test.Collection.Gpg2
+
+#remote with missing GPG key
+# Don’t use --collection-id= here, or the collections code will grab the appropriate
+# GPG key from one of the previously-configured remotes with the same collection ID.
+port=$(cat httpd-port-main)
+if flatpak remote-add ${U} test-missing-gpg-repo "http://127.0.0.1:${port}/test"; then
+    assert_not_reached "Should fail metadata-update due to missing gpg key"
+fi
+
+#remote with wrong GPG key
+port=$(cat httpd-port-main)
+if flatpak remote-add ${U} --gpg-import=${FL_GPG_HOMEDIR2}/pubring.gpg test-wrong-gpg-repo "http://127.0.0.1:${port}/test"; then
+    assert_not_reached "Should fail metadata-update due to wrong gpg key"
+fi
+
+if [ x${USE_COLLECTIONS_IN_CLIENT-} != xyes ] ; then
+    install_repo test-no-gpg
+    echo "ok install without gpg key"
+
+    ${FLATPAK} ${U} uninstall org.test.Platform org.test.Hello
+else
+    echo "ok install without gpg key # skip not supported for collections"
+fi
+
+install_repo test-gpg2
+echo "ok with alternative gpg key"
+
+if ${FLATPAK} ${U} install test-repo org.test.Platform 2> install-error-log; then
+    assert_not_reached "Should not be able to install again from different remote without reinstall"
+fi
+echo "ok failed to install again from different remote"
+
+${FLATPAK} ${U} install --reinstall test-repo org.test.Platform
+echo "ok re-install"
+
+${FLATPAK} ${U} uninstall org.test.Platform org.test.Hello
+
+if ${FLATPAK} ${U} install test-missing-gpg-repo org.test.Platform 2> install-error-log; then
+    assert_not_reached "Should not be able to install with missing gpg key"
+fi
+assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
+
+
+if ${FLATPAK} ${U} install test-missing-gpg-repo org.test.Hello 2> install-error-log; then
+    assert_not_reached "Should not be able to install with missing gpg key"
+fi
+assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
+
+echo "ok fail with missing gpg key"
+
+if ${FLATPAK} ${U} install test-wrong-gpg-repo org.test.Platform 2> install-error-log; then
+    assert_not_reached "Should not be able to install with wrong gpg key"
+fi
+assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
+
+if ${FLATPAK} ${U} install test-wrong-gpg-repo org.test.Hello 2> install-error-log; then
+    assert_not_reached "Should not be able to install with wrong gpg key"
+fi
+assert_file_has_content install-error-log "GPG signatures found, but none are in trusted keyring"
+
+echo "ok fail with wrong gpg key"
+
+${FLATPAK} ${U} remotes -d | grep ^test-repo > repo-info
+assert_not_file_has_content repo-info "new-title"
+UPDATE_REPO_ARGS=--title=new-title update_repo
+assert_file_has_content repos/test/config new-title
+
+# This should make us automatically pick up the new metadata
+${FLATPAK} ${U} install test-repo org.test.Platform
+${FLATPAK} ${U} remotes -d | grep ^test-repo > repo-info
+assert_file_has_content repo-info "new-title"
+
+echo "ok update metadata"
+
+port=$(cat httpd-port-main)
+UPDATE_REPO_ARGS="--redirect-url=http://127.0.0.1:${port}/test-gpg3 --gpg-import=${FL_GPG_HOMEDIR2}/pubring.gpg" update_repo
+GPGPUBKEY="${FL_GPG_HOMEDIR2}/pubring.gpg" GPGARGS="${FL_GPGARGS2}" setup_repo_no_add test-gpg3 org.test.Collection.test
+
+${FLATPAK} ${U} update org.test.Platform
+# Ensure we have the new uri
+${FLATPAK} ${U} remotes -d | grep ^test-repo > repo-info
+assert_file_has_content repo-info "/test-gpg3"
+
+# Make sure we also get new installs from the new repo
+GPGARGS="${FL_GPGARGS2}" make_updated_app test-gpg3 org.test.Collection.test
+update_repo test-gpg3 org.test.Collection.test
+
+${FLATPAK} ${U} install test-repo org.test.Hello
+assert_file_has_content $FL_DIR/app/org.test.Hello/$ARCH/master/active/files/bin/hello.sh UPDATED
+
+${FLATPAK} ${U} uninstall org.test.Platform org.test.Hello
+
+echo "ok redirect url and gpg key"
+
+# Test that remote-ls works in all of the following cases:
+# * system remote, and --system is used
+# * system remote, and --system is omitted
+# * user remote, and --user is used
+# * user remote, and --user is omitted
+# and fails in the following cases:
+# * system remote, and --user is used
+# * user remote, and --system is used
+if [ x${USE_SYSTEMDIR-} == xyes ]; then
+    ${FLATPAK} --system remote-ls test-repo > repo-list
+    assert_file_has_content repo-list "org.test.Hello"
+
+    ${FLATPAK} remote-ls test-repo > repo-list
+    assert_file_has_content repo-list "org.test.Hello"
+
+    if ${FLATPAK} --user remote-ls test-repo 2> remote-ls-error-log; then
+        assert_not_reached "flatpak --user remote-ls should not work for system remotes"
+    fi
+    assert_file_has_content remote-ls-error-log "Remote \"test-repo\" not found"
+else
+    ${FLATPAK} --user remote-ls test-repo > repo-list
+    assert_file_has_content repo-list "org.test.Hello"
+
+    ${FLATPAK} remote-ls test-repo > repo-list
+    assert_file_has_content repo-list "org.test.Hello"
+
+    if ${FLATPAK} --system remote-ls test-repo 2> remote-ls-error-log; then
+        assert_not_reached "flatpak --system remote-ls should not work for user remotes"
+    fi
+    assert_file_has_content remote-ls-error-log "Remote \"test-repo\" not found"
+fi
+
+echo "ok remote-ls"
+
+# Test that remote-modify works in all of the following cases:
+# * system remote, and --system is used
+# * system remote, and --system is omitted
+# * user remote, and --user is used
+# * user remote, and --user is omitted
+# and fails in the following cases:
+# * system remote, and --user is used
+# * user remote, and --system is used
+if [ x${USE_SYSTEMDIR-} == xyes ]; then
+    ${FLATPAK} --system remote-modify --title=NewTitle test-repo
+    ${FLATPAK} remotes -d | grep ^test-repo > repo-info
+    assert_file_has_content repo-info "NewTitle"
+    ${FLATPAK} --system remote-modify --title=OldTitle test-repo
+
+    ${FLATPAK} remote-modify --title=NewTitle test-repo
+    ${FLATPAK} remotes -d | grep ^test-repo > repo-info
+    assert_file_has_content repo-info "NewTitle"
+    ${FLATPAK} --system remote-modify --title=OldTitle test-repo
+
+    if ${FLATPAK} --user remote-modify --title=NewTitle test-repo 2> remote-modify-error-log; then
+        assert_not_reached "flatpak --user remote-modify should not work for system remotes"
+    fi
+    assert_file_has_content remote-modify-error-log "Remote \"test-repo\" not found"
+else
+    ${FLATPAK} --user remote-modify --title=NewTitle test-repo
+    ${FLATPAK} remotes -d | grep ^test-repo > repo-info
+    assert_file_has_content repo-info "NewTitle"
+    ${FLATPAK} --user remote-modify --title=OldTitle test-repo
+
+    ${FLATPAK} remote-modify --title=NewTitle test-repo
+    ${FLATPAK} remotes -d | grep ^test-repo > repo-info
+    assert_file_has_content repo-info "NewTitle"
+    ${FLATPAK} remote-modify --title=OldTitle test-repo
+
+    if ${FLATPAK} --system remote-modify --title=NewTitle test-repo 2> remote-modify-error-log; then
+        assert_not_reached "flatpak --system remote-modify should not work for user remotes"
+    fi
+    assert_file_has_content remote-modify-error-log "Remote \"test-repo\" not found"
+fi
+
+echo "ok remote-modify"
+
+# Test that remote-delete works in all of the following cases:
+# * system remote, and --system is used
+# * system remote, and --system is omitted
+# * user remote, and --user is used
+# * user remote, and --user is omitted
+# and fails in the following cases:
+# * system remote, and --user is used
+# * user remote, and --system is used
+if [ x${USE_SYSTEMDIR-} == xyes ]; then
+    ${FLATPAK} --system remote-delete test-repo
+    ${FLATPAK} remotes > repo-info
+    assert_not_file_has_content repo-info "test-repo"
+    setup_repo
+
+    ${FLATPAK} remote-delete test-repo
+    ${FLATPAK} remotes > repo-list
+    assert_not_file_has_content repo-info "test-repo"
+    setup_repo
+
+    if ${FLATPAK} --user remote-delete test-repo 2> remote-delete-error-log; then
+        assert_not_reached "flatpak --user remote-delete should not work for system remotes"
+    fi
+    assert_file_has_content remote-delete-error-log "Remote \"test-repo\" not found"
+else
+    ${FLATPAK} --user remote-delete test-repo
+    ${FLATPAK} remotes > repo-info
+    assert_not_file_has_content repo-info "test-repo"
+    setup_repo
+
+    ${FLATPAK} remote-delete test-repo
+    ${FLATPAK} remotes > repo-info
+    assert_not_file_has_content repo-info "test-repo"
+    setup_repo
+
+    if ${FLATPAK} --system remote-delete test-repo 2> remote-delete-error-log; then
+        assert_not_reached "flatpak --system remote-delete should not work for user remotes"
+    fi
+    assert_file_has_content remote-delete-error-log "Remote \"test-repo\" not found"
+fi
+
+echo "ok remote-delete"
+
+# Test that remote-info works in all of the following cases:
+# * system remote, and --system is used
+# * system remote, and --system is omitted
+# * user remote, and --user is used
+# * user remote, and --user is omitted
+# and fails in the following cases:
+# * system remote, and --user is used
+# * user remote, and --system is used
+if [ x${USE_SYSTEMDIR-} == xyes ]; then
+    ${FLATPAK} --system remote-info test-repo org.test.Hello > remote-ref-info
+    assert_file_has_content remote-ref-info "ID: org.test.Hello"
+
+    ${FLATPAK} remote-info test-repo org.test.Hello > remote-ref-info
+    assert_file_has_content remote-ref-info "ID: org.test.Hello"
+
+    if ${FLATPAK} --user remote-info test-repo org.test.Hello 2> remote-info-error-log; then
+        assert_not_reached "flatpak --user remote-info should not work for system remotes"
+    fi
+    assert_file_has_content remote-info-error-log "Remote \"test-repo\" not found"
+else
+    ${FLATPAK} --user remote-info test-repo org.test.Hello > remote-ref-info
+    assert_file_has_content remote-ref-info "ID: org.test.Hello"
+
+    ${FLATPAK} remote-info test-repo org.test.Hello > remote-ref-info
+    assert_file_has_content remote-ref-info "ID: org.test.Hello"
+
+    if ${FLATPAK} --system remote-info test-repo org.test.Hello 2> remote-info-error-log; then
+        assert_not_reached "flatpak --system remote-info should not work for user remotes"
+    fi
+    assert_file_has_content remote-info-error-log "Remote \"test-repo\" not found"
+fi
+
+echo "ok remote-info"
diff --git a/tests/test-run-deltas.sh b/tests/test-run-deltas.sh
new file mode 100755 (executable)
index 0000000..f178231
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_DELTAS=yes
+
+. $(dirname $0)/test-run.sh
diff --git a/tests/test-run-system-deltas.sh b/tests/test-run-system-deltas.sh
new file mode 100755 (executable)
index 0000000..507eee4
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_SYSTEMDIR=yes
+export USE_DELTAS=yes
+
+. $(dirname $0)/test-run.sh
diff --git a/tests/test-run-system.sh b/tests/test-run-system.sh
new file mode 100755 (executable)
index 0000000..d87f6e9
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+export USE_SYSTEMDIR=yes
+
+. $(dirname $0)/test-run.sh
diff --git a/tests/test-run.sh b/tests/test-run.sh
new file mode 100755 (executable)
index 0000000..5f498fb
--- /dev/null
@@ -0,0 +1,370 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+
+echo "1..12"
+
+setup_repo
+install_repo
+
+# Verify that app is correctly installed
+
+assert_has_dir $FL_DIR/app/org.test.Hello
+assert_has_symlink $FL_DIR/app/org.test.Hello/current
+assert_symlink_has_content $FL_DIR/app/org.test.Hello/current ^$ARCH/master$
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master
+assert_has_symlink $FL_DIR/app/org.test.Hello/$ARCH/master/active
+ID=`readlink $FL_DIR/app/org.test.Hello/$ARCH/master/active`
+assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/deploy
+assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/metadata
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
+assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
+assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
+# Ensure Exec key is rewritten
+assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
+assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
+assert_not_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/dont-export.png
+assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
+
+# Ensure triggers ran
+assert_has_file $FL_DIR/exports/share/applications/mimeinfo.cache
+assert_file_has_content $FL_DIR/exports/share/applications/mimeinfo.cache x-test/Hello
+assert_has_file $FL_DIR/exports/share/icons/hicolor/icon-theme.cache
+assert_has_file $FL_DIR/exports/share/icons/hicolor/index.theme
+
+$FLATPAK list ${U} | grep org.test.Hello > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep test-repo > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep current > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep ${ID:0:12} > /dev/null
+
+$FLATPAK info ${U} org.test.Hello > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep test-repo > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep $ID > /dev/null
+
+echo "ok install"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandbox$'
+
+echo "ok hello"
+
+run_sh cat /run/user/`id -u`/flatpak-info > fpi
+assert_file_has_content fpi '^name=org.test.Hello$'
+
+echo "ok flatpak-info"
+
+run_sh readlink /proc/self/ns/net > unshared_net_ns
+ARGS="--share=network" run_sh readlink /proc/self/ns/net > shared_net_ns
+assert_not_streq `cat unshared_net_ns` `readlink /proc/self/ns/net`
+assert_streq `cat shared_net_ns` `readlink /proc/self/ns/net`
+
+run_sh readlink /proc/self/ns/ipc > unshared_ipc_ns
+ARGS="--share=ipc" run_sh readlink /proc/self/ns/ipc > shared_ipc_ns
+assert_not_streq `cat unshared_ipc_ns` `readlink /proc/self/ns/ipc`
+assert_streq `cat shared_ipc_ns` `readlink /proc/self/ns/ipc`
+
+# We try the filesystem namespace tests several times with different
+# shared-or-not directories, because:
+# - --filesystem=/foo doesn't work if /foo is read-only in the container
+#   (notably, --filesystem=/usr/... won't work)
+# - --filesystem=host doesn't expose either /usr or /var/... or /var/tmp
+#   from the host because they're on the list of things we expect to be
+#   supplied by the container
+
+test_filesystem_binding () {
+    local dir="$1"
+
+    if run_sh cat "$dir/package_version.txt" &> /dev/null; then
+        assert_not_reached "Unexpectedly allowed to access file"
+    fi
+
+    case "$dir" in
+        (/home/*|/opt/*|/var/tmp/*)
+            if ! ARGS="--filesystem=$dir" run_sh cat "$dir/package_version.txt" > /dev/null; then
+                assert_not_reached "Failed to share --filesystem=$dir"
+            fi
+            ;;
+        (*)
+            echo "Not testing --filesystem=$dir, it won't necessarily work" >&2
+            ;;
+    esac
+
+    case "$dir" in
+        (/home/*|/opt/*)
+            if ! ARGS="--filesystem=host" run_sh cat "$dir/package_version.txt" > /dev/null; then
+                assert_not_reached "Failed to share $dir as part of host filesystem"
+            fi
+            ;;
+        (*)
+            echo "Not testing --filesystem=host with $dir, it won't necessarily work" >&2
+            ;;
+    esac
+}
+
+test_filesystem_binding "${test_builddir}"
+
+mkdir "${TEST_DATA_DIR}/shareable"
+cp "${test_builddir}/package_version.txt" "${TEST_DATA_DIR}/shareable/"
+test_filesystem_binding "${TEST_DATA_DIR}/shareable"
+
+# We don't want to pollute the home directory unprompted, but the user
+# can opt-in by creating this directory.
+if [ -e "${HOME}/.flatpak-tests" ]; then
+    cp "${test_builddir}/package_version.txt" "${HOME}/.flatpak-tests/"
+    test_filesystem_binding "${HOME}/.flatpak-tests"
+else
+    echo "not testing \$HOME binding, \$HOME/.flatpak-tests/ does not exist" >&2
+fi
+
+echo "ok namespaces"
+
+test_overrides () {
+    local dir="$1"
+
+    if run_sh cat "$dir/package_version.txt" &> /dev/null; then
+        assert_not_reached "Unexpectedly allowed to access file"
+    fi
+
+    $FLATPAK override ${U} --filesystem=host org.test.Hello
+
+    case "$dir" in
+        (/home/*|/opt/*)
+            if ! run_sh cat "$dir/package_version.txt" > /dev/null; then
+                assert_not_reached "Failed to share $dir as part of host filesystem"
+            fi
+            ;;
+        (*)
+            echo "Not testing --filesystem=host with $dir, it won't necessarily work" >&2
+            ;;
+    esac
+
+    if ARGS="--nofilesystem=host" run_sh cat "${dir}/package_version.txt" &> /dev/null; then
+        assert_not_reached "Unexpectedly allowed to access --nofilesystem=host file"
+    fi
+
+    $FLATPAK override ${U} --nofilesystem=host org.test.Hello
+
+    if run_sh cat "${dir}/package_version.txt" &> /dev/null; then
+        assert_not_reached "Unexpectedly allowed to access file"
+    fi
+}
+
+test_overrides "${test_builddir}"
+
+if [ -e "${HOME}/.flatpak-tests" ]; then
+    cp "${test_builddir}/package_version.txt" "${HOME}/.flatpak-tests/"
+    test_overrides "${HOME}/.flatpak-tests"
+else
+    echo "not testing \$HOME binding overrides, \$HOME/.flatpak-tests/ does not exist" >&2
+fi
+
+echo "ok overrides"
+
+OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+# TODO: For weird reasons this breaks in the system case. Needs debugging
+if [ x${USE_SYSTEMDIR-} != xyes ] ; then
+    ${FLATPAK} ${U} update -v org.test.Hello master
+    ALSO_OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+    assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
+fi
+
+echo "ok null update"
+
+make_updated_app
+
+${FLATPAK} ${U} update org.test.Hello
+
+NEW_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+assert_not_streq "$OLD_COMMIT" "$NEW_COMMIT"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
+
+echo "ok update"
+
+ostree --repo=repos/test reset app/org.test.Hello/$ARCH/master "$OLD_COMMIT"
+update_repo
+
+if ${FLATPAK} ${U} update org.test.Hello; then
+    assert_not_reached "Should not be able to update to older commit"
+fi
+
+NEW_NEW_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+
+assert_streq "$NEW_COMMIT" "$NEW_NEW_COMMIT"
+
+echo "ok backwards update"
+
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.Split org.test.Platform org.test.Platform
+
+mkdir -p ${DIR}/files/a
+echo "a" > ${DIR}/files/a/data
+mkdir -p ${DIR}/files/b
+echo "b" > ${DIR}/files/b/data
+mkdir -p ${DIR}/files/c
+echo "c" > ${DIR}/files/c/data
+mkdir -p ${DIR}/files/d
+echo "d" > ${DIR}/files/d/data
+echo "nope" > ${DIR}/files/nope
+
+${FLATPAK} build-finish --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+update_repo
+
+${FLATPAK} ${U} install test-repo org.test.Split --subpath=/a --subpath=/b --subpath=/nosuchdir master
+
+COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Split`
+if [ x${USE_SYSTEMDIR-} != xyes ] ; then
+    # Work around bug in ostree: local pulls don't do commitpartials
+    assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
+fi
+
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b/data
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nosuchdir
+
+echo "aa" > ${DIR}/files/a/data2
+rm  ${DIR}/files/a/data
+mkdir -p ${DIR}/files/e
+echo "e" > ${DIR}/files/e/data
+mkdir -p ${DIR}/files/f
+echo "f" > ${DIR}/files/f/data
+rm -rf  ${DIR}/files/b
+
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+update_repo
+
+${FLATPAK} ${U} update --subpath=/a --subpath=/b --subpath=/e --subpath=/nosuchdir org.test.Split
+
+COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Split`
+if [ x${USE_SYSTEMDIR-} != xyes ] ; then
+    # Work around bug in ostree: local pulls don't do commitpartials
+    assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
+fi
+
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data2
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/e/data
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/f
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
+
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+update_repo
+
+# Test reusing the old subpath list
+${FLATPAK} ${U} update org.test.Split
+
+COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Split`
+if [ x${USE_SYSTEMDIR-} != xyes ] ; then
+    # Work around bug in ostree: local pulls don't do commitpartials
+    assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
+fi
+
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data2
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
+assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/e/data
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/f
+assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
+
+echo "ok subpaths"
+
+VERSION=`cat "$test_builddir/package_version.txt"`
+
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.CurrentVersion org.test.Platform org.test.Platform
+${FLATPAK} build-finish --require-version=${VERSION} --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
+${FLATPAK} build-finish --require-version=0.6.10 --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.NewVersion org.test.Platform org.test.Platform
+${FLATPAK} build-finish --require-version=1${VERSION} --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+
+update_repo
+
+${FLATPAK} ${U} install test-repo org.test.OldVersion master
+${FLATPAK} ${U} install test-repo org.test.CurrentVersion master
+(! ${FLATPAK} ${U} install test-repo org.test.NewVersion master)
+
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
+${FLATPAK} build-finish --require-version=99.0.0 --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+
+(! ${FLATPAK} ${U} update org.test.OldVersion)
+
+DIR=`mktemp -d`
+${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
+${FLATPAK} build-finish --require-version=0.1.1 --command=hello.sh ${DIR}
+${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
+
+${FLATPAK} ${U} update org.test.OldVersion
+
+echo "ok version checks"
+
+rm -rf app
+flatpak build-init app org.test.Writable org.test.Platform org.test.Platform
+mkdir -p app/files/a-dir
+chmod a+rwx app/files/a-dir
+flatpak build-finish --command=hello.sh app
+ostree --repo=repos/test commit  ${FL_GPGARGS} --branch=app/org.test.Writable/$ARCH/master app
+update_repo
+
+${FLATPAK} ${U} install test-repo org.test.Writable
+
+assert_file_has_mode $FL_DIR/app/org.test.Writable/$ARCH/master/active/files/a-dir 775
+
+echo "ok no world writable dir"
+
+rm -rf app
+flatpak build-init app org.test.Setuid org.test.Platform org.test.Platform
+mkdir -p app/files/
+touch app/files/exe
+chmod u+s app/files/exe
+flatpak build-finish --command=hello.sh app
+ostree --repo=repos/test commit  ${FL_GPGARGS} --branch=app/org.test.Setuid/$ARCH/master app
+update_repo
+
+if ${FLATPAK} ${U} install test-repo org.test.Setuid &> err2.txt; then
+    assert_not_reached "Should not be able to install with setuid file"
+fi
+assert_file_has_content err2.txt [Ii]nvalid
+
+echo "ok no setuid"
diff --git a/tests/test-unsigned-summaries.sh b/tests/test-unsigned-summaries.sh
new file mode 100755 (executable)
index 0000000..9f89cbf
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/bash
+#
+# Copyright © 2017 Endless Mobile, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+# Authors:
+#  - Philip Withnall <withnall@endlessm.com>
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+skip_without_p2p
+
+echo "1..7"
+
+# Configure a repository and set up a collection ID for it. Check that setting
+# the collection ID in the remote config disables summary signature checking.
+setup_repo
+install_repo
+
+echo -e "[core]\ncollection-id=org.test.Collection" >> repos/test/config
+${FLATPAK} remote-modify ${U} test-repo --collection-id org.test.Collection
+
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=false$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=true$'
+assert_file_has_content ${FL_DIR}/repo/config '^collection-id=org.test.Collection$'
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify=false$'
+
+echo "ok 1 repo config with collections"
+
+# Test that building an app with a collection ID set produces the right
+# metadata in the resulting repository.
+DIR=$(mktemp -d)
+${FLATPAK} build-init ${DIR} org.test.App org.test.Platform org.test.Platform
+mkdir -p ${DIR}/files/a
+echo "a" > ${DIR}/files/a/data
+${FLATPAK} build-finish ${DIR} --socket=x11 --share=network --command=true
+${FLATPAK} build-export ${FL_GPGARGS} --update-appstream repos/test --collection-id org.test.Collection ${DIR} master
+update_repo
+
+ostree --repo=repos/test refs > refs
+assert_file_has_content refs "^app/org.test.App/$ARCH/master$"
+assert_file_has_content refs '^ostree-metadata$'
+assert_file_has_content refs "^appstream/${ARCH}$"
+ostree --repo=repos/test refs --collections > refs-collections
+assert_file_has_content refs-collections "^(org.test.Collection, app/org.test.App/$ARCH/master)$"
+assert_file_has_content refs-collections '^(org.test.Collection, ostree-metadata)$'
+assert_file_has_content refs-collections "^(org.test.Collection, appstream/${ARCH})$"
+assert_has_file repos/test/summary.sig
+ostree --repo=repos/test summary --view > summary
+assert_file_has_content summary '^Collection ID (ostree.summary.collection-id): org.test.Collection$'
+assert_file_has_content summary '^xa.cache: '
+ostree --repo=repos/test show --raw ostree-metadata > metadata
+assert_file_has_content metadata "'xa.cache': "
+assert_file_has_content metadata "'ostree.collection-binding': <'org.test.Collection'>"
+assert_file_has_content metadata "'ostree.ref-binding': <\['ostree-metadata'\]>"
+
+echo "ok 2 create app with collections"
+
+# Try installing the app.
+${FLATPAK} ${U} install test-repo org.test.App master
+${FLATPAK} ${U} uninstall org.test.App
+
+echo "ok 3 install app with collections"
+
+# Regenerate the summary so it doesn’t contain xa.cache and is unsigned; try installing again.
+ostree --repo=repos/test summary --update
+assert_not_has_file repos/test/summary.sig
+ostree --repo=repos/test summary --view > summary
+assert_file_has_content summary '^Collection ID (ostree.summary.collection-id): org.test.Collection$'
+assert_not_file_has_content summary '^xa.cache: '
+
+${FLATPAK} ${U} install test-repo org.test.App master
+${FLATPAK} ${U} uninstall org.test.App
+
+echo "ok 4 install app with collections from unsigned summary"
+
+# Try installing it from a flatpakref file. Don’t uninstall afterwards because
+# we need it for the next test.
+cat << EOF > org.test.App.flatpakref
+[Flatpak Ref]
+Title=Test App
+Name=org.test.App
+Branch=master
+Url=http://127.0.0.1:$(cat httpd-port-main)/test
+IsRuntime=False
+GPGKey=${FL_GPG_BASE64}
+#RuntimeRepo=http://127.0.0.1:$(cat httpd-port-main)/test
+CollectionID=org.test.Collection
+EOF
+
+${FLATPAK} ${U} install --from ./org.test.App.flatpakref
+${FLATPAK} ${U} uninstall org.test.App
+
+echo "ok 5 install app with collections from flatpakref"
+
+# Update the repo metadata and check that it changes in the ostree-metadata branch
+# and the summary file.
+${FLATPAK} build-update-repo ${FL_GPGARGS} --title "New title" repos/test
+
+assert_has_file repos/test/summary.sig
+ostree --repo=repos/test summary --view > summary
+assert_file_has_content summary '^Collection ID (ostree.summary.collection-id): org.test.Collection$'
+assert_file_has_content summary '^xa.title: '
+ostree --repo=repos/test show --raw ostree-metadata > metadata
+assert_file_has_content metadata "'xa.title': "
+assert_file_has_content metadata "'ostree.collection-binding': <'org.test.Collection'>"
+assert_file_has_content metadata "'ostree.ref-binding': <\['ostree-metadata'\]>"
+
+echo "ok 6 update repo metadata"
+
+# Try to install the app again, which should pull the updated repository
+# metadata as a side effect.
+${FLATPAK} ${U} install test-repo org.test.App master
+assert_file_has_content ${FL_DIR}/repo/config '^xa.title=New title$'
+
+echo "ok 7 pull updated repo metadata"
diff --git a/tests/test-update-remote-configuration.sh b/tests/test-update-remote-configuration.sh
new file mode 100755 (executable)
index 0000000..7043f3f
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# Copyright © 2017 Endless Mobile, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+# Authors:
+#  - Philip Withnall <withnall@endlessm.com>
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_bwrap
+[ x${USE_SYSTEMDIR-} != xyes ] || skip_without_user_xattrs
+skip_without_p2p
+
+echo "1..3"
+
+# Configure a repository without a collection ID and pull it locally.
+setup_repo
+install_repo
+
+DIR=$(mktemp -d)
+${FLATPAK} build-init ${DIR} org.test.App org.test.Platform org.test.Platform
+mkdir -p ${DIR}/files/a
+echo "a" > ${DIR}/files/a/data
+${FLATPAK} build-finish ${DIR} --socket=x11 --share=network --command=true
+${FLATPAK} build-export ${FL_GPGARGS} --update-appstream repos/test ${DIR} master
+update_repo
+
+${FLATPAK} ${U} install test-repo org.test.App master
+
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=false$'
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify=false$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^collection-id='
+
+# Change its configuration to include a collection ID, update the repository,
+# but don’t mark the collection ID as to be deployed yet. Ensure it doesn’t
+# appear in the client’s configuration.
+echo -e "[core]\ncollection-id=org.test.Collection" >> repos/test/config
+${FLATPAK} build-export ${FL_GPGARGS} --update-appstream repos/test --collection-id org.test.Collection ${DIR} master
+UPDATE_REPO_ARGS="--collection-id=org.test.Collection" update_repo
+
+${FLATPAK} ${U} update org.test.App master
+
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=false$'
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify=false$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^collection-id='
+
+echo "ok 1 update repo config without deploying collection ID"
+
+# Now mark the collection ID as to be deployed. The client configuration should
+# be updated.
+UPDATE_REPO_ARGS="--collection-id=org.test.Collection --deploy-collection-id" update_repo
+${FLATPAK} ${U} update org.test.App master
+
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=false$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify-summary=true$'
+assert_file_has_content ${FL_DIR}/repo/config '^gpg-verify=true$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^gpg-verify=false$'
+assert_file_has_content ${FL_DIR}/repo/config '^collection-id=org.test.Collection$'
+
+echo "ok 2 update repo config to deploy collection ID"
+
+# Try updating the collection ID to some other non-empty value on the server.
+# The client should ignore the update (otherwise we have a security vulnerability).
+# We have to manually add refs under the old collection ID so the client can pull
+# using its old collection ID.
+#UPDATE_REPO_ARGS="--collection-id=net.malicious.NewCollection --deploy-collection-id" update_repo
+#for ref in app/org.test.App/x86_64/master app/org.test.Hello/x86_64/master appstream/x86_64 ostree-metadata runtime/org.test.Platform/x86_64/master; do
+#  ostree --repo=repos/test refs --collections --create=org.test.Collection:$ref $ref
+#done
+ostree --repo=repos/test summary --update --add-metadata="xa.collection-id='net.malicious.NewCollection'"
+${FLATPAK} ${U} update org.test.App master
+
+assert_file_has_content ${FL_DIR}/repo/config '^collection-id=org.test.Collection$'
+assert_not_file_has_content ${FL_DIR}/repo/config '^collection-id=net.malicious.NewCollection$'
+
+echo "ok 3 update repo config to with different collection ID"
diff --git a/tests/test-webserver.sh b/tests/test-webserver.sh
new file mode 100755 (executable)
index 0000000..2964ce9
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -euo pipefail
+
+dir=$1
+test_tmpdir=$(pwd)
+
+cd ${dir}
+env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd-output &
+child_pid=$!
+
+for x in $(seq 50); do
+    # Snapshot the output
+    cp ${test_tmpdir}/httpd-output{,.tmp}
+    # If it's non-empty, see whether it matches our regexp
+    if test -s ${test_tmpdir}/httpd-output.tmp; then
+        sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
+        if ! cmp ${test_tmpdir}/httpd-output.tmp ${test_tmpdir}/httpd-port 1>/dev/null; then
+            # If so, we've successfully extracted the port
+            break
+        fi
+    fi
+    sleep 0.1
+done
+port=$(cat ${test_tmpdir}/httpd-port)
+echo "http://127.0.0.1:${port}" > ${test_tmpdir}/httpd-address
+echo "$child_pid" > ${test_tmpdir}/httpd-pid
diff --git a/tests/testdb.c b/tests/testdb.c
new file mode 100644 (file)
index 0000000..92d2bd8
--- /dev/null
@@ -0,0 +1,359 @@
+#include "config.h"
+
+#include <glib.h>
+#include <flatpak-db.h>
+
+/*
+static void
+dump_db (FlatpakDb *db)
+{
+  g_autofree char *s = flatpak_db_print (db);
+  g_printerr ("\n%s\n", s);
+}
+*/
+
+static FlatpakDb *
+create_test_db (gboolean serialized)
+{
+  FlatpakDb *db;
+
+  g_autoptr(FlatpakDbEntry) entry1 = NULL;
+  g_autoptr(FlatpakDbEntry) entry2 = NULL;
+  g_autoptr(FlatpakDbEntry) entry3 = NULL;
+  g_autoptr(FlatpakDbEntry) entry4 = NULL;
+  g_autoptr(FlatpakDbEntry) entry5 = NULL;
+  g_autoptr(FlatpakDbEntry) entry6 = NULL;
+  g_autoptr(FlatpakDbEntry) entry7 = NULL;
+  GError *error = NULL;
+  const char *permissions1[] = { "read", "write", NULL };
+  const char *permissions2[] = { "read", NULL };
+  const char *permissions3[] = { "write", NULL };
+
+  db = flatpak_db_new (NULL, FALSE, &error);
+  g_assert_no_error (error);
+  g_assert (db != NULL);
+
+  {
+    g_auto(GStrv) ids = flatpak_db_list_ids (db);
+    g_assert (ids != NULL);
+    g_assert (ids[0] == NULL);
+  }
+
+  {
+    g_auto(GStrv) apps = flatpak_db_list_apps (db);
+    g_assert (apps != NULL);
+    g_assert (apps[0] == NULL);
+  }
+
+  entry1 = flatpak_db_entry_new (g_variant_new_string ("foo-data"));
+  entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.bapp", permissions2);
+  entry3 = flatpak_db_entry_set_app_permissions (entry2, "org.test.app", permissions1);
+  entry4 = flatpak_db_entry_set_app_permissions (entry3, "org.test.capp", permissions1);
+
+  flatpak_db_set_entry (db, "foo", entry4);
+
+  entry5 = flatpak_db_entry_new (g_variant_new_string ("bar-data"));
+  entry6 = flatpak_db_entry_set_app_permissions (entry5, "org.test.app", permissions2);
+  entry7 = flatpak_db_entry_set_app_permissions (entry6, "org.test.dapp", permissions3);
+
+  flatpak_db_set_entry (db, "bar", entry7);
+
+  if (serialized)
+    flatpak_db_update (db);
+
+  return db;
+}
+
+static void
+verify_test_db (FlatpakDb *db)
+{
+  g_auto(GStrv) ids;
+  g_autofree const char **apps1 = NULL;
+  g_autofree const char **apps2 = NULL;
+  g_auto(GStrv) all_apps = NULL;
+
+  ids = flatpak_db_list_ids (db);
+  g_assert (g_strv_length (ids) == 2);
+  g_assert (g_strv_contains ((const char **) ids, "foo"));
+  g_assert (g_strv_contains ((const char **) ids, "bar"));
+
+  {
+    g_autoptr(FlatpakDbEntry) entry = NULL;
+    g_autofree const char **permissions1 = NULL;
+    g_autofree const char **permissions2 = NULL;
+    g_autofree const char **permissions3 = NULL;
+    g_autofree const char **permissions4 = NULL;
+    g_autoptr(GVariant) data1 = NULL;
+
+    entry = flatpak_db_lookup (db, "foo");
+    g_assert (entry != NULL);
+    data1 = flatpak_db_entry_get_data (entry);
+    g_assert (data1 != NULL);
+    g_assert_cmpstr (g_variant_get_type_string (data1), ==, "s");
+    g_assert_cmpstr (g_variant_get_string (data1, NULL), ==, "foo-data");
+    apps1 = flatpak_db_entry_list_apps (entry);
+    g_assert (g_strv_length ((char **) apps1) == 3);
+    g_assert (g_strv_contains (apps1, "org.test.app"));
+    g_assert (g_strv_contains (apps1, "org.test.bapp"));
+    g_assert (g_strv_contains (apps1, "org.test.capp"));
+    permissions1 = flatpak_db_entry_list_permissions (entry, "org.test.app");
+    g_assert (g_strv_length ((char **) permissions1) == 2);
+    g_assert (g_strv_contains (permissions1, "read"));
+    g_assert (g_strv_contains (permissions1, "write"));
+    permissions2 = flatpak_db_entry_list_permissions (entry, "org.test.bapp");
+    g_assert (g_strv_length ((char **) permissions2) == 1);
+    g_assert (g_strv_contains (permissions2, "read"));
+    permissions3 = flatpak_db_entry_list_permissions (entry, "org.test.capp");
+    g_assert (g_strv_length ((char **) permissions3) == 2);
+    g_assert (g_strv_contains (permissions3, "read"));
+    g_assert (g_strv_contains (permissions3, "write"));
+    permissions4 = flatpak_db_entry_list_permissions (entry, "org.test.noapp");
+    g_assert (permissions4 != NULL);
+    g_assert (g_strv_length ((char **) permissions4) == 0);
+  }
+
+  {
+    g_autoptr(FlatpakDbEntry) entry = NULL;
+    g_autofree const char **permissions5 = NULL;
+    g_autofree const char **permissions6 = NULL;
+    g_autoptr(GVariant) data2 = NULL;
+
+    entry = flatpak_db_lookup (db, "bar");
+    g_assert (entry != NULL);
+    data2 = flatpak_db_entry_get_data (entry);
+    g_assert (data2 != NULL);
+    g_assert_cmpstr (g_variant_get_type_string (data2), ==, "s");
+    g_assert_cmpstr (g_variant_get_string (data2, NULL), ==, "bar-data");
+    apps2 = flatpak_db_entry_list_apps (entry);
+    g_assert (g_strv_length ((char **) apps2) == 2);
+    g_assert (g_strv_contains (apps2, "org.test.app"));
+    g_assert (g_strv_contains (apps2, "org.test.dapp"));
+    permissions5 = flatpak_db_entry_list_permissions (entry, "org.test.app");
+    g_assert (g_strv_length ((char **) permissions5) == 1);
+    g_assert (g_strv_contains (permissions5, "read"));
+    permissions6 = flatpak_db_entry_list_permissions (entry, "org.test.dapp");
+    g_assert (g_strv_length ((char **) permissions6) == 1);
+    g_assert (g_strv_contains (permissions6, "write"));
+  }
+
+  {
+    g_autoptr(FlatpakDbEntry) entry = NULL;
+    entry = flatpak_db_lookup (db, "gazonk");
+    g_assert (entry == NULL);
+  }
+
+  all_apps = flatpak_db_list_apps (db);
+  g_assert (g_strv_length (all_apps) == 4);
+  g_assert (g_strv_contains ((const char **) all_apps, "org.test.app"));
+  g_assert (g_strv_contains ((const char **) all_apps, "org.test.bapp"));
+  g_assert (g_strv_contains ((const char **) all_apps, "org.test.capp"));
+  g_assert (g_strv_contains ((const char **) all_apps, "org.test.dapp"));
+}
+
+static void
+test_db_open (void)
+{
+  GError *error = NULL;
+  FlatpakDb *db;
+
+  db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "does_not_exist", NULL), TRUE, &error);
+  g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
+  g_assert (db == NULL);
+  g_clear_error (&error);
+
+  db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "does_not_exist", NULL), FALSE, &error);
+  g_assert_no_error (error);
+  g_assert (db != NULL);
+  g_clear_error (&error);
+  g_object_unref (db);
+
+  db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "no_tables", NULL), TRUE, &error);
+  g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
+  g_assert (db == NULL);
+  g_clear_error (&error);
+}
+
+static void
+test_serialize (void)
+{
+  g_autoptr(FlatpakDb) db = NULL;
+  g_autoptr(FlatpakDb) db2 = NULL;
+  g_autofree char *dump1 = NULL;
+  g_autofree char *dump2 = NULL;
+  g_autofree char *dump3 = NULL;
+  GError *error = NULL;
+  char tmpfile[] = "/tmp/testdbXXXXXX";
+  int fd;
+
+  db = create_test_db (FALSE);
+
+  verify_test_db (db);
+
+  dump1 = flatpak_db_print (db);
+
+  g_assert (flatpak_db_is_dirty (db));
+
+  flatpak_db_update (db);
+
+  verify_test_db (db);
+
+  g_assert (!flatpak_db_is_dirty (db));
+
+  dump2 = flatpak_db_print (db);
+
+  g_assert_cmpstr (dump1, ==, dump2);
+
+  fd = g_mkstemp (tmpfile);
+  close (fd);
+
+  flatpak_db_set_path (db, tmpfile);
+
+  flatpak_db_save_content (db, &error);
+  g_assert_no_error (error);
+
+  db2 = flatpak_db_new (tmpfile, TRUE, &error);
+  g_assert_no_error (error);
+  g_assert (db2 != NULL);
+
+  dump3 = flatpak_db_print (db2);
+
+  g_assert_cmpstr (dump1, ==, dump3);
+
+  unlink (tmpfile);
+}
+
+static void
+test_modify (void)
+{
+  g_autoptr(FlatpakDb) db = NULL;
+  const char *permissions[] = { "read", "write", "execute", NULL };
+  const char *no_permissions[] = { NULL };
+
+  db = create_test_db (FALSE);
+
+  /* Add permission */
+  {
+    g_autoptr(FlatpakDbEntry) entry1 = NULL;
+    g_autoptr(FlatpakDbEntry) entry2 = NULL;
+
+    entry1 = flatpak_db_lookup (db, "foo");
+    entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.app", permissions);
+    flatpak_db_set_entry (db, "foo", entry2);
+  }
+
+  /* Add entry */
+  {
+    g_autoptr(FlatpakDbEntry) entry1 = NULL;
+    g_autoptr(FlatpakDbEntry) entry2 = NULL;
+
+    entry1 = flatpak_db_entry_new (g_variant_new_string ("gazonk-data"));
+    entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.eapp", permissions);
+    flatpak_db_set_entry (db, "gazonk", entry2);
+  }
+
+  /* Remove permission */
+  {
+    g_autoptr(FlatpakDbEntry) entry1 = NULL;
+    g_autoptr(FlatpakDbEntry) entry2 = NULL;
+
+    entry1 = flatpak_db_lookup (db, "bar");
+    entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.dapp", no_permissions);
+    flatpak_db_set_entry (db, "bar", entry2);
+  }
+
+  /* Verify */
+  {
+    g_autoptr(FlatpakDbEntry) entry5 = NULL;
+    g_autoptr(FlatpakDbEntry) entry6 = NULL;
+    g_autoptr(FlatpakDbEntry) entry7 = NULL;
+    g_autofree const char **apps2 = NULL;
+    g_auto(GStrv) apps3 = NULL;
+    g_autofree const char **permissions1 = NULL;
+    g_autofree const char **permissions2 = NULL;
+    g_autofree const char **permissions3 = NULL;
+
+    entry5 = flatpak_db_lookup (db, "foo");
+    permissions1 = flatpak_db_entry_list_permissions (entry5, "org.test.app");
+    g_assert (g_strv_length ((char **) permissions1) == 3);
+    g_assert (g_strv_contains (permissions1, "read"));
+    g_assert (g_strv_contains (permissions1, "write"));
+    g_assert (g_strv_contains (permissions1, "execute"));
+
+    entry6 = flatpak_db_lookup (db, "bar");
+    permissions2 = flatpak_db_entry_list_permissions (entry6, "org.test.dapp");
+    g_assert (g_strv_length ((char **) permissions2) == 0);
+
+    entry7 = flatpak_db_lookup (db, "gazonk");
+    permissions3 = flatpak_db_entry_list_permissions (entry7, "org.test.eapp");
+    g_assert (g_strv_length ((char **) permissions3) == 3);
+    g_assert (g_strv_contains (permissions3, "read"));
+    g_assert (g_strv_contains (permissions3, "write"));
+    g_assert (g_strv_contains (permissions3, "execute"));
+
+    apps2 = flatpak_db_entry_list_apps (entry6);
+    g_assert_cmpint (g_strv_length ((char **) apps2), ==, 1);
+    g_assert (g_strv_contains (apps2, "org.test.app"));
+
+    apps3 = flatpak_db_list_apps (db);
+    g_assert_cmpint (g_strv_length (apps3), ==, 4);
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.app"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.bapp"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.capp"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.eapp"));
+  }
+
+  flatpak_db_update (db);
+
+  /* Verify after serialize */
+  {
+    g_autoptr(FlatpakDbEntry) entry5 = NULL;
+    g_autoptr(FlatpakDbEntry) entry6 = NULL;
+    g_autoptr(FlatpakDbEntry) entry7 = NULL;
+    g_autofree const char **apps2 = NULL;
+    g_auto(GStrv) apps3 = NULL;
+    g_autofree const char **permissions1 = NULL;
+    g_autofree const char **permissions2 = NULL;
+    g_autofree const char **permissions3 = NULL;
+
+    entry5 = flatpak_db_lookup (db, "foo");
+    permissions1 = flatpak_db_entry_list_permissions (entry5, "org.test.app");
+    g_assert (g_strv_length ((char **) permissions1) == 3);
+    g_assert (g_strv_contains (permissions1, "read"));
+    g_assert (g_strv_contains (permissions1, "write"));
+    g_assert (g_strv_contains (permissions1, "execute"));
+
+    entry6 = flatpak_db_lookup (db, "bar");
+    permissions2 = flatpak_db_entry_list_permissions (entry6, "org.test.dapp");
+    g_assert (g_strv_length ((char **) permissions2) == 0);
+
+    entry7 = flatpak_db_lookup (db, "gazonk");
+    permissions3 = flatpak_db_entry_list_permissions (entry7, "org.test.eapp");
+    g_assert (g_strv_length ((char **) permissions3) == 3);
+    g_assert (g_strv_contains (permissions3, "read"));
+    g_assert (g_strv_contains (permissions3, "write"));
+    g_assert (g_strv_contains (permissions3, "execute"));
+
+    apps2 = flatpak_db_entry_list_apps (entry6);
+    g_assert_cmpint (g_strv_length ((char **) apps2), ==, 1);
+    g_assert (g_strv_contains (apps2, "org.test.app"));
+
+    apps3 = flatpak_db_list_apps (db);
+    g_assert_cmpint (g_strv_length (apps3), ==, 4);
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.app"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.bapp"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.capp"));
+    g_assert (g_strv_contains ((const char **) apps3, "org.test.eapp"));
+  }
+}
+
+int
+main (int argc, char **argv)
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/db/open", test_db_open);
+  g_test_add_func ("/db/serialize", test_serialize);
+  g_test_add_func ("/db/modify", test_modify);
+
+  return g_test_run ();
+}
diff --git a/tests/testlibrary.c b/tests/testlibrary.c
new file mode 100644 (file)
index 0000000..2a4772a
--- /dev/null
@@ -0,0 +1,904 @@
+#include "config.h"
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <glib.h>
+
+#include "libglnx/libglnx.h"
+#include "flatpak.h"
+
+static char *testdir;
+static char *flatpak_runtimedir;
+static char *flatpak_systemdir;
+static char *flatpak_systemcachedir;
+static char *flatpak_configdir;
+static char *flatpak_installationsdir;
+static char *gpg_homedir;
+static char *gpg_args;
+static char *repo_url;
+#ifdef FLATPAK_ENABLE_P2P
+static char *repo_collection_id;
+#endif  /* FLATPAK_ENABLE_P2P */
+int httpd_pid = -1;
+
+static const char *gpg_id = "7B0961FD";
+const char *repo_name = "test-repo";
+
+typedef struct
+{
+  const char *id;
+  const char *display_name;
+  gint        priority;
+  FlatpakStorageType storage_type;
+} InstallationExtraData;
+
+static void
+test_library_version (void)
+{
+  g_autofree char *version = NULL;
+
+  version = g_strdup_printf ("%d.%d.%d" G_STRINGIFY(PACKAGE_EXTRA_VERSION),
+                             FLATPAK_MAJOR_VERSION,
+                             FLATPAK_MINOR_VERSION,
+                             FLATPAK_MICRO_VERSION);
+  g_assert_cmpstr (version, ==, PACKAGE_VERSION);
+}
+
+static void
+test_user_installation (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autofree char *path = NULL;
+  g_autofree char *expected_path = NULL;
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+  g_assert_nonnull (inst);
+
+  g_assert_true (flatpak_installation_get_is_user (inst));
+
+  dir = flatpak_installation_get_path (inst);
+  path = g_file_get_path (dir);
+  expected_path = g_build_filename (g_get_user_data_dir (), "flatpak", NULL);
+  g_assert_cmpstr (path, ==, expected_path);
+}
+
+static void
+test_system_installation (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autofree char *path = NULL;
+
+  inst = flatpak_installation_new_system (NULL, &error);
+  g_assert_no_error (error);
+  g_assert_nonnull (inst);
+
+  g_assert_false (flatpak_installation_get_is_user (inst));
+
+  dir = flatpak_installation_get_path (inst);
+  path = g_file_get_path (dir);
+  g_assert_cmpstr (path, ==, flatpak_systemdir);
+}
+
+static void
+test_multiple_system_installations (void)
+{
+  /* This is sorted according to the specific priority of each installation */
+  static InstallationExtraData expected_installations[] = {
+    { "extra-installation-2", "Extra system installation 2", 25, FLATPAK_STORAGE_TYPE_SDCARD},
+    { "extra-installation-1", "Extra system installation 1", 10, FLATPAK_STORAGE_TYPE_MMC},
+    { "extra-installation-3", NULL, 0, FLATPAK_STORAGE_TYPE_DEFAULT},
+    { "default", "Default system directory", 0, FLATPAK_STORAGE_TYPE_DEFAULT},
+  };
+
+  g_autoptr(GPtrArray) system_dirs = NULL;
+  g_autoptr(GError) error = NULL;
+
+  FlatpakInstallation *installation = NULL;
+  const char *current_id = NULL;
+  const char *current_display_name = NULL;
+  gint current_priority = 0;
+  FlatpakStorageType current_storage_type = FLATPAK_STORAGE_TYPE_DEFAULT;
+  int i;
+
+  system_dirs = flatpak_get_system_installations (NULL, &error);
+  g_assert_no_error (error);
+  g_assert_nonnull (system_dirs);
+  g_assert_cmpint (system_dirs->len, ==, 4);
+
+  for (i = 0; i < system_dirs->len; i++)
+    {
+      g_autoptr (FlatpakInstallation) new_install = NULL;
+      g_autoptr(GFile) installation_path = NULL;
+      g_autofree char *path_str = NULL;
+
+      installation = (FlatpakInstallation*) g_ptr_array_index (system_dirs, i);
+      g_assert_false (flatpak_installation_get_is_user (installation));
+
+      installation_path = flatpak_installation_get_path (installation);
+      g_assert_nonnull (installation_path);
+
+      current_id = flatpak_installation_get_id (installation);
+      g_assert_cmpstr (current_id, ==, expected_installations[i].id);
+
+      path_str = g_file_get_path (installation_path);
+      if (g_strcmp0 (current_id, "default") == 0)
+        g_assert_cmpstr (path_str, ==, flatpak_systemdir);
+      else
+        g_assert_cmpstr (path_str, !=, flatpak_systemdir);
+
+      current_display_name = flatpak_installation_get_display_name (installation);
+      g_assert_cmpstr (current_display_name, ==, expected_installations[i].display_name);
+
+      current_priority = flatpak_installation_get_priority (installation);
+      g_assert_cmpint (current_priority, ==, expected_installations[i].priority);
+
+      current_storage_type = flatpak_installation_get_storage_type (installation);
+      g_assert_cmpint (current_storage_type, ==, expected_installations[i].storage_type);
+
+      /* Now test that flatpak_installation_new_system_with_id() works too */
+
+      new_install = flatpak_installation_new_system_with_id (current_id, NULL, &error);
+      g_assert_nonnull (new_install);
+
+      g_assert_cmpstr(current_id, ==, flatpak_installation_get_id (new_install));
+      g_assert_cmpstr(current_display_name, ==, flatpak_installation_get_display_name (new_install));
+      g_assert_cmpint(current_priority, ==, flatpak_installation_get_priority (new_install));
+      g_assert_cmpint(current_storage_type, ==, flatpak_installation_get_storage_type (new_install));
+    }
+}
+
+static void
+test_arches (void)
+{
+  const char *default_arch;
+  const char *const *supported_arches;
+
+  default_arch = flatpak_get_default_arch ();
+  supported_arches = flatpak_get_supported_arches ();
+
+  g_assert_nonnull (default_arch);
+  g_assert_cmpstr (default_arch, !=, "");
+
+  g_assert_nonnull (supported_arches);
+  g_assert (g_strv_contains (supported_arches, default_arch));
+}
+
+static void
+test_ref (void)
+{
+  g_autoptr(FlatpakRef) ref = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autofree char *formatted = NULL;
+  const char *valid;
+
+  ref = flatpak_ref_parse ("", &error);
+  g_assert_null (ref);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+
+  ref = flatpak_ref_parse ("ref/or not", &error);
+  g_assert_null (ref);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+
+  ref = flatpak_ref_parse ("ref/one/2/3", &error);
+  g_assert_null (ref);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+
+  ref = flatpak_ref_parse ("app/a/b/c", &error);
+  g_assert_null (ref);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+
+  ref = flatpak_ref_parse ("app/org.flatpak.Hello/b/.", &error);
+  g_assert_null (ref);
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
+  g_clear_error (&error);
+
+  valid = "app/org.flatpak.Hello/x86_64/master";
+  ref = flatpak_ref_parse (valid, &error);
+  g_assert_no_error (error);
+  g_assert (FLATPAK_IS_REF (ref));
+  g_assert_cmpint (flatpak_ref_get_kind (ref), ==, FLATPAK_REF_KIND_APP);
+  g_assert_cmpstr (flatpak_ref_get_name (ref), ==, "org.flatpak.Hello");
+  g_assert_cmpstr (flatpak_ref_get_arch (ref), ==, "x86_64");
+  g_assert_cmpstr (flatpak_ref_get_branch (ref), ==, "master");
+#ifdef FLATPAK_ENABLE_P2P
+  g_assert_null (flatpak_ref_get_collection_id (ref));
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  formatted = flatpak_ref_format_ref (ref);
+  g_assert_cmpstr (formatted, ==, valid);
+}
+
+static void
+test_list_remotes (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GPtrArray) remotes = NULL;
+  FlatpakRemote *remote;
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+
+  remotes = flatpak_installation_list_remotes (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_nonnull (remotes);
+  g_assert (remotes->len == 1);
+
+  remote = g_ptr_array_index (remotes, 0);
+  g_assert (FLATPAK_IS_REMOTE (remote));
+}
+
+static void
+test_remote_by_name (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  FlatpakRemote *remote;
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+
+  remote = flatpak_installation_get_remote_by_name (inst, repo_name, NULL, &error);
+  g_assert_no_error (error);
+
+  g_assert (FLATPAK_IS_REMOTE (remote));
+  g_assert_cmpstr (flatpak_remote_get_name (remote), ==, repo_name);
+  g_assert_cmpstr (flatpak_remote_get_url (remote), ==, repo_url);
+  g_assert_cmpstr (flatpak_remote_get_title (remote), ==, NULL);
+  g_assert_cmpint (flatpak_remote_get_remote_type (remote), ==, FLATPAK_REMOTE_TYPE_STATIC);
+  g_assert_false (flatpak_remote_get_noenumerate (remote));
+  g_assert_false (flatpak_remote_get_disabled (remote));
+  g_assert_true (flatpak_remote_get_gpg_verify (remote));
+  g_assert_cmpint (flatpak_remote_get_prio (remote), ==, 1);
+
+#ifdef FLATPAK_ENABLE_P2P
+  g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, repo_collection_id);
+#endif  /* FLATPAK_ENABLE_P2P */
+}
+
+static void
+test_remote (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(FlatpakRemote) remote = NULL;
+  gboolean res;
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+
+  remote = flatpak_installation_get_remote_by_name (inst, repo_name, NULL, &error);
+  g_assert_no_error (error);
+
+#ifdef FLATPAK_ENABLE_P2P
+  g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, NULL);
+  flatpak_remote_set_collection_id (remote, "org.example.CollectionID");
+  g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, "org.example.CollectionID");
+  /* Don’t leave the collection ID set since the repos aren’t configured with one. */
+  flatpak_remote_set_collection_id (remote, NULL);
+  g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, NULL);
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  g_assert_cmpstr (flatpak_remote_get_title (remote), ==, NULL);
+  flatpak_remote_set_title (remote, "Test Repo");
+  g_assert_cmpstr (flatpak_remote_get_title (remote), ==, "Test Repo");
+
+  g_assert_cmpint (flatpak_remote_get_prio (remote), ==, 1);
+  flatpak_remote_set_prio (remote, 15);
+  g_assert_cmpint (flatpak_remote_get_prio (remote), ==, 15);
+
+  res = flatpak_installation_modify_remote (inst, remote, NULL, &error);
+  g_assert_true (res);
+  g_assert_no_error (error);
+
+  g_clear_object (&remote);
+
+  remote = flatpak_installation_get_remote_by_name (inst, repo_name, NULL, &error);
+  g_assert_no_error (error);
+
+  g_assert_cmpstr (flatpak_remote_get_title (remote), ==, "Test Repo");
+  g_assert_cmpint (flatpak_remote_get_prio (remote), ==, 15);
+}
+
+static void
+test_list_refs (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(GPtrArray) refs = NULL;
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_nonnull (refs);
+  g_assert_cmpint (refs->len, ==, 0);
+}
+
+static void
+progress_cb (const char *status,
+             guint progress,
+             gboolean estimating,
+             gpointer user_data)
+{
+  int *count = user_data;
+  *count += 1;
+}
+
+static void
+changed_cb (GFileMonitor *monitor,
+            GFile *file,
+            GFile *other_file,
+            GFileMonitorEvent event_type,
+            gpointer user_data)
+{
+  int *count = user_data;
+  *count += 1;
+}
+
+static gboolean
+timeout_cb (gpointer data)
+{
+  gboolean *timeout_reached = data;
+  *timeout_reached = TRUE;
+  return G_SOURCE_CONTINUE;
+}
+
+static void
+test_install_launch_uninstall (void)
+{
+  g_autoptr(FlatpakInstallation) inst = NULL;
+  g_autoptr(GFileMonitor) monitor = NULL;
+  g_autoptr(GError) error = NULL;
+  g_autoptr(FlatpakInstalledRef) ref = NULL;
+  g_autoptr(FlatpakInstalledRef) runtime_ref = NULL;
+  FlatpakInstalledRef *ref1 = NULL;
+  GPtrArray *refs = NULL;
+  g_autofree char *s = NULL;
+  g_autofree char *s1 = NULL;
+  int progress_count, changed_count;
+  gboolean timeout_reached;
+  guint timeout_id;
+  gboolean res;
+  const char *bwrap = g_getenv ("FLATPAK_BWRAP");
+
+  if (bwrap != NULL)
+    {
+      gint exit_code = 0;
+      char *argv[] = { (char *)bwrap, "--unshare-ipc", "--unshare-net",
+          "--unshare-pid", "--ro-bind", "/", "/", "/bin/true", NULL };
+      g_autofree char *argv_str = g_strjoinv (" ", argv);
+      g_test_message ("Spawning %s", argv_str);
+      g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error);
+      g_assert_no_error (error);
+      if (exit_code != 0)
+        {
+          g_test_skip ("bwrap not supported");
+          return;
+        }
+    }
+
+  inst = flatpak_installation_new_user (NULL, &error);
+  g_assert_no_error (error);
+
+  monitor = flatpak_installation_create_monitor (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert (G_IS_FILE_MONITOR (monitor));
+  g_file_monitor_set_rate_limit (monitor, 100);
+
+  g_signal_connect (monitor, "changed", G_CALLBACK (changed_cb), &changed_count);
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpint (refs->len, ==, 0);
+  g_ptr_array_unref (refs);
+
+  changed_count = 0;
+  progress_count = 0;
+  timeout_reached = FALSE;
+  ref = flatpak_installation_install (inst,
+                                      repo_name,
+                                      FLATPAK_REF_KIND_RUNTIME,
+                                      "org.test.Platform",
+                                      NULL,
+                                      NULL,
+                                      progress_cb,
+                                      &progress_count,
+                                      NULL,
+                                      &error);
+  g_assert_no_error (error);
+  g_assert (FLATPAK_IS_INSTALLED_REF (ref));
+  g_assert_cmpint (progress_count, >, 0);
+
+  timeout_id = g_timeout_add (20000, timeout_cb, &timeout_reached);
+  while (!timeout_reached && changed_count == 0)
+    g_main_context_iteration (NULL, TRUE);
+  g_source_remove (timeout_id);
+
+  g_assert_cmpint (changed_count, >, 0);
+
+  g_assert_cmpstr (flatpak_ref_get_name (FLATPAK_REF (ref)), ==, "org.test.Platform");
+  g_assert_cmpstr (flatpak_ref_get_arch (FLATPAK_REF (ref)), ==, flatpak_get_default_arch ());
+  g_assert_cmpstr (flatpak_ref_get_branch (FLATPAK_REF (ref)), ==, "master");
+  g_assert_cmpint (flatpak_ref_get_kind (FLATPAK_REF (ref)), ==, FLATPAK_REF_KIND_RUNTIME);
+#ifdef FLATPAK_ENABLE_P2P
+  g_assert_null (flatpak_ref_get_collection_id (FLATPAK_REF (ref)));
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  g_assert_cmpuint (flatpak_installed_ref_get_installed_size (ref), >, 0);
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpint (refs->len, ==, 1);
+
+  ref1 = g_ptr_array_index (refs, 0);
+  g_assert_cmpstr (flatpak_ref_get_commit (FLATPAK_REF (ref1)), ==, flatpak_ref_get_commit (FLATPAK_REF (ref)));
+
+  s = flatpak_ref_format_ref (FLATPAK_REF (ref));
+  s1 = flatpak_ref_format_ref (FLATPAK_REF (ref1));
+  g_assert_cmpstr (s, ==, s1);
+
+  g_ptr_array_unref (refs);
+
+  runtime_ref = g_object_ref (ref);
+  g_clear_object (&ref);
+
+  changed_count = 0;
+  progress_count = 0;
+  timeout_reached = FALSE;
+  ref = flatpak_installation_install (inst,
+                                      repo_name,
+                                      FLATPAK_REF_KIND_APP,
+                                      "org.test.Hello",
+                                      NULL,
+                                      NULL,
+                                      progress_cb,
+                                      &progress_count,
+                                      NULL,
+                                      &error);
+  g_assert_no_error (error);
+  g_assert (FLATPAK_IS_INSTALLED_REF (ref));
+  g_assert_cmpint (progress_count, >, 0);
+
+  timeout_id = g_timeout_add (20000, timeout_cb, &timeout_reached);
+  while (!timeout_reached && changed_count == 0)
+    g_main_context_iteration (NULL, TRUE);
+  g_source_remove (timeout_id);
+
+  g_assert_cmpint (changed_count, >, 0);
+
+  g_assert_cmpstr (flatpak_ref_get_name (FLATPAK_REF (ref)), ==, "org.test.Hello");
+  g_assert_cmpstr (flatpak_ref_get_arch (FLATPAK_REF (ref)), ==, flatpak_get_default_arch ());
+  g_assert_cmpstr (flatpak_ref_get_branch (FLATPAK_REF (ref)), ==, "master");
+  g_assert_cmpint (flatpak_ref_get_kind (FLATPAK_REF (ref)), ==, FLATPAK_REF_KIND_APP);
+#ifdef FLATPAK_ENABLE_P2P
+  g_assert_null (flatpak_ref_get_collection_id (FLATPAK_REF (ref)));
+#endif  /* FLATPAK_ENABLE_P2P */
+
+  g_assert_cmpuint (flatpak_installed_ref_get_installed_size (ref), >, 0);
+  g_assert_true (flatpak_installed_ref_get_is_current (ref));
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpint (refs->len, ==, 2);
+
+  g_ptr_array_unref (refs);
+
+  res = flatpak_installation_launch (inst, "org.test.Hello", NULL, NULL, NULL, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_true (res);
+
+  timeout_reached = FALSE;
+  timeout_id = g_timeout_add (500, timeout_cb, &timeout_reached);
+  while (!timeout_reached)
+    g_main_context_iteration (NULL, TRUE);
+  g_source_remove (timeout_id);
+
+  changed_count = 0;
+  progress_count = 0;
+  res = flatpak_installation_uninstall (inst,
+                                        flatpak_ref_get_kind (FLATPAK_REF (ref)),
+                                        flatpak_ref_get_name (FLATPAK_REF (ref)),
+                                        flatpak_ref_get_arch (FLATPAK_REF (ref)),
+                                        flatpak_ref_get_branch (FLATPAK_REF (ref)),
+                                        progress_cb,
+                                        &progress_count,
+                                        NULL,
+                                        &error);
+  g_assert_no_error (error);
+  g_assert_true (res);
+  //FIXME: no progress for uninstall
+  //g_assert_cmpint (progress_count, >, 0);
+
+  timeout_reached = FALSE;
+  timeout_id = g_timeout_add (500, timeout_cb, &timeout_reached);
+  while (!timeout_reached && changed_count == 0)
+    g_main_context_iteration (NULL, TRUE);
+  g_source_remove (timeout_id);
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpint (refs->len, ==, 1);
+
+  g_ptr_array_unref (refs);
+
+  changed_count = 0;
+  progress_count = 0;
+  res = flatpak_installation_uninstall (inst,
+                                        flatpak_ref_get_kind (FLATPAK_REF (runtime_ref)),
+                                        flatpak_ref_get_name (FLATPAK_REF (runtime_ref)),
+                                        flatpak_ref_get_arch (FLATPAK_REF (runtime_ref)),
+                                        flatpak_ref_get_branch (FLATPAK_REF (runtime_ref)),
+                                        progress_cb,
+                                        &progress_count,
+                                        NULL,
+                                        &error);
+  g_assert_no_error (error);
+  g_assert_true (res);
+  //FIXME: no progress for uninstall
+  //g_assert_cmpint (progress_count, >, 0);
+
+  timeout_reached = FALSE;
+  timeout_id = g_timeout_add (500, timeout_cb, &timeout_reached);
+  while (!timeout_reached && changed_count == 0)
+    g_main_context_iteration (NULL, TRUE);
+  g_source_remove (timeout_id);
+
+  refs = flatpak_installation_list_installed_refs (inst, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpint (refs->len, ==, 0);
+
+  g_ptr_array_unref (refs);
+}
+
+typedef enum
+{
+  RUN_TEST_SUBPROCESS_DEFAULT = 0,
+  RUN_TEST_SUBPROCESS_IGNORE_FAILURE = (1 << 0),
+  RUN_TEST_SUBPROCESS_NO_CAPTURE = (1 << 1),
+} RunTestSubprocessFlags;
+
+static void
+run_test_subprocess (char **argv,
+                     RunTestSubprocessFlags flags)
+{
+  int status;
+  g_autoptr(GError) error = NULL;
+  g_autofree char *argv_str = g_strjoinv (" ", argv);
+  g_autofree char *output = NULL;
+  g_autofree char *errors = NULL;
+
+  g_test_message ("Spawning %s", argv_str);
+
+  if (flags & RUN_TEST_SUBPROCESS_NO_CAPTURE)
+    g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, &status, &error);
+  else
+    g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &output, &errors, &status, &error);
+
+  g_assert_no_error (error);
+
+  if (output != NULL && output[0] != '\0')
+    {
+      g_autofree char *escaped = g_strescape (output, NULL);
+
+      g_test_message ("\"%s\" stdout: %s", argv_str, escaped);
+    }
+
+  if (errors != NULL && errors[0] != '\0')
+    {
+      g_autofree char *escaped = g_strescape (errors, NULL);
+
+      g_test_message ("\"%s\" stderr: %s", argv_str, escaped);
+    }
+
+  g_test_message ("\"%s\" wait status: %d", argv_str, status);
+
+  if (WIFEXITED (status))
+    g_test_message ("\"%s\" exited %d", argv_str, WEXITSTATUS (status));
+
+  if (WIFSIGNALED (status))
+    g_test_message ("\"%s\" killed by signal %d", argv_str, WTERMSIG (status));
+
+  if (g_spawn_check_exit_status (status, &error))
+    return;
+  else if (flags & RUN_TEST_SUBPROCESS_IGNORE_FAILURE)
+    g_test_message ("\"%s\" failed: %s", argv_str, error->message);
+  else
+    g_assert_no_error (error);
+}
+
+static void
+make_test_runtime (void)
+{
+  g_autofree char *arg0 = NULL;
+  char *argv[] = {
+    NULL, "test", "org.test.Platform", "", "bash", "ls", "cat", "echo", "readlink", NULL
+  };
+
+  arg0 = g_test_build_filename (G_TEST_DIST, "make-test-runtime.sh", NULL);
+  argv[0] = arg0;
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
+}
+
+static void
+make_test_app (void)
+{
+  g_autofree char *arg0 = NULL;
+  char *argv[] = { NULL, "test", "", NULL };
+
+  arg0 = g_test_build_filename (G_TEST_DIST, "make-test-app.sh", NULL);
+  argv[0] = arg0;
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
+}
+
+static void
+update_repo (void)
+{
+  char *argv[] = { "flatpak", "build-update-repo", "--gpg-homedir=", "--gpg-sign=", "repos/test", NULL };
+  g_auto(GStrv) gpgargs = NULL;
+
+  gpgargs = g_strsplit (gpg_args, " ", 0);
+  argv[2] = gpgargs[0];
+  argv[3] = gpgargs[1];
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
+}
+
+static void
+launch_httpd (void)
+{
+  g_autofree char *path = g_test_build_filename (G_TEST_DIST, "test-webserver.sh", NULL);
+  char *argv[] = {path , "repos", NULL };
+
+  /* The web server puts itself in the background, so we can't wait
+   * for EOF on its stdout, stderr */
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_NO_CAPTURE);
+}
+
+static void
+add_remote (void)
+{
+  g_autoptr(GError) error = NULL;
+  char *argv[] = { "flatpak", "remote-add", "--user", "--gpg-import=", "name", "url", NULL };
+  g_autofree char *argv_str = NULL;
+  g_autofree char *gpgimport = NULL;
+  g_autofree char *port = NULL;
+  g_autofree char *pid = NULL;
+
+  launch_httpd ();
+
+  g_file_get_contents ("httpd-pid", &pid, NULL, &error);
+  g_assert_no_error (error);
+
+  httpd_pid = atoi (pid);
+  g_assert_cmpint (httpd_pid, !=, 0);
+
+  g_file_get_contents ("httpd-port", &port, NULL, &error);
+  g_assert_no_error (error);
+
+  if (port[strlen (port) - 1] == '\n')
+    port[strlen (port) - 1] = '\0';
+
+  gpgimport = g_strdup_printf ("--gpg-import=%s/pubring.gpg", gpg_homedir);
+  repo_url = g_strdup_printf ("http://127.0.0.1:%s/test", port);
+
+  argv[3] = gpgimport;
+  argv[4] = (char *)repo_name;
+  argv[5] = repo_url;
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
+}
+
+static void
+add_extra_installation (const char *id,
+                        const char *display_name,
+                        const char *storage_type,
+                        const char *priority)
+{
+  g_autofree char *conffile_path = NULL;
+  g_autofree char *contents_string = NULL;
+  g_autofree char *path = NULL;
+  g_autoptr(GPtrArray) contents_array = NULL;
+  g_autoptr(GError) error = NULL;
+
+  path = g_strconcat (testdir, "/system-", id, NULL);
+  g_mkdir_with_parents (path, S_IRWXU|S_IRWXG|S_IRWXO);
+
+  contents_array = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
+
+  g_ptr_array_add (contents_array,
+      g_strdup_printf ("[Installation \"%s\"]\n"
+                       "Path=%s",
+                       id, path));
+
+  if (display_name != NULL)
+    g_ptr_array_add (contents_array, g_strdup_printf ("DisplayName=%s", display_name));
+
+  if (storage_type != NULL)
+    g_ptr_array_add (contents_array, g_strdup_printf ("StorageType=%s", storage_type));
+
+  if (priority != NULL)
+    g_ptr_array_add (contents_array, g_strdup_printf ("Priority=%s", priority));
+
+  g_ptr_array_add (contents_array, NULL);
+  contents_string = g_strjoinv ("\n", (char**)contents_array->pdata);
+
+  conffile_path = g_strconcat (flatpak_installationsdir, "/", id, ".conf", NULL);
+  g_file_set_contents (conffile_path, contents_string, -1, &error);
+  g_assert_no_error (error);
+}
+
+static void
+setup_multiple_installations (void)
+{
+  flatpak_installationsdir = g_strconcat (flatpak_configdir, "/installations.d", NULL);
+  g_mkdir_with_parents (flatpak_installationsdir, S_IRWXU|S_IRWXG|S_IRWXO);
+
+  add_extra_installation ("extra-installation-1", "Extra system installation 1", "mmc", "10");
+  add_extra_installation ("extra-installation-2", "Extra system installation 2", "sdcard", "25");
+  add_extra_installation ("extra-installation-3", NULL, NULL, NULL);
+}
+
+static void
+setup_repo (void)
+{
+  make_test_runtime ();
+  make_test_app ();
+  update_repo ();
+  add_remote ();
+}
+
+static void
+copy_file (const char *src, const char *dest)
+{
+  gchar *buffer = NULL;
+  gsize length;
+  g_autoptr(GError) error = NULL;
+
+  g_test_message ("copying %s to %s", src, dest);
+
+  if (g_file_get_contents (src, &buffer, &length, &error))
+    g_file_set_contents (dest, buffer, length, &error);
+  g_assert_no_error (error);
+  g_free (buffer);
+}
+
+static void
+copy_gpg (void)
+{
+  char *src;
+  char *dest;
+
+  src = g_test_build_filename (G_TEST_DIST, "test-keyring", "pubring.gpg", NULL);
+  dest = g_strconcat (gpg_homedir, "/pubring.gpg", NULL);
+  copy_file (src, dest);
+  g_free (src);
+  g_free (dest);
+
+  src = g_test_build_filename (G_TEST_DIST, "test-keyring", "secring.gpg", NULL);
+  dest = g_strconcat (gpg_homedir, "/secring.gpg", NULL);
+  copy_file (src, dest);
+  g_free (src);
+  g_free (dest);
+}
+
+static void
+global_setup (void)
+{
+  g_autofree char *cachedir = NULL;
+  g_autofree char *configdir = NULL;
+  g_autofree char *datadir = NULL;
+  g_autofree char *homedir = NULL;
+
+  testdir = g_strdup ("/var/tmp/flatpak-test-XXXXXX");
+  g_mkdtemp (testdir);
+  g_test_message ("testdir: %s", testdir);
+
+  homedir = g_strconcat (testdir, "/home", NULL);
+  g_mkdir_with_parents (homedir, S_IRWXU|S_IRWXG|S_IRWXO);
+
+  g_setenv ("HOME", homedir, TRUE);
+  g_test_message ("setting HOME=%s", datadir);
+
+  cachedir = g_strconcat (testdir, "/home/cache", NULL);
+  g_mkdir_with_parents (cachedir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("XDG_CACHE_HOME", cachedir, TRUE);
+  g_test_message ("setting XDG_CACHE_HOME=%s", cachedir);
+
+  configdir = g_strconcat (testdir, "/home/config", NULL);
+  g_mkdir_with_parents (configdir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("XDG_CONFIG_HOME", configdir, TRUE);
+  g_test_message ("setting XDG_CONFIG_HOME=%s", configdir);
+
+  datadir = g_strconcat (testdir, "/home/share", NULL);
+  g_mkdir_with_parents (datadir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("XDG_DATA_HOME", datadir, TRUE);
+  g_test_message ("setting XDG_DATA_HOME=%s", datadir);
+
+  flatpak_runtimedir = g_strconcat (testdir, "/runtime", NULL);
+  g_mkdir_with_parents (flatpak_runtimedir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_test_message ("setting XDG_RUNTIME_DIR=%s", flatpak_runtimedir);
+
+  flatpak_systemdir = g_strconcat (testdir, "/system", NULL);
+  g_mkdir_with_parents (flatpak_systemdir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("FLATPAK_SYSTEM_DIR", flatpak_systemdir, TRUE);
+  g_test_message ("setting FLATPAK_SYSTEM_DIR=%s", flatpak_systemdir);
+
+  flatpak_systemcachedir = g_strconcat (testdir, "/system-cache", NULL);
+  g_mkdir_with_parents (flatpak_systemcachedir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("FLATPAK_SYSTEM_CACHE_DIR", flatpak_systemcachedir, TRUE);
+  g_test_message ("setting FLATPAK_SYSTEM_CACHE_DIR=%s", flatpak_systemcachedir);
+
+  flatpak_configdir = g_strconcat (testdir, "/config", NULL);
+  g_mkdir_with_parents (flatpak_configdir, S_IRWXU|S_IRWXG|S_IRWXO);
+  g_setenv ("FLATPAK_CONFIG_DIR", flatpak_configdir, TRUE);
+  g_test_message ("setting FLATPAK_CONFIG_DIR=%s", flatpak_configdir);
+
+  gpg_homedir = g_strconcat (testdir, "/gpghome", NULL);
+  g_mkdir_with_parents (gpg_homedir, S_IRWXU|S_IRWXG|S_IRWXO);
+
+  gpg_args = g_strdup_printf ("--gpg-homedir=%s --gpg-sign=%s", gpg_homedir, gpg_id);
+  g_setenv ("GPGARGS", gpg_args, TRUE);
+  g_test_message ("setting GPGARGS=%s", gpg_args);
+
+  copy_gpg ();
+  setup_multiple_installations();
+  setup_repo ();
+}
+
+static void
+global_teardown (void)
+{
+  char *argv[] = { "gpg-connect-agent", "--homedir", "<placeholder>", "killagent", "/bye", NULL };
+
+  if (g_getenv ("SKIP_TEARDOWN"))
+    return;
+
+  argv[2] = gpg_homedir;
+
+  if (httpd_pid != -1)
+    kill (httpd_pid, SIGKILL);
+
+  run_test_subprocess (argv, RUN_TEST_SUBPROCESS_IGNORE_FAILURE);
+
+  glnx_shutil_rm_rf_at (-1, testdir, NULL, NULL);
+  g_free (testdir);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int res;
+
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/library/version", test_library_version);
+  g_test_add_func ("/library/user-installation", test_user_installation);
+  g_test_add_func ("/library/system-installation", test_system_installation);
+  g_test_add_func ("/library/multiple-system-installation", test_multiple_system_installations);
+  g_test_add_func ("/library/arches", test_arches);
+  g_test_add_func ("/library/ref", test_ref);
+  g_test_add_func ("/library/list-remotes", test_list_remotes);
+  g_test_add_func ("/library/remote-by-name", test_remote_by_name);
+  g_test_add_func ("/library/remote", test_remote);
+  g_test_add_func ("/library/list-refs", test_list_refs);
+  g_test_add_func ("/library/install-launch-uninstall", test_install_launch_uninstall);
+
+  global_setup ();
+
+  res = g_test_run ();
+
+  global_teardown ();
+
+  return res;
+}
diff --git a/triggers/desktop-database.trigger b/triggers/desktop-database.trigger
new file mode 100755 (executable)
index 0000000..2188f53
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d $1/exports/share/applications \); then
+    exec update-desktop-database -q $1/exports/share/applications
+fi
diff --git a/triggers/gtk-icon-cache.trigger b/triggers/gtk-icon-cache.trigger
new file mode 100755 (executable)
index 0000000..711cfab
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then
+    cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/
+    for dir in $1/exports/share/icons/*; do
+        if test -f $dir/index.theme; then
+            if ! gtk-update-icon-cache --quiet $dir; then
+                echo "Failed to run gtk-update-icon-cache for $dir"
+                exit 1
+            fi
+        fi
+    done
+fi
diff --git a/triggers/mime-database.trigger b/triggers/mime-database.trigger
new file mode 100755 (executable)
index 0000000..2067d8e
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d $1/exports/share/mime/packages \); then
+    exec update-mime-database $1/exports/share/mime
+fi